From dea245ebbecad161677144a4c1475f06291554b9 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 3 Jul 2013 14:43:11 -0600 Subject: [PATCH] build: honor autogen.sh --no-git 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 (cherry picked from commit 1e503ee534af166d8bbcdd9857fa5946449634b6) --- .gnulib | 2 +- HACKING | 3 ++- autogen.sh | 10 ++++++++-- bootstrap | 21 ++++++++++++++------- cfg.mk | 1 + docs/compiling.html.in | 32 ++++++++++++++++++++++++++++++-- docs/hacking.html.in | 4 +++- 7 files changed, 59 insertions(+), 14 deletions(-) diff --git a/.gnulib b/.gnulib index f40e61ea0c..b72ff2a45e 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit f40e61ea0c4940b027aade7dd48948aa93f133a4 +Subproject commit b72ff2a45efde544c406804186d37a3254728571 diff --git a/HACKING b/HACKING index a310faa067..2b5c9fbe86 100644 --- 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 . When you want to +post your patches: git pull --rebase (fix any conflicts) diff --git a/autogen.sh b/autogen.sh index d4957f1b02..42e56082f3 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 0cbea66e8f..9c522049f0 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 bbe84b3174..147e788a6d 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}'; \ diff --git a/docs/compiling.html.in b/docs/compiling.html.in index 66d2925a5d..aff5487e9a 100644 --- a/docs/compiling.html.in +++ b/docs/compiling.html.in @@ -65,8 +65,36 @@ checkout it is necessary to generate the configure script and Makefile.in templates using the autogen.sh command. By default when the configure 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 & install libvirt to your home + will turn on -Werror for builds. This can be disabled with + --disable-werror, but this is not recommended. +

+

+ Libvirt takes advantage of + the gnulib + project to provide portability to a number of platforms. This + is normally done dynamically via a git submodule in + the .gnulib subdirectory, which is auto-updated as + needed when you do incremental builds. Setting the environment + variable GNULIB_SRCDIR 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. +

+

+ 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:

+
+      $ GNULIB_SRCDIR=/path/to/gnulib ./autogen.sh --no-git
+    
+ +

To build & install libvirt to your home directory the following commands can be run:

diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 904b846e01..78d4df69c5 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -35,7 +35,9 @@ 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. When you want to + post your patches:

   git pull --rebase
   (fix any conflicts)
-- 
GitLab