From 68466d44b1ff35383271930c12186b3d2fd53976 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 22 Apr 2008 10:45:21 +0200 Subject: [PATCH] guard against inserting a NEWS entry into a block for a prior release 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. --- maint.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/maint.mk b/maint.mk index 46bc8b6..e2a8e1c 100644 --- a/maint.mk +++ b/maint.mk @@ -42,6 +42,7 @@ endif PREV_VERSION := $(shell cat $(prev_version_file)) VERSION_REGEXP = $(subst .,\.,$(VERSION)) +PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION)) ifeq ($(VC),$(GIT)) this-vc-tag = v$(VERSION) @@ -425,6 +426,22 @@ sc_perl_coreutils_test: exit 1; } || :; \ fi +NEWS_hash = \ + $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ + $(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-NEWS-hash: NEWS + perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" $(ME) + # Ensure that the c99-to-c89 patch applies cleanly. patch-check: rm -rf src-c89 $@.1 $@.2 -- 2.7.4