[libvirt] [PATCH] build: rerun bootstrap if po/Makevars got nuked

Eric Blake eblake at redhat.com
Wed Aug 4 20:49:28 UTC 2010


There has been a frequent complaint of:

make[2]: Entering directory `/home/remote/eblake/libvirt/po'
make[2]: *** No rule to make target `/config.status', needed by `Makefile'.  Stop.

It happens after nuking and regenerating the po directory,
which is a common action after running anything like
'make dist' or 'make rpm' that dirties all the .po files.

Teach autogen.sh that it must regenerate po/Makevars to avoid
the missing variable declaration, and teach cfg.mk to recognize
that a nuked po directory is cause to rerun autogen.sh.

* cfg.mk (_update_required): Check for po/Makevars.
* autogen.sh (bootstrap): Run bootstrap if it got lost.
Diagnosed by Justin Clift.
---

Tested by 'git clean -x -f po && make'.  A bit drastic
(I prefer 'git checkout po' as the fastest way to undo
local changes to the po directory caused by 'make dist',
since that won't erase po/Makevars), but using that
sledgehammer to clean po/ proves that this patch works.

This should even work in a VPATH build :)

 autogen.sh |    8 ++++++--
 cfg.mk     |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 2f5b42d..c0a1c4a 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -74,10 +74,14 @@ bootstrap_hash()

 # Ensure that whenever we pull in a gnulib update or otherwise change to a
 # different version (i.e., when switching branches), we also rerun ./bootstrap.
+# Also, running 'make rpm' tends to litter the po/ directory, and some people
+# like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates
+# the required file po/Makevars.
 curr_status=.git-module-status
 t=$(bootstrap_hash; git diff .gnulib)
-if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
-    : # good, it's up to date, all we need is autoreconf
+if test "$t" = "$(cat $curr_status 2>/dev/null)" \
+    && test -f "$THEDIR/po/Makevars"; then
+    # good, it's up to date, all we need is autoreconf
     autoreconf -if
 else
     echo running bootstrap...
diff --git a/cfg.mk b/cfg.mk
index e12265e..7226828 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -459,6 +459,7 @@ ifeq (0,$(MAKELEVEL))
   # b653eda3ac4864de205419d9f41eec267cb89eeb
   _submodule_hash = sed 's/^[ +-]//;s/ .*//'
   _update_required := $(shell						\
+      test -f po/Makevars || { echo 1; exit; };				\
       cd '$(srcdir)';							\
       actual=$$(git submodule status | $(_submodule_hash);		\
 		git hash-object bootstrap.conf;				\
-- 
1.7.2




More information about the libvir-list mailing list