changeset 12889:551cabe1ed9f

bootstrap: use GNULIB_SRCDIR to reduce disk usage This slightly changes the semantics of GNULIB_SRCDIR; previously, it was a way to change the contents of .gitmodules to actually point to a new location, which meant that running: GNULIB_SRCDIR=~/gnulib ./bootstrap would result in a dirty tree. The new semantics are nicer; the submodule is cloned as normal, but the clone uses the original $GNULIB_SRCDIR as an object reference to reduce download time and disk space. * build-aux/bootstrap (GNULIB_SRCDIR): If set, use as a reference, rather than reconfiguring where the submodule points. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Mon, 22 Feb 2010 08:46:42 -0700
parents 88955fc5764d
children ba919384ee9e
files ChangeLog build-aux/bootstrap
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-02-22  Eric Blake  <eblake@redhat.com>
 
+	bootstrap: use GNULIB_SRCDIR to reduce disk usage
+	* build-aux/bootstrap (GNULIB_SRCDIR): If set, use as a reference,
+	rather than reconfiguring where the submodule points.
+
 	gettimeofday: restore support for platforms that lack function
 	* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Also compile
 	replacement if function is missing.
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -43,7 +43,7 @@
                           sources reside.  Use this if you already
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
-                          them again.
+                          them again.  Defaults to \$GNULIB_SRCDIR.
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
@@ -421,15 +421,11 @@
   GNULIB_SRCDIR=gnulib
   ;;
 *)
-  # Redirect the gnulib submodule to the directory on the command line
-  # if possible.
+  # Use GNULIB_SRCDIR as a reference.  Assumes git 1.6.4 or newer.
   if test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
-    git submodule init
-    GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
-    git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
     echo "$0: getting gnulib files..."
-    git submodule update || exit $?
+    git submodule update --init --reference "$GNULIB_SRCDIR" gnulib || exit $?
     GNULIB_SRCDIR=gnulib
   fi
   ;;