]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: honor autogen.sh --no-git
authorEric Blake <eblake@redhat.com>
Wed, 3 Jul 2013 20:43:11 +0000 (14:43 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 9 Jul 2013 22:15:29 +0000 (16:15 -0600)
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.
* docs/compiling.html.in: Document this setup.
* docs/hacking.html.in: Mention this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
.gnulib
HACKING
autogen.sh
bootstrap
cfg.mk
docs/compiling.html.in
docs/hacking.html.in

diff --git a/.gnulib b/.gnulib
index f40e61ea0c4940b027aade7dd48948aa93f133a4..b72ff2a45efde544c406804186d37a3254728571 160000 (submodule)
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f40e61ea0c4940b027aade7dd48948aa93f133a4
+Subproject commit b72ff2a45efde544c406804186d37a3254728571
diff --git a/HACKING b/HACKING
index 271ff6cff5d4d57f7bfbd96edf8a983761438173..7db7d3b8fca0fd1aaff302cfb5989fe9f5d484d7 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -36,7 +36,8 @@ developer is:
   git checkout -t origin -b workbranch
   Hack, committing any changes along the way
 
-Then, when you want to post your patches:
+More hints on compiling can be found here <compiling.html>. When you want to
+post your patches:
 
   git pull --rebase
   (fix any conflicts)
index d4957f1b029b8732c7ee9eb025247b97ade3bc6f..42e56082f302029060df174dc79a8511ef962556 100755 (executable)
@@ -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
index 0cbea66e8f2f5340a7305448b82286c2fa6bbd11..9c522049f01f48fffb62593917f9ce7b486e342f 100755 (executable)
--- 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 bbe84b3174145fc6f233d59315f7a9eb15857847..147e788a6d46f30cdda6d89cebd76c13a51abfc4 100644 (file)
--- 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}';   \
index 66d2925a5d3f8b98c1718972b1170c681d86cd39..aff5487e9a0cc46004dfa0166247173532820f66 100644 (file)
       checkout it is necessary to generate the configure script and Makefile.in
       templates using the <code>autogen.sh</code> command. By default when
       the <code>configure</code> script is run from within a GIT checkout, it
-      will turn on -Werror for builds. This can be disabled with --disable-werror,
-      but this is not recommended. To build &amp; install libvirt to your home
+      will turn on -Werror for builds. This can be disabled with
+      --disable-werror, but this is not recommended.
+    </p>
+    <p>
+      Libvirt takes advantage of
+      the <a href="http://www.gnu.org/software/gnulib/">gnulib</a>
+      project to provide portability to a number of platforms.  This
+      is normally done dynamically via a git submodule in
+      the <code>.gnulib</code> subdirectory, which is auto-updated as
+      needed when you do incremental builds.  Setting the environment
+      variable <code>GNULIB_SRCDIR</code> to a local directory
+      containing a git checkout of gnulib will let you reduce local
+      disk space requirements and network download time, regardless of
+      which actual commit you have in that reference directory.
+    </p>
+    <p>
+      However, if you are developing on a platform where git is not
+      available, or are behind a firewall that does not allow for git
+      to easily obtain the gnulib submodule, it is possible to instead
+      use a static mode of operation where you are then responsible
+      for updating the git submodule yourself.  In this mode, you must
+      track the exact gnulib commit needed by libvirt (usually not the
+      latest gnulib.git) via alternative means, such as a shared NFS
+      drive or manual download, and run this any time libvirt.git
+      updates the commit stored in the .gnulib submodule:</p>
+    <pre>
+      $ GNULIB_SRCDIR=/path/to/gnulib ./autogen.sh --no-git
+    </pre>
+
+    <p>To build &amp; install libvirt to your home
       directory the following commands can be run:
     </p>
 
index 41c8d481a6a7bdd2af062a44c7a17387b3582895..ba51e233c8ff65e30a1ef764d295155330b82071 100644 (file)
@@ -35,7 +35,9 @@
   git checkout -t origin -b workbranch
   Hack, committing any changes along the way
 </pre>
-        <p>Then, when you want to post your patches:</p>
+        <p>More hints on compiling can be
+        found <a href="compiling.html">here</a>.  When you want to
+        post your patches:</p>
 <pre>
   git pull --rebase
   (fix any conflicts)