Re: [PATCH] contrib: Allow overriding download_prerequisites base URL

Alexander Monakov <[email protected]> Sat, 1 Aug 2026 21:40:19 +0300 (MSK)
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
On Sat, 1 Aug 2026, ц╓ц│ц▌ц┴ц┴ц▄ ц╖ц∙ц⌠ц┘ц≈ wrote:
> 
> Add support for GCC_PREREQUISITES_BASE_URL, so packages can be
> fetched from a local mirror instead of gcc.gnu.org every time.

I think this is a desirable change, thank you.

> contrib/ChangeLog:
> 
> 	* download_prerequisites (base_url): Allow overriding via the
> 	GCC_PREREQUISITES_BASE_URL environment variable.  Document it
> 	in --help output.
> ---
>  contrib/download_prerequisites | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites
> index 2e6693a2aa6..582ff8daa81 100755
> --- a/contrib/download_prerequisites
> +++ b/contrib/download_prerequisites
> @@ -33,7 +33,7 @@ mpc='mpc-1.3.1.tar.gz'
>  isl='isl-0.24.tar.bz2'
>  gettext='gettext-1.0.tar.gz'
>  
> -base_url='https://gcc.gnu.org/pub/gcc/infrastructure/'
> +base_url="${GCC_PREREQUISITES_BASE_URL:-https://gcc.gnu.org/pub/gcc/infrastructure/}"
>  
>  echo_archives() {
>      echo "${gettext}"
> @@ -86,6 +86,11 @@ The following options are available:
>   --only-gettext   inhibit downloading any package but gettext
>   --help           show this text and exit
>   --version        show version information and exit
> +
> +Environment variables:
> +
> + GCC_PREREQUISITES_BASE_URL  override the URL prefix packages are downloaded
> +  from; must include a trailing slash

Good idea with mentioning it in --help. I hadn't realized the script relied on
the variable ending with a slash. I wonder if it wouldn't be nicer to accept it
either with or without the slash (e.g. strip it from the user-provided value if
present, then [re-]add)?

Or, alternatively, remove the slash from the variable and add it at the point
of use, i.e. spell ${base_url}${ar} as ${base_url}/${ar}?

Also, can we pick a slightly more terse wording for the help statement? How
about "URL to download from [${base_url}]"?

Alexander