# HG changeset patch # User Jim Meyering # Date 1327655966 -3600 # Node ID c38ba07a30d174af16d5b71eb1cd585422b12967 # Parent e0f8ddc05b50424d10480f28baa85d477a875b89 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 -r e0f8ddc05b50 -r c38ba07a30d1 ChangeLog --- a/ChangeLog Thu Jan 26 21:21:53 2012 -0700 +++ b/ChangeLog Fri Jan 27 10:19:26 2012 +0100 @@ -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 -r e0f8ddc05b50 -r c38ba07a30d1 build-aux/update-copyright --- a/build-aux/update-copyright Thu Jan 26 21:21:53 2012 -0700 +++ b/build-aux/update-copyright Fri Jan 27 10:19:26 2012 +0100 @@ -3,7 +3,7 @@ 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 @@ # 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 @@ })) )+ /$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 -r e0f8ddc05b50 -r c38ba07a30d1 tests/test-update-copyright.sh --- a/tests/test-update-copyright.sh Thu Jan 26 21:21:53 2012 -0700 +++ b/tests/test-update-copyright.sh Fri Jan 27 10:19:26 2012 +0100 @@ -424,6 +424,13 @@ # Copyright (C) 1987-1988, 1991-2011 Free Software # Foundation, Inc. EOF +UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=2 \ + UPDATE_COPYRIGHT_FORCE=1 update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr +compare /dev/null $TMP-stdout || exit 1 +compare /dev/null $TMP-stderr || exit 1 +compare - $TMP <