]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: submodule machinery now works also when no tag is reachable
authorJim Meyering <meyering@redhat.com>
Wed, 15 Jul 2009 07:54:26 +0000 (09:54 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 16 Jul 2009 16:42:47 +0000 (18:42 +0200)
The code in cfg.mk to detect when the git submodule was out of date
worked most of the time, but not when checked out in a certain way.
* cfg.mk: Extract submodule hash from command output and file,
and compare only that, since the format of the full line may vary.
Reported by Mike Burns, with some diagnosis by Daniel P Berrange.

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 0bf935d51a7f504448326a288c9eec72e3605a2a..64bd26e0ffbdd5b43894918d02899cbb0dabc9ee 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -242,9 +242,17 @@ prev_version_file = /dev/null
 
 ifeq (0,$(MAKELEVEL))
   _curr_status = .git-module-status
-  _update_required :=                                                  \
-    $(shell t=$$(git submodule status);                                        \
-      test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)"; echo $$?)
+  # The sed filter accommodates those who check out on a commit from which
+  # no tag is reachable.  In that case, git submodule status prints a "-"
+  # in column 1 and does not print a "git describe"-style string after the
+  # submodule name.  Contrast these:
+  # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
+  #  b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
+  _submodule_hash = sed 's/.//;s/ .*//'
+  _update_required := $(shell                                          \
+      actual=$$(git submodule status | $(_submodule_hash));            \
+      stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)";      \
+      test "$$stamp" = "$$actual"; echo $$?)
   ifeq (1,$(_update_required))
     $(error gnulib update required; run ./autogen.sh first)
   endif