bug-gnulib
[Top][All Lists]
Advanced

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

Re: copyright years: mass-update every January 1


From: Joel E. Denny
Subject: Re: copyright years: mass-update every January 1
Date: Fri, 14 Aug 2009 15:01:46 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Fri, 14 Aug 2009, Jim Meyering wrote:

> > Below are some patches to implement that.
> ...
> > +2009-08-14  Joel E. Denny  <address@hidden>
> > +
> > +   update-copyright: convert 2-digit to 4-digit years
> > +   * build-aux/update-copyright: Implement and document.
> > +   * tests/test-update-copyright.sh: Update.
> ...
> > +   update-copyright: much ado about intervals
> > +   * build-aux/update-copyright: Implement and document
> > +   UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
> > +   of copyright year intervals.
> > +   Also, document UPDATE_COPYRIGHT_YEAR.
> > +   * tests/test-update-copyright.sh: Test it.
> 
> Thanks for all of that.
> Pushed.

Thanks.  Here's a patch to help those who don't want to wait until January 
to reformat.

>From 39a10be68cc3f2a46b97db97123ed0217192c917 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 14 Aug 2009 13:12:54 -0400
Subject: [PATCH] update-copyright: implement forced reformatting

* build-aux/update-copyright: Implement and document
UPDATE_COPYRIGHT_FORCE.
* tests/test-update-copyright.sh: Test it.
---
 ChangeLog                      |    7 +++++++
 build-aux/update-copyright     |   40 ++++++++++++++++++++++++++--------------
 tests/test-update-copyright.sh |   22 +++++++++++-----------
 3 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3c0089b..eaa5549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-14  Joel E. Denny  <address@hidden>
+
+       update-copyright: implement forced reformatting
+       * build-aux/update-copyright: Implement and document
+       UPDATE_COPYRIGHT_FORCE.
+       * tests/test-update-copyright.sh: Test it.
+
 2009-08-14  Eric Blake  <address@hidden>
        and Bruno Haible  <address@hidden>
 
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index d8445fe..bd0dda5 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-08-14.05:03'; # UTC
+my $VERSION = '2009-08-14.18:56'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -25,12 +25,17 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 # use the update-copyright target rule in maint.mk from gnulib's
 # maintainer-makefile module.
 #
-# Iff an FSF copyright statement is discovered in a file and the final
+# Iff an FSF copyright statement is recognized in a file and the final
 # year is not the current year, then the statement is updated for the
-# new year, 2-digit years are converted to 4-digit years by prepending
-# "19", and the statement is reformatted to fit within 72 columns.  A
-# warning is printed for every file for which no FSF copyright statement
-# is discovered.
+# new year and it is reformatted to:
+#
+#   1. Fit within 72 columns.
+#   2. Convert 2-digit years to 4-digit years by prepending "19".
+#   3. Expand copyright year intervals.  (See "Environment variables"
+#      below.)
+#
+# A warning is printed for every file for which no FSF copyright
+# statement is recognized.
 #
 # Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
@@ -91,16 +96,21 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 #   6. Blank lines, even if preceded by the prefix, do not appear
 #      within the FSF copyright statement.
 #   7. Each copyright year is 2 or 4 digits, and years are separated by
-#      commas or dashes.  Whitespace may occur after commas.
+#      commas or dashes.  Whitespace may appear after commas.
 #
 # Environment variables:
 #
-#   1. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
-#      copyright years (such as 90, 1991, 1992-2007, 2008) in an updated
-#      FSF copyright statement is collapsed to a single interval (such
-#      as 1990-2008).  If unset or set to 0, all existing copyright year
-#      intervals are expanded.
-#   2. For testing purposes, you can set the assumed current year in
+#   1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
+#      is reformatted even if it does not need updating for the new
+#      year.  If unset or set to 0, only updated FSF copyright
+#      statements are reformatted.
+#   2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
+#      copyright years (such as 90, 1991, 1992-2007, 2008) in a
+#      reformatted FSF copyright statement is collapsed to a single
+#      interval (such as 1990-2008).  If unset or set to 0, all existing
+#      copyright year intervals in a reformatted FSF copyright statement
+#      are expanded instead.
+#   3. For testing purposes, you can set the assumed current year in
 #      UPDATE_COPYRIGHT_YEAR.
 
 use strict;
@@ -172,7 +182,9 @@ if (defined $stmt_re)
       {
         # Update the year.
         $stmt =~ s/$final_year_orig/$final_year, $this_year/;
-
+      }
+    if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
+      {
         # Normalize all whitespace including newline-prefix sequences.
         $stmt =~ s/$ws_re/ /g;
 
diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh
index ac47b9b..e8a71ce 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -145,7 +145,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
 EOF
 
-UPDATE_COPYRIGHT_YEAR=2011 \
+UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
 compare - $TMP-stderr <<EOF || exit 1
@@ -154,18 +154,18 @@ $TMP.5: warning: FSF copyright statement not found
 EOF
 compare - $TMP.1 <<EOF || exit 1
 Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
-2011 Free Software Foundation, Inc.
+1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+Free Software Foundation, Inc.
 EOF
 compare - $TMP.2 <<EOF || exit 1
 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-# Free Software Foundation, Inc.
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+# Software Foundation, Inc.
 EOF
 compare - $TMP.3 <<EOF || exit 1
 /*
- * Copyright &copy; 1990, 2005, 2007, 2008, 2009, 2010, 2011 Free
- * Software Foundation, Inc.
+ * Copyright &copy; 1990, 2005, 2007, 2008, 2009, 2010 Free Software
+ * Foundation, Inc.
  */
 EOF
 compare - $TMP.4 <<EOF || exit 1
@@ -180,15 +180,15 @@ compare - $TMP.6 <<EOF || exit 1
 #  Foundation, Inc.
 
 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-Free Software Foundation, Inc.
+1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
 EOF
 compare - $TMP.7 <<EOF || exit 1
 Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 
 # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-# Free Software Foundation, Inc.
+# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free
+# Software Foundation, Inc.
 EOF
 
 rm $TMP*
-- 
1.5.4.3





reply via email to

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