[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] build: submodule machinery now works also when no tag is reachable



Mike Burns wrote:
> I hit an issue with libvirt autobuild.  I am running on an F11 machine and the build stage of libvirt--devel is failing.
...
> I talked to danpb and he pointed out that there is a difference between .git-module-status and git submodule status:
>
> <danpb1> $ cat .git-module-status
> <danpb1> -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
> <danpb1>  git submodule status
> <danpb1>  b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)

Hi Mike,

Thanks for the report, and thanks to Dan for looking into it.
Here's a patch:

>From 3d3f1b105e4808d1c02f2132317bf815cf587604 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Wed, 15 Jul 2009 09:54:26 +0200
Subject: [PATCH] build: submodule machinery now works also when no tag is reachable

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 |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 3b3d57f..a5514c4 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -233,9 +233,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
--
1.6.4.rc0.127.g81400


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]