Joel E. Denny wrote: > On Wed, 29 Jul 2009, Jim Meyering wrote: > >> Joel E. Denny wrote: >> >> > On Wed, 29 Jul 2009, Jim Meyering wrote: >> > >> >> Joel E. Denny wrote: >> > >> >> > I'd like to use this in Bison. Would you consider contributing >> >> > build-aux/update-copyright to gnulib so we don't maintain separate >> >> > copies? >> >> >> >> Sure. >> > >> > Thanks. I'll watch for that. In the meantime, I'll probably import a >> > copy into Bison. >> >> I've just pushed it to gnulib: > > Thanks. I didn't notice this before I posted that last patch to > bug-coreutils: > > http://lists.gnu.org/archive/html/bug-coreutils/2009-07/msg00213.html > > Here it is again, rewritten for gnulib. I've also made some improvements > to the documentation.
Thank you! Here's an incremental change I'm about to fold into yours. It changes "comment" to "prefix" and adjusts syntax. There remains at least one infelicity: if someone discusses the Copyright (C) notation (e.g., as on this line), and later has the copyright-with-dates line, the prefixes may not match. We could require that the Copyright...holder (and hence prefix) are all in proximity, but that may not be worth the trouble. diff --git a/build-aux/update-copyright b/build-aux/update-copyright index c4419b5..e35d51b 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -1,7 +1,7 @@ #!/usr/bin/perl -0777 -pi # Update an FSF copyright year list to include the current year. -my $VERSION = '2009-07-29.19:13'; # UTC +my $VERSION = '2009-07-30.13:24'; # UTC # Copyright (C) 2009 Free Software Foundation # @@ -22,10 +22,10 @@ my $VERSION = '2009-07-29.19:13'; # UTC # In the copyright statement in each file, "Copyright (C)" must appear # at the beginning of the line except that it may be preceded by any -# comment sequence of no more than 5 characters. Iff that comment -# sequence is present, the same comment sequence should appear at the -# beginning of each remaining line within the copyright statement so -# that it can be parsed correctly. +# sequence (e.g., a comment) of no more than 5 characters. Iff that +# prefix is present, the same prefix should appear at the beginning +# of each remaining line within the copyright statement so that it +# can be parsed correctly. # # For example, these are fine: # @@ -52,11 +52,11 @@ my $VERSION = '2009-07-29.19:13'; # UTC # # .PHONY: update-copyright # update-copyright: -# if test -d .git; then \ -# git grep -l -w Copyright \ -# | grep -v -E '(^|/)(COPYING|ChangeLog)' \ -# | xargs $(srcdir)/build-aux/$@; \ -# fi +# if test -d .git; then \ +# git grep -l -w Copyright \ +# | grep -v -E '(^|/)(COPYING|ChangeLog)' \ +# | xargs $(srcdir)/build-aux/$@; \ +# fi # # You can build a list of files to skip in the second grep. @@ -67,12 +67,12 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime (time()); my $this_year = $year + 1900; my $holder = 'Free Software Foundation'; -my $comment = ""; +my $prefix = ''; if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) { - $comment = quotemeta($1); + $prefix = quotemeta $1; } $holder = " $holder"; -$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g; +$holder =~ s/\s/\\s*(?:\\s|\\n$prefix)\\s*/g; if (/([- ])((?:\d\d)?\d\d)($holder)/s) {