maint: prepare to use date ranges in copyright notices.
authorJoel E. Denny <joeldenny@joeldenny.org>
Sun, 2 Jan 2011 13:17:44 +0000 (08:17 -0500)
committerJoel E. Denny <joeldenny@joeldenny.org>
Sun, 2 Jan 2011 14:40:39 +0000 (09:40 -0500)
* README (Copyright statements): New section explaining the range
notation.  The GNU coding standards require this explanation.  I
copied ours from coreutils.
* build-aux/update-b4-copyright: Revert 2010-06-17 changes that
disabled Bison's automated use of ranges.
* cfg.mk (update-copyright-env): Likewise.
(cherry picked from commit cb3f7f335aa69ba3e6478fea8d4591f4f6d43bc5)

ChangeLog
README
build-aux/update-b4-copyright
cfg.mk

index e173352f352220abd59a16234dfab7830f8ddbb4..6fa4ee2cf55e6892fb49c40950fdf983a82920e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-02  Joel E. Denny  <joeldenny@joeldenny.org>
+
+       maint: prepare to use date ranges in copyright notices.
+       * README (Copyright statements): New section explaining the range
+       notation.  The GNU coding standards require this explanation.  I
+       copied ours from coreutils.
+       * build-aux/update-b4-copyright: Revert 2010-06-17 changes that
+       disabled Bison's automated use of ranges.
+       * cfg.mk (update-copyright-env): Likewise.
+
 2011-01-02  Joel E. Denny  <joeldenny@joeldenny.org>
 
        Correct my email address.
diff --git a/README b/README
index c99265ed3a9f228c1379ec77610480eb0aa261cc..3f10f995e997ae8f9027f69f7fef7762d1ff24f2 100644 (file)
--- a/README
+++ b/README
@@ -33,6 +33,10 @@ Please send bug reports to <bug-bison@gnu.org>.  Please include the
 version number from `bison --version', and a complete, self-contained
 test case in each bug report.
 
+* Copyright statements
+For any copyright year range specified as YYYY-ZZZZ in this package,
+note that the range specifies every single year in that closed interval.
+
 
 Local Variables:
 mode: outline
index 63a333593301d19384099c54cd15745abe15892d..ea82de4f99ab90749f12b1b8344c68c4b0c76be6 100755 (executable)
@@ -73,10 +73,19 @@ while (/($old_re)/gx)
         # Put spaces after commas.
         $year_lines =~ s/, ?/, /g;
 
-        # Do not compress to intervals; for example, do not replace
-        # "2008, 2009, 2010" with "2008-2010".  See the Copyright
-        # Notices section in Information for Maintainers of GNU Software, at:
-        # http://www.gnu.org/prep/maintain/maintain.html#Copyright-Notices
+        # Compress to intervals.
+        $year_lines =~
+          s/
+            (\d{4})
+            (?:
+              (,\ |-)
+              ((??{
+                if    ($2 eq '-') { '\d{4}'; }
+                elsif (!$3)       { $1 + 1;  }
+                else              { $3 + 1;  }
+              }))
+            )+
+          /$1-$3/gx;
 
         # Format within margin.
         my $year_lines_new;
diff --git a/cfg.mk b/cfg.mk
index 7ddfaeb35325cce6d319cf5d65777aa22f5718e2..6cd9cdd0dd9cf305b974aaf2597fb76fc151d380 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -50,4 +50,4 @@ announcement_Cc_ = \
 
 update-copyright: update-b4-copyright update-package-copyright-year
 update-copyright-env = \
-  UPDATE_COPYRIGHT_FORCE=1
+  UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1