[PATCH] build-many-glibcs.py: Add --exclude option

H.J. Lu hjl.tools@gmail.com
Mon Dec 23 22:47:08 GMT 2024


m68k-linux-gnu-coldfire-soft GCC and glibc often won't build due to

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103370

which results in build-many-glibcs.py failure.  Add an option, --exclude,
to exclude some targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 scripts/build-many-glibcs.py | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index c53aa8964c..453dc696e0 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -545,7 +545,7 @@ class Context(object):
         """Return the directory in which to install glibc."""
         return os.path.join(self.installdir, 'glibcs', config)
 
-    def run_builds(self, action, configs):
+    def run_builds(self, action, configs, exclude):
         """Run the requested builds."""
         if action == 'checkout':
             self.checkout(configs)
@@ -587,16 +587,16 @@ class Context(object):
                                 'gnumach', 'hurd')
             old_components = ('gmp', 'mpfr', 'mpc')
             old_versions = self.build_state['host-libraries']['build-versions']
-            self.build_compilers(configs)
+            self.build_compilers(configs, exclude)
         else:
             build_components = ('glibc',)
             old_components = ('gmp', 'mpfr', 'mpc', 'binutils', 'gcc', 'linux',
                               'mig', 'gnumach', 'hurd')
             old_versions = self.build_state['compilers']['build-versions']
             if action == 'update-syscalls':
-                self.update_syscalls(configs)
+                self.update_syscalls(configs, exclude)
             else:
-                self.build_glibcs(configs)
+                self.build_glibcs(configs, exclude)
         self.write_files()
         self.do_build()
         if configs:
@@ -767,7 +767,7 @@ class Context(object):
         cmdlist.cleanup_dir()
         cmdlist.pop_subdesc()
 
-    def build_compilers(self, configs):
+    def build_compilers(self, configs, exclude):
         """Build the compilers."""
         if not configs:
             self.remove_dirs(os.path.join(self.builddir, 'compilers'))
@@ -775,9 +775,10 @@ class Context(object):
             self.remove_dirs(os.path.join(self.logsdir, 'compilers'))
             configs = sorted(self.configs.keys())
         for c in configs:
-            self.configs[c].build()
+            if not exclude or c not in exclude:
+                self.configs[c].build()
 
-    def build_glibcs(self, configs):
+    def build_glibcs(self, configs, exclude):
         """Build the glibcs."""
         if not configs:
             self.remove_dirs(os.path.join(self.builddir, 'glibcs'))
@@ -785,16 +786,18 @@ class Context(object):
             self.remove_dirs(os.path.join(self.logsdir, 'glibcs'))
             configs = sorted(self.glibc_configs.keys())
         for c in configs:
-            self.glibc_configs[c].build()
+            if not exclude or c not in exclude:
+                self.glibc_configs[c].build()
 
-    def update_syscalls(self, configs):
+    def update_syscalls(self, configs, exclude):
         """Update the glibc syscall lists."""
         if not configs:
             self.remove_dirs(os.path.join(self.builddir, 'update-syscalls'))
             self.remove_dirs(os.path.join(self.logsdir, 'update-syscalls'))
             configs = sorted(self.glibc_configs.keys())
         for c in configs:
-            self.glibc_configs[c].update_syscalls()
+            if not exclude or c not in exclude:
+                self.glibc_configs[c].update_syscalls()
 
     def load_versions_json(self):
         """Load information about source directory versions."""
@@ -1884,6 +1887,8 @@ def get_parser():
                         help='Build GCC with all languages and libsanitizer')
     parser.add_argument('--shallow', action='store_true',
                         help='Do not download Git history during checkout')
+    parser.add_argument('--exclude', dest='exclude',
+                        help='Targets to be excluded', nargs='*')
     parser.add_argument('topdir',
                         help='Toplevel working directory')
     parser.add_argument('action',
@@ -1980,7 +1985,7 @@ def main(argv):
     ctx = Context(topdir, opts.parallelism, opts.keep, opts.replace_sources,
                   opts.strip, opts.full_gcc, opts.action,
                   shallow=opts.shallow)
-    ctx.run_builds(opts.action, opts.configs)
+    ctx.run_builds(opts.action, opts.configs, opts.exclude)
 
 
 if __name__ == '__main__':
-- 
2.47.1



More information about the Libc-alpha mailing list