[PATCH v2 3/3] scripts: Support custom Git URLs in build-many-glibcs.py

Arjun Shankar arjun@redhat.com
Mon Nov 24 16:18:37 GMT 2025


Hi Yury,

Thanks for this. I ran into checkout related network issues quite
recently when running build-many-glibcs.

At a high level, this looks good to me. I haven't reviewed it
properly, but Carlos and I were just discussing this patch series. We
have one suggestion regarding handling the change of origin between
runs. I think we could guard against unexpected change of origin by
adding a check along these lines:

git remote origin is implicitly set at the time of clone and can be
overwritten at the time of "--replace-sources", but otherwise, if
build-many-glibcs encounters an old checkout done from one origin
(canonical or mirror), and a new origin (implied or explicit) is used
during current run, it complains and errors out. Untested and possibly
syntactically incorrect code we wrote up during a call for this:

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 5a02c4bf73..e2fdd5a86a 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -971,8 +971,18 @@ class Context(object):
              subprocess.run(['git', 'remote', 'prune', 'origin'],
                             cwd=self.component_srcdir(component), check=True)
              if self.replace_sources:
+                subprocess.run(['git', 'remote', 'set-url', 'origin', git_url],
+                               cwd=self.component_srcdir(component),
check=True)
                  subprocess.run(['git', 'clean', '-dxfq'],
                                 cwd=self.component_srcdir(component),
check=True)
+            else:
+                r = subprocess.run(['git', 'remote', 'get-url',
'origin', git_url],
+
cwd=self.component_srcdir(component), check=True)
+                if r != git_url:
+                    print('error: origin url has changed from %s to %s, '
+                          'use --replace-sources to check out again' %
+                          (r, git_url))
+                    exit(1)
              subprocess.run(['git', 'pull', '-q'],
                             cwd=self.component_srcdir(component), check=True)
          else:

What do you think?

Cheers!
-- 
Arjun Shankar
he/him/his



More information about the Libc-alpha mailing list