bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] bootstrap: Provide a hook for submodule _SRCDIR setup


From: Bruno Haible
Subject: Re: [PATCH] bootstrap: Provide a hook for submodule _SRCDIR setup
Date: Sun, 27 Nov 2022 21:34:26 +0100

Hi Arsen,

Arsen Arsenović wrote:
> * build-aux/bootstrap: Regenerate.

Thanks; I pushed that part in your name.

> The solution proposed here lets Jitter be integrated via:
> 
>   # Set up the Jitter path.
>   bootstrap_srcdirs_hook () {
>     # Pass JITTER_SRCDIR to subprocesses.
>     export JITTER_SRCDIR
>   
>     # We already have something. Don't touch it.
>     test -n "$JITTER_SRCDIR" && return 0
>   
>     case "$me" in
>       *autogen.sh*)
>         # If we're in autogen, we want to simply default to ./jitter, since
>         # that's the common default when just regenerating.
>         : "${JITTER_SRCDIR:=jitter}"
>         ;;
>       *autopull.sh*|*bootstrap*)
>         # However, if also pulling, we want the use_git logic.
>         $use_git || test -n "$JITTER_SRCDIR" \
>           || die "Error: --no-git requires \$JITTER_SRCDIR environment 
> variable or --jitter-srcdir option"
>         $use_git && : "${JITTER_SRCDIR:=jitter}"  # A reasonable default.
>         test -z "$JITTER_SRCDIR" || test -d "$JITTER_SRCDIR" \
>           || die "Error: \$JITTER_SRCDIR environment variable or 
> --jitter-srcdir option is specified, but does not denote a directory"
>         ;;
>     esac
>   }

I don't like the dispatch based on the value of "$me".

Think of autopull.sh and autogen.sh as different programs, that are invoked
one after the other. Think of 'bootstrap' as a common invoker of both, for
backward compatibility.

IMO
>       *autogen.sh*)
>         # If we're in autogen, we want to simply default to ./jitter, since
>         # that's the common default when just regenerating.
>         : "${JITTER_SRCDIR:=jitter}"

this part should go into the bootstrap_post_import_hook, and

>       *autopull.sh*|*bootstrap*)
>         # However, if also pulling, we want the use_git logic.
>         $use_git || test -n "$JITTER_SRCDIR" \
>           || die "Error: --no-git requires \$JITTER_SRCDIR environment 
> variable or --jitter-srcdir option"
>         $use_git && : "${JITTER_SRCDIR:=jitter}"  # A reasonable default.
>         test -z "$JITTER_SRCDIR" || test -d "$JITTER_SRCDIR" \
>           || die "Error: \$JITTER_SRCDIR environment variable or 
> --jitter-srcdir option is specified, but does not denote a directory"

this part should go into the bootstrap_post_pull_hook.

Yes, all 4 of bootstrap_option_hook, bootstrap_print_option_usage_hook,
bootstrap_post_pull_hook, bootstrap_post_import_hook then deal with
JITTER_SRCDIR in one form or the other.

If it works with this reorganization of the code, I would prefer not to add
a bootstrap_srcdirs_hook.

> I'm still not sure how I feel about that default in the autogen.sh case,
> though.  Maybe we should go with some other idiom?  Or maybe I
> overlooked some existing way to properly add Jitter to bootstrap?

For autogen.sh there are two cases:

  a) The user has passed the --jitter-srcdir option to autopull.sh.
     Since you are not storing that value anywhere, you have to
     expect that the user will pass this option also to autogen.sh.

  b) A prior autopull.sh invocation has imported jitter as a submodule.
     The submodule does not necessarily at '.jitter'.
     For this case I would copy the idiom from gnulib/top/gitsub.sh:

        if test -f .gitmodules; then
          submodule_names=`git config --file .gitmodules --get-regexp 
--name-only 'submodule\..*\.url' | sed -e 's/^submodule\.//' -e 's/\.url$//' | 
tr -d '\r' | tr '\n' ' '`
        else
          submodule_names=
        fi

     and extract the relative file name of the jitter module from the
     .gitmodules file.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]