[libvirt] [PATCH] maint: support --no-git option during autogen.sh

Eric Blake eblake at redhat.com
Thu Jan 20 20:45:36 UTC 2011


https://bugzilla.redhat.com/show_bug.cgi?id=562743

* .gnulib: Update to latest, for improved bootstrap.
* bootstrap: Resync from gnulib.
* autogen.sh (bootstrap): Add --bootstrap-sync, to make it easier
to keep bootstrap up-to-date.  Pass optional --no-git through.
Reported by Aleksey Avdeev.
---

Sorry for the late response (this was first reported months ago!)

I tested this by installing a bogus git at the front of my PATH that
always fails will let ./autogen.sh --no-git work without git (well,
mostly tested it, to the point where it got past the gnulib-tool
invocation, but on Fedora 14, gettext 0.18 also depends on git, so
autogen.sh didn't complete; I suspect that it would completely work on
cygwin which still has gettext 0.17, but that platform takes a lot
longer to run a test on a patch like this).

* .gnulib 45d39ca...18bf850 (19):
  > bootstrap: support --no-git option
  > update from texinfo
  > update from texinfo
  > init.sh: insert space between each function name and "()"
  > bootstrap: avoid failure when there is no .gitmodules file
  > update from texinfo
  > mountlist: clean up code formatting
  > mountlist: add support for Interix
  > maint.mk: improve the public-submodule-commit rule
  > include_next: Fix bug introduced on 2011-01-18.
  > Allow the user to avoid the GNULIB_TEST_* macros.
  > bootstrap: avoid failure when there is no .gitmodules file
  > assume <ctype.h>, ..., <time.h> exist
  > multiarch: remove AA_APPLE_UNIVERSAL_BUILD
  > c-stack: assume stack overflow if SA_SIGINFO unsupported
  > stdbool-tests: accomodate Haiku
  > binary-io: fix O_TEXT on Haiku
  > include_next: do not check for standard headers like stddef.h
  > ansi-c++-opt: skip C++ dependency style if C++ is unused

 .gnulib    |    2 +-
 autogen.sh |    9 +++++++--
 bootstrap  |   50 +++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/.gnulib b/.gnulib
index 45d39ca..18bf850 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 45d39ca1cae74fcf58ec9911e771bc8baca63f66
+Subproject commit 18bf8501afc50fcf762c3381ffd7af281731d6f7
diff --git a/autogen.sh b/autogen.sh
index 6c2e3bc..323710b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -14,6 +14,11 @@ test -f src/libvirt.c || {


 EXTRA_ARGS=
+no_git=
+if test "x$1" = "x--no-git"; then
+  no_git=" $1"
+  shift
+fi
 if test "x$1" = "x--system"; then
     shift
     EXTRA_ARGS="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
@@ -47,8 +52,8 @@ if test "$t" = "$(cat $curr_status 2>/dev/null)" \
     # good, it's up to date, all we need is autoreconf
     autoreconf -if
 else
-    echo running bootstrap...
-    ./bootstrap && bootstrap_hash > $curr_status \
+    echo running bootstrap$no_git...
+    ./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
       || { echo "Failed to bootstrap, please investigate."; exit 1; }
 fi

diff --git a/bootstrap b/bootstrap
index 12fec20..0d73ffb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-11-12.21; # UTC
+scriptversion=2011-01-20.18; # UTC

 # Bootstrap this package from checked-out sources.

-# Copyright (C) 2003-2010 Free Software Foundation, Inc.
+# Copyright (C) 2003-2011 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -54,10 +54,19 @@ Options:
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
                           them again.  Defaults to \$GNULIB_SRCDIR.
+ --bootstrap-sync         If this bootstrap script is not identical to
+                          the version in the local gnulib sources,
+                          update this script, and then restart it with
+                          /bin/sh or the shell \$CONFIG_SHELL if
+                          defined.
+ --no-bootstrap-sync      Do not check whether bootstrap is out of sync.
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
  --skip-po                Do not download po files.
+ --no-git                 Do not update gnulib using git. Requires that
+                          --gnulib-srcdir points to a complete gnulib source
+                          tree

 If the file $0.conf exists in the same directory as this script, its
 contents are read as shell variables to configure the bootstrap.
@@ -168,6 +177,13 @@ copy=false
 # on which version control system (if any) is used in the source directory.
 vc_ignore=auto

+# Set this to true in bootstrap.conf to enable --bootstrap-sync by
+# default.
+bootstrap_sync=false
+
+# Use git to update gnulib sources
+use_git=true
+
 # find_tool ENVVAR NAMES...
 # -------------------------
 # Search for a required program.  Use the value of ENVVAR, if set,
@@ -239,12 +255,26 @@ do
     checkout_only_file=;;
   --copy)
     copy=true;;
+  --bootstrap-sync)
+    bootstrap_sync=true;;
+  --no-bootstrap-sync)
+    bootstrap_sync=false;;
+  --no-git)
+    use_git=false;;
   *)
     echo >&2 "$0: $option: unknown option"
     exit 1;;
   esac
 done

+# --no-git requires --gnulib-srcdir
+if $use_git || test -d "$GNULIB_SRCDIR"; then
+  :
+else
+  echo "Error: --no-git requires --gnulib-srcdir" >&2
+  exit 1
+fi
+
 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
   echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
   exit 1
@@ -370,6 +400,10 @@ check_versions() {
     if test "$app" = libtool; then
       app=libtoolize
     fi
+    # only test for git if not using --no-git
+    if test "$app" = git; then
+      $use_git || continue
+    fi
     # Honor $APP variables ($TAR, $AUTOCONF, etc.)
     appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
     test "$appvar" = TAR && appvar=AMTAR
@@ -448,7 +482,7 @@ git_modules_config () {
 }

 gnulib_path=`git_modules_config submodule.gnulib.path`
-: ${gnulib_path=gnulib}
+test -z "$gnulib_path" && gnulib_path=gnulib

 # Get gnulib files.

@@ -501,6 +535,16 @@ case ${GNULIB_SRCDIR--} in
   ;;
 esac

+if $bootstrap_sync; then
+  cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
+    echo "$0: updating bootstrap and restarting..."
+    exec sh -c \
+      'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
+      -- "$GNULIB_SRCDIR/build-aux/bootstrap" \
+      "$0" "$@" --no-bootstrap-sync
+  }
+fi
+
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
 <$gnulib_tool || exit

-- 
1.7.3.4




More information about the libvir-list mailing list