Skip to contentSkip to conversation

bootstrap: Reduce GNULIB Size on Newer GIT

PATCH Superseded Andrew Hamilton 2 participants 6 messages Aug 23, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover bootstrap: Reduce GNULIB Size on Newer GIT

Update the bootstrap script to be compatible with newer versions of GIT that changed the git clone -h output from containing:
"--depth"
to:
"--[no-]depth"
Use a regular expression that will support either.
In the future, when GNULIB version is bumped, this bootstrap change can be replaced by the latest GNULIB bootstrap script as it appears GNULIB bootstrap now assumes GIT supports the depth option. This change avoids a full clone on GNULIB, saving something like 50 MB.

Andrew Hamilton (1):
bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

 bootstrap | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 7 lines
2.47.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH 1/1 bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

Update the bootstrap script to be compatible with newer versions of GIT that changed the git clone -h output from containing:
"--depth"
to:
"--[no-]depth"
Use a regular expression that will support either.
In the future, when GNULIB version is bumped, this bootstrap change can be replaced by the latest GNULIB bootstrap script as it appears GNULIB bootstrap now assumes GIT supports the depth option. This change avoids a full clone on GNULIB, saving something like 50 MB.

---
 bootstrap | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bootstrap +2 -2
index dc2238f4a..be8d3582e 100755
@@ -762,11 +762,11 @@ if $use_gnulib; then
 
       shallow=
       if test -z "$GNULIB_REVISION"; then
-        git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        git clone -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null && shallow='--depth 2'
         git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
           || cleanup_gnulib
       else
-        git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        git fetch -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null && shallow='--depth 2'
         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
Signature · 7 lines
2.47.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

Re: [PATCH 1/1] bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

In reply to Collin Funk

Thank you for the input, I considered updating the bootstrap script from GNULIB to latest but decided it may be considered a higher risk change for the upcoming 2.14 release. Maybe I should investigate this further.

Do you happen to know if there is any dependency between the newer bootstrap script and the latest GNULIB version? If not, I can give it a shot to pull in the latest bootstrap script if Daniel thinks that is still within scope for 2.14.

Thanks,
Andrew

Quoted 75 lines · Collin Funk
Quoted 24 lines · Andrew Hamilton

Update the bootstrap script to be compatible with newer versions of GIT that changed the git clone -h output from containing:
"--depth"
to:
"--[no-]depth"
Use a regular expression that will support either.
In the future, when GNULIB version is bumped, this bootstrap change can be replaced by the latest GNULIB bootstrap script as it appears GNULIB bootstrap now assumes GIT supports the depth option. This change avoids a full clone on GNULIB, saving something like 50 MB.

---
 bootstrap | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bootstrap +0 -0
index dc2238f4a..be8d3582e 100755

bootstrap if $use_gnulib; then · line 765

Quoted 4 lines
bootstrap +0 -1
@@ -762,11 +762,11 @@ if $use_gnulib; then
 
       shallow=
       if test -z "$GNULIB_REVISION"; then
-        git clone -h 2>&1 | grep -- --depth > /dev/null &&

shallow='--depth 2'

bootstrap if $use_gnulib; then · line 765

Quoted 1 line
bootstrap +1 -0
+        git clone -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null

&& shallow='--depth 2'

bootstrap if $use_gnulib; then · line 766

Quoted 1 line
bootstrap +0 -0
         git clone $shallow ${GNULIB_URL:-$default_gnulib_url}

"$gnulib_path" \

bootstrap if $use_gnulib; then

Quoted 3 lines
bootstrap +0 -1
           || cleanup_gnulib
       else
-        git fetch -h 2>&1 | grep -- --depth > /dev/null &&

shallow='--depth 2'

bootstrap if $use_gnulib; then · line 769

Quoted 1 line
bootstrap +1 -0
+        git fetch -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null

&& shallow='--depth 2'

bootstrap if $use_gnulib; then · line 771

Quoted 2 lines
bootstrap +0 -0
         mkdir -p "$gnulib_path"
         # Only want a shallow checkout of $GNULIB_REVISION, but git

does not

bootstrap if $use_gnulib; then · line 772

Quoted 1 line
bootstrap +0 -0
         # support cloning by commit hash. So attempt a shallow fetch by

commit

Hi, thank for you the patch. But I think it is better to just update the file from Gnulib. The version used by Grub is old and missing many improvements/fixes:

    $ grep '^scriptversion=' bootstrap
    scriptversion=2022-01-26.05; # UTC

Here is the updated version:

    $ cp $GNULIB_SRCDIR/build-aux/bootstrap .
    $ grep '^scriptversion=' bootstrap
    scriptversion=2025-06-10.02; # UTC

The issue this patch addresses is fixed in Gnulib with this commit:

commit e319c0feea5088fe7774f44919756a54e963d1ac
Author: Bruno Haible <[email protected]>
AuthorDate: Sun Feb 16 13:43:40 2025 +0100
Commit: Bruno Haible <[email protected]>
CommitDate: Sun Feb 16 13:45:35 2025 +0100

bootstrap: Fix recognition of --depth option with recent git
releases.

Reported by Benno Schulenberg <[email protected]> in <
https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00106.html>.

Quoted 7 lines

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Assume that 'git clone' and 'git fetch' support the --depth option.
* build-aux/bootstrap: Regenerated.

