Paul Eggert <eggert <at> CS.UCLA.EDU> writes: > > One other possibility I've thought about. We could have 'make install' check > > git-version-gen, and abort rather than install if it is out-of-date with > > reality (of course, if .tarball-version exists, it will never be out-of- date).
Actually, in testing my patch, I found one case where the version string can be out-of-date when .tarball-version exists - it occurs when you create .tarball- version inside your VCS checkout, and have uncommitted files (at which point git-version-gen uses `cat .tarball-version`-dirty as the version string). But in general, since git-version-gen favors .tarball-version which should always exist in a tarball, .tarball-version shouldn't normally exist in the VCS checkout, and the git-version-gen '-dirty' suffix only occurs when in a git checkout, I still stand by the claim that making 'make install' error out on version mismatch will only affect people trying to install an unreleased development snapshot who have changed the VCS tree since the last time they ran a full autoreconf. > > That sounds like a reasonable approach for now. How about this patch? >From 87c65f774fe06d0ea81f6988a594a61bac1dea5f Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Mon, 21 Jul 2008 09:13:38 -0600 Subject: [PATCH] Don't allow installation with stale devel version number. * top/GNUmakefile (_is-install-target): New macro. (_curr-ver): Forbid installation with stale version number. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 6 ++++++ top/GNUmakefile | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cba218..ef2f20a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-21 Eric Blake <[EMAIL PROTECTED]> + + Don't allow installation with stale devel version number. + * top/GNUmakefile (_is-install-target): New macro. + (_curr-ver): Forbid installation with stale version number. + 2008-07-20 Bruno Haible <[EMAIL PROTECTED]> * modules/c-stack-tests (Makefile.am): Add LIBSIGSEGV to diff --git a/top/GNUmakefile b/top/GNUmakefile index 31bd873..5c10370 100644 --- a/top/GNUmakefile +++ b/top/GNUmakefile @@ -55,12 +55,22 @@ _have-git-version-gen := \ ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL)) _is-dist-target = $(filter-out %clean, \ $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS))) - ifneq (,$(_is-dist-target)) + _is-install-target = $(filter-out %check, $(filter install%,$(MAKECMDGOALS))) + ifneq (,$(_is-dist-target)$(_is-install-target)) _curr-ver := $(shell cd $(srcdir) \ && $(_build-aux)/git-version-gen .tarball-version) ifneq ($(_curr-ver),$(VERSION)) ifeq ($(_curr-ver),UNKNOWN) $(info WARNING: unable to verify if $(VERSION) is correct version) + else ifneq (,$(_is-install-target)) + # GNU Coding Standards state that 'make install' should not cause + # recompilation after 'make all'. But as long as changing the version + # string alters config.h, the cost of having 'make all' always have an + # up-to-date version is prohibitive. So, as a compromise, we merely + # refuse to install if the version string is out of date; the user + # must run 'autoreconf' (or something like 'make distcheck') to + # fix the version, 'make all' to propogate it, then 'make install'. + $(error version string $(VERSION) is out of date; run autoreconf before installing) else $(info INFO: running autoreconf for new version string: $(_curr-ver)) _dummy := $(shell cd $(srcdir) && rm -rf autom4te.cache .version \ -- 1.5.6.3