Eric Blake wrote: > I noticed that NEWS_hash in maint.mk doesn't work for m4. Why? Because m4 > uses long-hand copyright years, and lists enough years that the > regex '^Copyright.*Free Software' no longer matches. In other words, adding > 2010 to the copyright changed the old news hash. > > For that matter, NEWS_hash is using 'sed | grep -v'. It seeems like it should > be possible to sanitize the copyright line(s) all within the sed, without > having to use a secondary grep process. But I'm not fluent enough with sed to > quickly write a script that can sanitize both styles into a single > recognizable > line: > > Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007, 2008, 2009, 2010 > Free Software Foundation, Inc. > > Copyright (C) 2001-2010 Free Software Foundation, Inc.
This should do it perl -0777 -pe 's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.//ms' Here's an untested patch: diff --git a/top/maint.mk b/top/maint.mk index 40f306e..6e472fe 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -550,7 +550,8 @@ sc_const_long_option: NEWS_hash = \ $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ $(srcdir)/NEWS \ - | grep -v '^Copyright .*Free Software' \ + | perl -0777 -pe \ + 's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.//ms' \ | md5sum - \ | sed 's/ .*//') > Meanwhile, with the recent GFDL change [1], the coreutils NEWS hash also ended > up with an alteration, detected by 'make syntax-check' (via > sc_immutable_NEWS). Therefore, how about this patch, which just ignores the > NEWS footer altogether (to be applied before the amended coreutils patch, so > that I'm only updating the coreutils hash once)? > > [1] http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19496 > > However, if this patch is applied, everyone using maint.mk will need to do a > one-time run of 'make update-NEWS-hash' to update their saved hash the footer > discarded. IMHO, that's fine. > Yes, this patch did not use portable spacing of the sed {} command, but anyone > running GNUMakefile probably has a decent sed on their PATH and doesn't have > to > obey the portability rule of putting { and } on their own lines. > > Comments? ... > NEWS_hash = \ > - $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ > - $(srcdir)/NEWS > \ > - | grep -v '^Copyright .*Free Software' \ > + $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,/^Copyright/ { \ > + /^Copyright/d; p }' $(srcdir)/NEWS \ > | md5sum - > \ > | sed 's/ .*//') Requiring a decent sed isn't a big problem, but... Did you consider using perl or awk? For perl, this should work: $$(perl -ne '(/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/.../^Copyright/) && !/^Copyright/ and print' $(srcdir)/NEWS ... Then I realized that the patch above would probably be enough. The GFDL version number will not be changing often.