bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module: update-copyright [Re: copyright years: mass-update every


From: Joel E. Denny
Subject: Re: new module: update-copyright [Re: copyright years: mass-update every January 1
Date: Wed, 29 Jul 2009 15:55:06 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

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.

>From 009b660dd28dfbb2b289b367d243d08d7ef01588 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Wed, 29 Jul 2009 15:17:53 -0400
Subject: [PATCH] update-copyright: generalize comment handling

* build-aux/update-copyright: Handle copyright statements
within more comment styles.
Document usage.
Report any file with an external copyright holder or parse failure.
---
 ChangeLog                  |    8 ++++++
 build-aux/update-copyright |   56 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9c386f5..5f1c812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-29  Joel E. Denny  <address@hidden>
+
+       update-copyright: generalize comment handling
+       * build-aux/update-copyright: Handle copyright statements
+       within more comment styles.
+       Document usage.
+       Report any file with an external copyright holder or parse failure.
+
 2009-07-29  Jim Meyering  <address@hidden>
 
        mktime: correct setting of REPLACE_MKTIME
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 1ceaf8a..c4419b5 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.13:34'; # UTC
+my $VERSION = '2009-07-29.19:13'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -20,6 +20,46 @@ my $VERSION = '2009-07-29.13:34'; # UTC
 
 # Written by Jim Meyering
 
+# 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.
+#
+# For example, these are fine:
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#    * Copyright (C) 1990-2005, 2007-2009 Free Software
+#    * Foundation, Inc.
+#    */
+#
+# The following format is not recognized:
+#
+#   /* Copyright (C) 1990-2005, 2007-2009 Free Software
+#    * Foundation, Inc.  */
+#
+# A warning is printed for every file for which the copyright format is
+# not recognized.  The culprit may be that the above preconditions are
+# not obeyed as in the previous example, or it may simply be that the
+# stated copyright holder is not the Free Software Foundation.
+#
+# You may wish to place a target like the following in your top-level
+# makefile in your project:
+#
+#   .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
+#
+# You can build a list of files to skip in the second grep.
+
 use strict;
 use warnings;
 
@@ -27,7 +67,14 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';
 
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+my $comment = "";
+if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
+  $comment = quotemeta($1);
+}
+$holder = " $holder";
+$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+
+if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {
     my ($sep, $last_c_year, $rest) = ($1, $2, $3);
 
@@ -51,6 +98,11 @@ if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
           }
       }
   }
+else
+  {
+    print STDERR
+      "$ARGV: warning: external copyright holder or parse failure\n";
+  }
 
 # Local variables:
 # indent-tabs-mode: nil
-- 
1.5.4.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]