From: Jim Meyering Date: Fri, 27 Jan 2012 09:19:26 +0000 (+0100) Subject: update-copyright: accept new option: UPDATE_COPYRIGHT_USE_INTERVALS=2 X-Git-Tag: v0.1~1209 X-Git-Url: http://erislabs.net/gitweb/?p=gnulib.git;a=commitdiff_plain;h=4994b1aab88924f5db960472c2189fa1b46c6778 update-copyright: accept new option: UPDATE_COPYRIGHT_USE_INTERVALS=2 * build-aux/update-copyright: When UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps to the minimal containing range. For example, convert 2000, 2004-2007, 2009 to 2000-2009. * tests/test-update-copyright.sh: Test for this. The FSF confirmed it is ok to do this, assuming there is at least one significant change per year in the affected range: http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/29554/focus=29860 --- diff --git a/ChangeLog b/ChangeLog index d8efdbedd..329cc3af0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-01-27 Jim Meyering + + update-copyright: accept new option: UPDATE_COPYRIGHT_USE_INTERVALS=2 + * build-aux/update-copyright: When UPDATE_COPYRIGHT_USE_INTERVALS=2, + convert a sequence with gaps to the minimal containing range. + For example, convert 2000, 2004-2007, 2009 to 2000-2009. + * tests/test-update-copyright.sh: Test for this. + The FSF confirmed it is ok to do this, assuming there is at + least one significant change per year in the affected range: + http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/29554/focus=29860 + 2012-01-26 Bruno Haible pipe2: refine doc about thread-safety diff --git a/build-aux/update-copyright b/build-aux/update-copyright index d86a12beb..30a27f2d8 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' if 0; # Update an FSF copyright year list to include the current year. -my $VERSION = '2011-01-02.20:59'; # UTC +my $VERSION = '2012-01-27.09:18'; # UTC # Copyright (C) 2009-2012 Free Software Foundation, Inc. # @@ -110,6 +110,9 @@ my $VERSION = '2011-01-02.20:59'; # UTC # 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. +# If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps +# to the minimal containing range. For example, convert +# 2000, 2004-2007, 2009 to 2000-2009. # 3. For testing purposes, you can set the assumed current year in # UPDATE_COPYRIGHT_YEAR. # 4. The default maximum line length for a copyright line is 72. @@ -221,6 +224,10 @@ if (defined $stmt_re) })) )+ /$1-$3/gx; + + # When it's 2, emit a single range encompassing all year numbers. + $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 + and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/; } # Format within margin. diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 379c6a248..80b8c5a89 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -424,6 +424,13 @@ compare - $TMP < $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP <