bug-gnulib
[Top][All Lists]
Advanced

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

Re: update-copyright request and patch...


From: Jim Meyering
Subject: Re: update-copyright request and patch...
Date: Fri, 27 Jan 2012 10:21:35 +0100

Joel Brobecker wrote:
>> > Yep, this is what we did for this year. I just want to go one step
>> > further and just collapse all years into one single range, based on
>> > the fact that I have verified that we have made significant changes
>> > to at least one file each year since 1986.
>>
>> I have already done this for some files in Libidn, based on the
>> observation that the earlier omissions were mistakes and that the
>> copyright year should have been bumped on every file because there was a
>> release every year.  If this is illegal or bad practice, it would be
>> useful if you could share your response from the FSF.
>
> For everyone's benefit, the FSF confirmed that it is fine to do so
> (case [gnu.org #719834]).

Thanks.  Here's an adjusted version of update-copyright that
implements that.

>From 87d33f7e78fcafd860fa3a53a39d4ad669a53f00 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Jan 2012 10:19:26 +0100
Subject: [PATCH] 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.
---
 ChangeLog                      |    8 ++++++++
 build-aux/update-copyright     |    9 ++++++++-
 tests/test-update-copyright.sh |    7 +++++++
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d8efdbe..adf37f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-27  Jim Meyering  <address@hidden>
+
+       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.
+
 2012-01-26  Bruno Haible  <address@hidden>

        pipe2: refine doc about thread-safety
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index d86a12b..30a27f2 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 379c6a2..80b8c5a 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -424,6 +424,13 @@ compare - $TMP <<EOF || exit 1
                # 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 <<EOF || exit 1
+               # Copyright (C) 1987-2011 Free Software Foundation, Inc.
+EOF
 rm $TMP*

 ## --------- ##
--
1.7.9.rc2.2.g183d6



reply via email to

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