I realized that I really didn't want to encourage using grep (as opposed to grep -E) regular expressions in any customized news check. Then I realized that news-date-check wasn't really accurate, since the default is also to check the version number. So I renamed the new variable to be more general as well as the rule itself, though the rule should be used only internally.
Along the way, I moved the today=`...` setting "up" so that it's now a slightly more readable (less quoting) GNU make variable. Accordingly, Alfred, you'll have to adjust the name in your override code. Oops. And in writing this I've realized that I neglected to backslash-quote the parentheses, with the addition of -E. Maybe we should leave grep without -E after all. pushed too hastily... >From 875fb2d6773114a51fbb4cea4580233b3355f47d Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 5 Dec 2009 09:35:28 +0100 Subject: [PATCH] maint.mk: news-check: use grep -E * top/maint.mk (today): Define a Make variable, not a... (news-date-check): ...shell variable. (news-check-regexp): Use the Make variable. Use grep's -E option. Change the failing diagnostic to mention the variable, $(news-check-regexp). (news-check): Rename target from news-date-check. Update sole use. --- ChangeLog | 9 +++++++++ top/maint.mk | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bba40ed..d7025c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-05 Jim Meyering <meyer...@redhat.com> + + maint.mk: news-date-check: use grep -E + * top/maint.mk (today): Define a Make variable, not a... + (news-date-check): ...shell variable. + (news-date-regexp): Use the Make variable. + Use grep's -E option. Change the failing diagnostic to mention + the variable, $(news-date-regexp). + 2009-12-04 Alfred M. Szmidt <a...@gnu.org> maintainer-makefile: allow customization of NEWS entry format diff --git a/top/maint.mk b/top/maint.mk index a7e31f0..596da38 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -79,7 +79,8 @@ endif # Override this in cfg.mk if you are using a different format in your # NEWS file. -news-date-regexp ?= '^\*.* $(VERSION_REGEXP) ('$$today')' +today = $(shell date +%Y-%m-%d) +news-check-regexp ?= '^\*.* $(VERSION_REGEXP) ($(today))' # Prevent programs like 'sort' from considering distinct strings to be equal. # Doing it here saves us from having to set LC_ALL elsewhere in this file. @@ -572,13 +573,12 @@ sc_makefile_check: $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \ && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : -news-date-check: NEWS - today=`date +%Y-%m-%d`; \ - if head $(srcdir)/NEWS | grep $(news-date-regexp) \ +news-check: NEWS + if head $(srcdir)/NEWS | grep -E $(news-check-regexp) \ >/dev/null; then \ :; \ else \ - echo "version or today's date is not in NEWS" 1>&2; \ + echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \ exit 1; \ fi @@ -758,7 +758,7 @@ alpha beta stable: $(local-check) writable-files no-submodule-changes || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ || : $(MAKE) vc-diff-check - $(MAKE) news-date-check + $(MAKE) news-check $(MAKE) distcheck $(MAKE) dist XZ_OPT=-9ev $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir) -- 1.6.6.rc1.280.ge45b