]> Savannah Git Hosting - gnulib.git/commitdiff
bootstrap: go back to old non-submodule semantics
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2024 21:00:10 +0000 (13:00 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2024 21:33:34 +0000 (13:33 -0800)
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR):
When cloning GNULIB_REFDIR and no submodule 'gnulib' is configured,
set the origin’s URL to $gnulib_url and fetch from remote,
so that GNULIB_REFDIR is merely an accelerant rather than
having different semantics.
* build-aux/bootstrap: Regenerate.

ChangeLog
build-aux/bootstrap
top/bootstrap-funclib.sh

index c4a9230a955cbadb6b281f08e90af0fea57b3218..213714cc52fa83daab90c00abe685ef57abc1230 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-11-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       bootstrap: go back to old non-submodule semantics
+       * top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR):
+       When cloning GNULIB_REFDIR and no submodule 'gnulib' is configured,
+       set the origin’s URL to $gnulib_url and fetch from remote,
+       so that GNULIB_REFDIR is merely an accelerant rather than
+       having different semantics.
+       * build-aux/bootstrap: Regenerate.
+
 2024-11-12  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Fix comment.
index ca7cd84386ee57461b4f5fca20e8399b6359d8dc..2e56c624d22963def8fac5990274475bd7034f77 100755 (executable)
@@ -37,7 +37,7 @@ medir=`dirname "$me"`
 
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-11-12.17; # UTC
+scriptlibversion=2024-11-12.20; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -545,45 +545,49 @@ prepare_GNULIB_SRCDIR ()
       if test ! -d "$gnulib_path"; then
         # The subdirectory 'gnulib' does not yet exist. Clone into it.
         echo "$0: getting gnulib files..."
+        trap cleanup_gnulib HUP INT PIPE TERM
+        gnulib_url=${GNULIB_URL:-$default_gnulib_url}
+        shallow=
         if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then
           # Use GNULIB_REFDIR as a reference.
-          git clone "$GNULIB_REFDIR" "$gnulib_path" || cleanup_gnulib
+          git clone "$GNULIB_REFDIR" "$gnulib_path" \
+          && git -C "$gnulib_path" remote set-url origin "$gnulib_url" \
+          && if test -z "$GNULIB_REVISION"; then
+               git -C "$gnulib_path" pull origin
+             else
+               git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
+               || { git -C "$gnulib_path" fetch origin \
+                    && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; }
+             fi || cleanup_gnulib
+        elif test -z "$GNULIB_REVISION"; then
+          if git clone -h 2>&1 | grep -- --depth > /dev/null; then
+            shallow='--depth 2'
+          fi
+          git clone $shallow "$gnulib_url" "$gnulib_path" \
+            || cleanup_gnulib
         else
-          # GNULIB_REFDIR is not set or not usable. Ignore it.
-          trap cleanup_gnulib HUP INT PIPE TERM
-          gnulib_url=${GNULIB_URL:-$default_gnulib_url}
-          shallow=
-          if test -z "$GNULIB_REVISION"; then
-            if git clone -h 2>&1 | grep -- --depth > /dev/null; then
-              shallow='--depth 2'
-            fi
-            git clone $shallow "$gnulib_url" "$gnulib_path" \
-              || cleanup_gnulib
-          else
-            if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
-              shallow='--depth 2'
-            fi
-            mkdir -p "$gnulib_path"
-            # Only want a shallow checkout of $GNULIB_REVISION,
-            # but git does not support cloning by commit hash.
-            # So attempt a shallow fetch by commit hash to minimize
-            # the amount of data downloaded and changes needed to be
-            # processed, which can drastically reduce download and
-            # processing time for checkout. If the fetch by commit fails,
-            # a shallow fetch can not be performed because we do not
-            # know what the depth of the commit is without fetching
-            # all commits. So fall back to fetching all commits.
-            git -C "$gnulib_path" init
-            git -C "$gnulib_path" remote add origin "$gnulib_url"
-            git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
-              || git -C "$gnulib_path" fetch origin \
-              || cleanup_gnulib
-            git -C "$gnulib_path" reset --hard FETCH_HEAD
-            (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
-              || cleanup_gnulib
+          if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
+            shallow='--depth 2'
           fi
-          trap - HUP INT PIPE TERM
+          mkdir -p "$gnulib_path"
+          # Only want a shallow checkout of $GNULIB_REVISION, but git does not
+          # support cloning by commit hash. So attempt a shallow fetch by commit
+          # hash to minimize the amount of data downloaded and changes needed to
+          # be processed, which can drastically reduce download and processing
+          # time for checkout. If the fetch by commit fails, a shallow fetch can
+          # not be performed because we do not know what the depth of the commit
+          # is without fetching all commits. So fall back to fetching all
+          # commits.
+          git -C "$gnulib_path" init
+          git -C "$gnulib_path" remote add origin "$gnulib_url"
+          git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
+            || git -C "$gnulib_path" fetch origin \
+            || cleanup_gnulib
+          git -C "$gnulib_path" reset --hard FETCH_HEAD
+          (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
+            || cleanup_gnulib
         fi
+        trap - HUP INT PIPE TERM
       else
         # The subdirectory 'gnulib' already exists.
         if test -n "$GNULIB_REVISION"; then
@@ -728,7 +732,8 @@ Gnulib sources can be fetched in various ways:
 
  * Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
    are cloned into that directory using git from \$GNULIB_URL, defaulting
-   to $default_gnulib_url.
+   to $default_gnulib_url; if GNULIB_REFDIR is set and is a git repository
+   its contents may be used to accelerate the process.
    If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
    then that revision is checked out.
 
index 0d8b5a259de01db4bceddae4251e69dad6fed903..fb2039876febc1ac1712cef22b0812349e46a3aa 100644 (file)
@@ -1,6 +1,6 @@
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-11-12.17; # UTC
+scriptlibversion=2024-11-12.20; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -508,45 +508,49 @@ prepare_GNULIB_SRCDIR ()
       if test ! -d "$gnulib_path"; then
         # The subdirectory 'gnulib' does not yet exist. Clone into it.
         echo "$0: getting gnulib files..."
+        trap cleanup_gnulib HUP INT PIPE TERM
+        gnulib_url=${GNULIB_URL:-$default_gnulib_url}
+        shallow=
         if test -n "$GNULIB_REFDIR" && test -d "$GNULIB_REFDIR"/.git; then
           # Use GNULIB_REFDIR as a reference.
-          git clone "$GNULIB_REFDIR" "$gnulib_path" || cleanup_gnulib
+          git clone "$GNULIB_REFDIR" "$gnulib_path" \
+          && git -C "$gnulib_path" remote set-url origin "$gnulib_url" \
+          && if test -z "$GNULIB_REVISION"; then
+               git -C "$gnulib_path" pull origin
+             else
+               git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
+               || { git -C "$gnulib_path" fetch origin \
+                    && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; }
+             fi || cleanup_gnulib
+        elif test -z "$GNULIB_REVISION"; then
+          if git clone -h 2>&1 | grep -- --depth > /dev/null; then
+            shallow='--depth 2'
+          fi
+          git clone $shallow "$gnulib_url" "$gnulib_path" \
+            || cleanup_gnulib
         else
-          # GNULIB_REFDIR is not set or not usable. Ignore it.
-          trap cleanup_gnulib HUP INT PIPE TERM
-          gnulib_url=${GNULIB_URL:-$default_gnulib_url}
-          shallow=
-          if test -z "$GNULIB_REVISION"; then
-            if git clone -h 2>&1 | grep -- --depth > /dev/null; then
-              shallow='--depth 2'
-            fi
-            git clone $shallow "$gnulib_url" "$gnulib_path" \
-              || cleanup_gnulib
-          else
-            if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
-              shallow='--depth 2'
-            fi
-            mkdir -p "$gnulib_path"
-            # Only want a shallow checkout of $GNULIB_REVISION,
-            # but git does not support cloning by commit hash.
-            # So attempt a shallow fetch by commit hash to minimize
-            # the amount of data downloaded and changes needed to be
-            # processed, which can drastically reduce download and
-            # processing time for checkout. If the fetch by commit fails,
-            # a shallow fetch can not be performed because we do not
-            # know what the depth of the commit is without fetching
-            # all commits. So fall back to fetching all commits.
-            git -C "$gnulib_path" init
-            git -C "$gnulib_path" remote add origin "$gnulib_url"
-            git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
-              || git -C "$gnulib_path" fetch origin \
-              || cleanup_gnulib
-            git -C "$gnulib_path" reset --hard FETCH_HEAD
-            (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
-              || cleanup_gnulib
+          if git fetch -h 2>&1 | grep -- --depth > /dev/null; then
+            shallow='--depth 2'
           fi
-          trap - HUP INT PIPE TERM
+          mkdir -p "$gnulib_path"
+          # Only want a shallow checkout of $GNULIB_REVISION, but git does not
+          # support cloning by commit hash. So attempt a shallow fetch by commit
+          # hash to minimize the amount of data downloaded and changes needed to
+          # be processed, which can drastically reduce download and processing
+          # time for checkout. If the fetch by commit fails, a shallow fetch can
+          # not be performed because we do not know what the depth of the commit
+          # is without fetching all commits. So fall back to fetching all
+          # commits.
+          git -C "$gnulib_path" init
+          git -C "$gnulib_path" remote add origin "$gnulib_url"
+          git -C "$gnulib_path" fetch $shallow origin "$GNULIB_REVISION" \
+            || git -C "$gnulib_path" fetch origin \
+            || cleanup_gnulib
+          git -C "$gnulib_path" reset --hard FETCH_HEAD
+          (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
+            || cleanup_gnulib
         fi
+        trap - HUP INT PIPE TERM
       else
         # The subdirectory 'gnulib' already exists.
         if test -n "$GNULIB_REVISION"; then
@@ -691,7 +695,8 @@ Gnulib sources can be fetched in various ways:
 
  * Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
    are cloned into that directory using git from \$GNULIB_URL, defaulting
-   to $default_gnulib_url.
+   to $default_gnulib_url; if GNULIB_REFDIR is set and is a git repository
+   its contents may be used to accelerate the process.
    If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
    then that revision is checked out.