Dear gnulib developers,

GNU Octave uses Mercurial as the VCS of its main repository.
Developers are using the bootstrap script of gnulib to automatically clone its 
Git repository in a subdirectory of Octave's source tree. The revision that 
we'd like to use is set in the bootstrap.conf script. Currently, that is

: ${GNULIB_REVISION=d4ec02b3cc70cddaaa5183cc5a45814e0afb2292}


This is working perfectly for a fresh clone of Octave's source tree. However, 
when we update GNULIB_REVISION to a newer revision and a user/developer ran the 
bootstrap script before, running the bootstrap script again fails with an error 
like the following:

./bootstrap: Bootstrapping from checked-out octave sources...
fatal: reference is not a tree: d4ec02b3cc70cddaaa5183cc5a45814e0afb2292
program finished with exit code 128


To work around that, a user/developer could manually fetch from the remote 
repository. That is a bit more tedious when it comes to CI installations that 
usually need no manual interaction.

As a workaround we are applying the attached patch to the bootstrap-funclib.sh 
script to automatically fetch from the remote gnulib repository if the 
GNULIB_REVISION isn't found in the local gnulib Git repository.

Would it be possible to make a similar change in gnulib so that updating to a 
newer gnulib revision becomes a bit easier for that configuration?

Markus
Update bootstrap script from upstream gnulib to automatically fetch from 
repository if needed

diff -r c51b07a71421 bootstrap-funclib.sh
--- a/bootstrap-funclib.sh      Fri Apr 26 13:33:37 2024 -0400
+++ b/bootstrap-funclib.sh      Fri Apr 26 20:00:21 2024 +0200
@@ -532,6 +532,10 @@
         # The subdirectory 'gnulib' already exists.
         if test -n "$GNULIB_REVISION"; then
           if test -d "$gnulib_path/.git"; then
+            if ! git --git-dir="$gnulib_path"/.git cat-file \
+                 commit "$GNULIB_REVISION"; then
+              git --git-dir="$gnulib_path"/.git fetch
+            fi
             (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") || exit 1
           else
             die "Error: GNULIB_REVISION is specified in bootstrap.conf," \

Reply via email to