Thanks,
Collin

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw

Re: [PATCH 1/1] bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

In reply to Andrew Hamilton
Quoted 27 lines · Andrew Hamilton

Update the bootstrap script to be compatible with newer versions of GIT that changed the git clone -h output from containing:
"--depth"
to:
"--[no-]depth"
Use a regular expression that will support either.
In the future, when GNULIB version is bumped, this bootstrap change can be replaced by the latest GNULIB bootstrap script as it appears GNULIB bootstrap now assumes GIT supports the depth option. This change avoids a full clone on GNULIB, saving something like 50 MB.

---
 bootstrap | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bootstrap +0 -0
index dc2238f4a..be8d3582e 100755
@@ -762,11 +762,11 @@ if $use_gnulib; then
 
       shallow=
       if test -z "$GNULIB_REVISION"; then

bootstrap if $use_gnulib; then · line 772

Quoted 10 lines
bootstrap +2 -2
-        git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        git clone -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null && shallow='--depth 2'
         git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
           || cleanup_gnulib
       else
-        git fetch -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
+        git fetch -h 2>&1 | grep -E -- '--(\[no-\])?depth' > /dev/null && shallow='--depth 2'
         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

Hi, thank for you the patch. But I think it is better to just update the file from Gnulib. The version used by Grub is old and missing many improvements/fixes:

    $ grep '^scriptversion=' bootstrap
    scriptversion=2022-01-26.05; # UTC

Here is the updated version:

    $ cp $GNULIB_SRCDIR/build-aux/bootstrap .
    $ grep '^scriptversion=' bootstrap
    scriptversion=2025-06-10.02; # UTC

The issue this patch addresses is fixed in Gnulib with this commit:

commit e319c0feea5088fe7774f44919756a54e963d1ac
Author: Bruno Haible <[email protected]>
AuthorDate: Sun Feb 16 13:43:40 2025 +0100
Commit: Bruno Haible <[email protected]>
CommitDate: Sun Feb 16 13:45:35 2025 +0100

bootstrap: Fix recognition of --depth option with recent git releases.

Reported by Benno Schulenberg <[email protected]> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00106.html>.

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Assume that 'git clone' and 'git fetch' support the --depth option.
* build-aux/bootstrap: Regenerated.

Thanks,
Collin

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw

Re: [PATCH 1/1] bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

In reply to Andrew Hamilton
Quoted 8 lines · Andrew Hamilton

Thank you for the input, I considered updating the bootstrap script from GNULIB to latest but decided it may be considered a higher risk change for the upcoming 2.14 release. Maybe I should investigate this further.

Do you happen to know if there is any dependency between the newer bootstrap script and the latest GNULIB version? If not, I can give it a shot to pull in the latest bootstrap script if Daniel thinks that is still within scope for 2.14.

I am not active in Grub development, so I will defer anything related to the release process/safe changes to them.

But I am a Gnulib committer, so the questions regarding bootstrap are in my wheelhouse (somewhat :P). The bootstrap script imports files based on a gnulib submodule (see GNU Grep, Coreutils, etc.) or, in Grub's case, GNULIB_REVISION in bootstrap.conf. It doesn't depend on anything else in Gnulib. It simply clones Gnulib, checks-out the correct commit, then runs autoreconf, libtoolize, autopoint, or whatever else the package uses.

Generally GNU packages do not distribute the bootstrap script in tarballs as they should contain all Gnulib source files and the generated configure script. This allows someone to build the package without having autoconf, automake, etc. installed.

That is the long way of explaining that updating bootstrap should not be problematic. :)

Collin

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw

Re: [PATCH 1/1] bootstrap: Ensure shallow GNULIB clone Works on Newer GIT

Ah, thank you for clarifying and the great suggestion.

I'll pull in the latest bootstrap from gnulib and send it out for review hopefully this evening for the Grub maintainer's consideration.

Thank you!
Andrew

Quoted 29 lines · Collin Funk
Quoted 2 lines · Andrew Hamilton

Thank you for the input, I considered updating the bootstrap script from GNULIB to latest but decided it may be considered a higher risk change

for

Quoted 5 lines

the upcoming 2.14 release. Maybe I should investigate this further.

Do you happen to know if there is any dependency between the newer bootstrap script and the latest GNULIB version? If not, I can give it a shot to pull in the latest bootstrap script if Daniel thinks that is

still

Quoted 1 line

within scope for 2.14.

I am not active in Grub development, so I will defer anything related to the release process/safe changes to them.

But I am a Gnulib committer, so the questions regarding bootstrap are in my wheelhouse (somewhat :P). The bootstrap script imports files based on a gnulib submodule (see GNU Grep, Coreutils, etc.) or, in Grub's case, GNULIB_REVISION in bootstrap.conf. It doesn't depend on anything else in Gnulib. It simply clones Gnulib, checks-out the correct commit, then runs autoreconf, libtoolize, autopoint, or whatever else the package uses.

Generally GNU packages do not distribute the bootstrap script in tarballs as they should contain all Gnulib source files and the generated configure script. This allows someone to build the package without having autoconf, automake, etc. installed.

Quoted 5 lines

That is the long way of explaining that updating bootstrap should not be problematic. :)

Collin

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel