Andrew Hamilton <adham...@gmail.com> writes:

> 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.
>
> Fixes: https://savannah.gnu.org/bugs/?66357
>
> Signed-off-by: Andrew Hamilton <adham...@gmail.com>
> ---
>  bootstrap | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/bootstrap b/bootstrap
> index dc2238f4a..be8d3582e 100755
> --- a/bootstrap
> +++ b/bootstrap
> @@ -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

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 <br...@clisp.org>
    AuthorDate: Sun Feb 16 13:43:40 2025 +0100
    Commit:     Bruno Haible <br...@clisp.org>
    CommitDate: Sun Feb 16 13:45:35 2025 +0100
    
        bootstrap: Fix recognition of --depth option with recent git releases.
        
        Reported by Benno Schulenberg <bensb...@telfort.nl> 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
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to