Eric Blake <[EMAIL PROTECTED]> wrote: > According to Jim Meyering on 4/22/2008 8:28 AM: > | Without a guard like this, it is far too easy to apply a patch > | prepared against a preceding release, and not notice that a NEWS > | entry is inserted into the wrong block. > | * maint.mk (sc_immutable_NEWS): New rule. > | (update-NEWS-hash): New rule to update the hard-coded hash. > | > | + > | +# Ensure that we don't accidentally insert an entry into an old NEWS block. > | +old_NEWS_hash = c58d611d93d218181ed77f81ff2395ff - > | +sc_immutable_NEWS: > | + @if test -f $(srcdir)/NEWS; then \ > | + test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \ > | + { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \ > | + fi > | + > | +# Update the hash stored above. Do this after each release. > | +update-NEWS-hash: NEWS > | + perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" $(ME) > > Nice rule. However, two concerns here. First, how do you intend to share > maint.mk with other projects, when the NEWS hash to coreutils is now > hardcoded in here? Shouldn't the hash be stored in cfg.mk instead? > Second, what happens if a typo correction is made in the old NEWS? I > guess that means manually updating the hash to account for the intentional > changes (or maybe running 'make update-NEWS-hash' after ensuring that all > I changed was a typo fix).
BTW, here's what I've just pushed: >From d9c1b8fd30a36d7f05cfb8f830dc62765cf60792 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[EMAIL PROTECTED]> Date: Tue, 22 Apr 2008 21:28:33 +0200 Subject: [PATCH] build: move a project-specific definition to cfg.mk * cfg.mk (old_NEWS_hash): Define here, ... * maint.mk: ... not here. (update-NEWS-hash): Update comment. Suggestion from Eric Blake. Signed-off-by: Jim Meyering <[EMAIL PROTECTED]> --- cfg.mk | 2 ++ maint.mk | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cfg.mk b/cfg.mk index 61c3bc5..6b039c5 100644 --- a/cfg.mk +++ b/cfg.mk @@ -39,3 +39,5 @@ gnulib_dir = /gnulib # Now that we have better (check.mk) tests, make this the default. export VERBOSE = yes + +old_NEWS_hash = c58d611d93d218181ed77f81ff2395ff - diff --git a/maint.mk b/maint.mk index e2a8e1c..66f6d5d 100644 --- a/maint.mk +++ b/maint.mk @@ -431,16 +431,17 @@ NEWS_hash = \ $(srcdir)/NEWS | md5sum -) # Ensure that we don't accidentally insert an entry into an old NEWS block. -old_NEWS_hash = c58d611d93d218181ed77f81ff2395ff - sc_immutable_NEWS: @if test -f $(srcdir)/NEWS; then \ test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \ { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \ fi -# Update the hash stored above. Do this after each release. +# Update the hash stored above. Do this after each release and +# for any corrections to old entries. update-NEWS-hash: NEWS - perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" $(ME) + perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \ + $(srcdir)/cfg.mk # Ensure that the c99-to-c89 patch applies cleanly. patch-check: -- 1.5.5.1.68.gbdcd8 _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils