[PATCH] build: honor autogen.sh --no-git

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

 



Based on a report by Chandrashekar Shastri, at
https://bugzilla.redhat.com/show_bug.cgi?id=979360

On systems where git cannot access the outside world, a developer
can instead arrange to get a copy of gnulib at the right commit
via side channels (such as NFS share drives), set GNULIB_SRCDIR,
then use ./autogen.sh --no-git.  In this setup, we will now
avoid direct use of git.  Of course, this means no automatic
gnulib updates when libvirt.git updates its submodule, but it
is expected that any developer in such a situation is already
prepared to deal with the fallout.

* .gnulib: Update to latest, for bootstrap.
* bootstrap: Synchronize from gnulib.
* autogen.sh (no_git): Avoid git when requested.
* cfg.mk (_update_required): Skip automatic rerun of bootstrap if
we can't use git.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---

This does not qualify as a build-breaker, and although it touches
gnulib, it is complex enough that I'm not quite willing to push
it under my carte-blanche rule for gnulib updates outside of
freezes.  So, if anyone is willing to review, great; if not, I'll
probably still push on Monday, as it did pass my testing.

* .gnulib f40e61e...b72ff2a (1):
  > bootstrap: honor --no-git

 .gnulib    |  2 +-
 autogen.sh | 10 ++++++++--
 bootstrap  | 21 ++++++++++++++-------
 cfg.mk     |  1 +
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/.gnulib b/.gnulib
index f40e61e..b72ff2a 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f40e61ea0c4940b027aade7dd48948aa93f133a4
+Subproject commit b72ff2a45efde544c406804186d37a3254728571
diff --git a/autogen.sh b/autogen.sh
index d4957f1..42e5608 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -49,6 +49,10 @@ fi
 # we rerun bootstrap to pull in those diffs.
 bootstrap_hash()
 {
+    if test "$no_git"; then
+        echo no-git
+        return
+    fi
     git submodule status | sed 's/^[ +-]//;s/ .*//'
     git hash-object bootstrap.conf
     git ls-tree -d HEAD gnulib/local | awk '{print $3}'
@@ -62,7 +66,9 @@ bootstrap_hash()
 # Only run bootstrap from a git checkout, never from a tarball.
 if test -d .git; then
     curr_status=.git-module-status t=
-    if test -d .gnulib; then
+    if test "$no_git"; then
+        t=no-git
+    elif test -d .gnulib; then
         t=$(bootstrap_hash; git diff .gnulib)
     fi
     case $t:${CLEAN_SUBMODULE+set} in
@@ -78,7 +84,7 @@ if test -d .git; then
         # good, it's up to date, all we need is autoreconf
         autoreconf -if
     else
-        if test ${CLEAN_SUBMODULE+set}; then
+        if test -z "$no_git" && test ${CLEAN_SUBMODULE+set}; then
             echo cleaning up submodules...
             git submodule foreach 'git clean -dfqx && git reset --hard'
         fi
diff --git a/bootstrap b/bootstrap
index 0cbea66..9c52204 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2013-05-08.20; # UTC
+scriptversion=2013-07-03.20; # UTC

 # Bootstrap this package from checked-out sources.

@@ -551,7 +551,7 @@ fi
 echo "$0: Bootstrapping from checked-out $package sources..."

 # See if we can use gnulib's git-merge-changelog merge driver.
-if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
+if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
   if git config merge.merge-changelog.driver >/dev/null ; then
     :
   elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
@@ -574,13 +574,17 @@ git_modules_config () {
   test -f .gitmodules && git config --file .gitmodules "$@"
 }

-gnulib_path=$(git_modules_config submodule.gnulib.path)
-test -z "$gnulib_path" && gnulib_path=gnulib
+if $use_git; then
+  gnulib_path=$(git_modules_config submodule.gnulib.path)
+  test -z "$gnulib_path" && gnulib_path=gnulib
+fi

-# Get gnulib files.
+# Get gnulib files.  Populate $GNULIB_SRCDIR, possibly updating a
+# submodule, for use in the rest of the script.

 case ${GNULIB_SRCDIR--} in
 -)
+  # Note that $use_git is necessarily true in this case.
   if git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
     git submodule init || exit $?
@@ -601,8 +605,8 @@ case ${GNULIB_SRCDIR--} in
   GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
-  # Use GNULIB_SRCDIR as a reference.
-  if test -d "$GNULIB_SRCDIR"/.git && \
+  # Use GNULIB_SRCDIR directly or as a reference.
+  if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
     if git submodule -h|grep -- --reference > /dev/null; then
@@ -628,6 +632,9 @@ case ${GNULIB_SRCDIR--} in
   ;;
 esac

+# $GNULIB_SRCDIR now points to the version of gnulib to use, and
+# we no longer need to use git or $gnulib_path below here.
+
 if $bootstrap_sync; then
   cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
     echo "$0: updating bootstrap and restarting..."
diff --git a/cfg.mk b/cfg.mk
index bbe84b3..147e788 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -828,6 +828,7 @@ ifeq (0,$(MAKELEVEL))
       test -d .git || { echo 0; exit; };				\
       test -f po/Makevars || { echo 1; exit; };				\
       test -f AUTHORS || { echo 1; exit; };				\
+      test "no-git" = "$$(cat $(_curr_status))" && { echo 0; exit; };	\
       actual=$$(git submodule status | $(_submodule_hash);		\
 		git hash-object bootstrap.conf;				\
 		git ls-tree -d HEAD gnulib/local | awk '{print $$3}';	\
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]