Discussion:
[PATCH] update-copyright: add code to handle more special cases
(too old to reply)
Jim Meyering
2018-01-02 05:02:14 UTC
Permalink
Thanks to Paul for updating copyright dates so quickly.
He found enough cases that need special handling that I
wanted to automate the updating of those bits, too.
So I wrote the following.

I tested it by resetting to 611f12013b42466749cf00016e6e27b73d3a224c and
ensuring that "make update-copyright" would now also induce the changes
of d9afeacd0e2396deaabab291ab94e09ab9834fdb.

I'll push this tomorrow:

Subject: [PATCH] update-copyright: add code to handle more special cases

After running "make update-copyright" this year, five files
required additional manual changes. Automate those adjustments
for next year.
* Makefile (_year_and_prev): Define.
(update-copyright): Add perl commands to induce this year's post-
update-copyright adjustments.
---
ChangeLog | 10 ++++++++++
Makefile | 13 +++++++++++++
2 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index d3cb40d53..b0f01dfef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-01-01 Jim Meyering <***@fb.com>
+
+ update-copyright: add code to handle more special cases
+ After running "make update-copyright" this year, five files
+ required additional manual changes. Automate those adjustments
+ for next year.
+ * Makefile (_year_and_prev): Define.
+ (update-copyright): Add perl commands to induce this year's post-
+ update-copyright adjustments.
+
2018-01-01 Paul Eggert <***@cs.ucla.edu>

version-etc: new year
diff --git a/Makefile b/Makefile
index 786531b2d..aa5bf01c1 100644
--- a/Makefile
+++ b/Makefile
@@ -150,6 +150,9 @@ regen: MODULES.html
MODULES.html: MODULES.html.sh
./MODULES.html.sh > MODULES.html

+# A perl BEGIN block to set Y to the current year number and W to Y-1.
+_year_and_prev = BEGIN{@t=localtime(time); $$y=$$t[5]+1900; $$w=$$y-1}
+
# Run this rule once per year (usually early in January)
# to update all FSF copyright year lists here.
# We exclude the files listed in srclist.txt (maintained elsewhere)
@@ -157,6 +160,9 @@ MODULES.html: MODULES.html.sh
# Also exclude any file that includes the "GENERATED AUTOMATICALLY" comment,
# being careful not to exclude code that merely generates the comment.
# Also exclude doc/INSTALL*, since they too are generated.
+# Also adjust template-style files that must start with a single
+# (the current) year number in some places.
+# Also adjust version-etc.c and and gendocs.sh.
update-copyright:
exempt=$$(mktemp); \
grep -v '^#' config/srclist.txt|grep -v '^$$' \
@@ -172,3 +178,10 @@ update-copyright:
| UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
xargs build-aux/update-copyright
+ perl -pi -e '$(_year_and_prev) s/(copyright.*)\b$$w\b/$$1$$y/i' \
+ lib/version-etc.c doc/gnulib.texi build-aux/gendocs.sh
+ perl -pi -e '$(_year_and_prev) s/ $$w-$$y / $$y /g' \
+ doc/gendocs_template* build-aux/gendocs.sh
+ perl -pi -e \
+ '$(_year_and_prev) s/^(scriptversion=)$$w.*/$$1$$y-01-01.00/i' \
+ build-aux/gendocs.sh
--
2.15.1.433.g936d1b989
Paul Eggert
2018-01-02 08:15:46 UTC
Permalink
Thanks for doing that. It can be a challenge improving programs that are run
only once a year. I'm reminded of the Long Now's clock:

http://longnow.org/clock/

which has even longer-term debugging issues.

Loading...