[PATCH v2 2/3] scripts: Support custom FTP mirror URL in build-many-glibcs.py

Carlos O'Donell carlos@redhat.com
Mon Nov 24 17:17:48 GMT 2025


On 11/19/25 7:54 AM, Yury Khrustalev wrote:
> Allow to use custom mirror URLs to download tarballs from a mirror
> of ftp.gnu.org using the FTP_GNU_ORG_MIRROR_URL env variable (the
> default value is 'https://ftp.gnu.org').

This is also fine and has no SSDLC consequences.

If you run with FTP_GNU_ORG_MIRROR_URL set to one value, and update it
to another value the developer is in control with --replace-sources
which will "rm -rf" the whole tree that was unpacked by the tarball.
So --replace-sources works as expected with this env var changing and
the developer requesting a replacement.

> ---
>   scripts/build-many-glibcs.py | 23 +++++++++++++----------
>   1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index bda15d741a..ddc47b243e 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -1019,20 +1019,23 @@ class Context(object):
>           tarball."""
>           if update:
>               return
> -        url_map = {'binutils': 'https://ftp.gnu.org/gnu/binutils/binutils-%(version)s.tar.bz2',
> -                   'gcc': 'https://ftp.gnu.org/gnu/gcc/gcc-%(version)s/gcc-%(version)s.tar.gz',
> -                   'gmp': 'https://ftp.gnu.org/gnu/gmp/gmp-%(version)s.tar.xz',
> -                   'linux': 'https://www.kernel.org/pub/linux/kernel/v%(major)s.x/linux-%(version)s.tar.xz',
> -                   'mpc': 'https://ftp.gnu.org/gnu/mpc/mpc-%(version)s.tar.gz',
> -                   'mpfr': 'https://ftp.gnu.org/gnu/mpfr/mpfr-%(version)s.tar.xz',
> -                   'mig': 'https://ftp.gnu.org/gnu/mig/mig-%(version)s.tar.bz2',
> -                   'gnumach': 'https://ftp.gnu.org/gnu/gnumach/gnumach-%(version)s.tar.bz2',
> -                   'hurd': 'https://ftp.gnu.org/gnu/hurd/hurd-%(version)s.tar.bz2'}
> +        url_map = {
> +            'binutils': '%(baseurl)s/gnu/binutils/binutils-%(version)s.tar.bz2',
> +            'gcc': '%(baseurl)s/gnu/gcc/gcc-%(version)s/gcc-%(version)s.tar.gz',
> +            'gmp': '%(baseurl)s/gnu/gmp/gmp-%(version)s.tar.xz',
> +            'linux': 'https://www.kernel.org/pub/linux/kernel/v%(major)s.x/linux-%(version)s.tar.xz',
> +            'mpc': '%(baseurl)s/gnu/mpc/mpc-%(version)s.tar.gz',
> +            'mpfr': '%(baseurl)s/gnu/mpfr/mpfr-%(version)s.tar.xz',
> +            'mig': '%(baseurl)s/gnu/mig/mig-%(version)s.tar.bz2',
> +            'gnumach': '%(baseurl)s/gnu/gnumach/gnumach-%(version)s.tar.bz2',
> +            'hurd': '%(baseurl)s/gnu/hurd/hurd-%(version)s.tar.bz2',
> +        }
>           if component not in url_map:
>               print('error: component %s coming from tarball' % component)
>               exit(1)
>           version_major = version.split('.')[0]
> -        url = url_map[component] % {'version': version, 'major': version_major}
> +        baseurl = os.environ.get('FTP_GNU_ORG_MIRROR_URL' , 'https://ftp.gnu.org').rstrip('/')

Please explain FTP_GNU_ORG_MIRROR_URL in the comments at the start of the file.

> +        url = url_map[component] % {'version': version, 'major': version_major, 'baseurl': baseurl}
>           filename = os.path.join(self.srcdir, url.split('/')[-1])
>           response = urllib.request.urlopen(url)
>           data = response.read()


-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list