public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] ci: Check for necessary programs when running build-many-glibcs.py
@ 2021-11-08 20:19 Lukasz Majewski
  0 siblings, 0 replies; only message in thread
From: Lukasz Majewski @ 2021-11-08 20:19 UTC (permalink / raw)
  To: Joseph Myers
  Cc: Adhemerval Zanella, Florian Weimer, Carlos O'Donell,
	Andreas Schwab, libc-alpha, Lukasz Majewski

The build-many-glibc.py can be run on a 'vanila' Debian distribution
(as for example in docker container), which don't have by default
installed some packages (like flex).

This causes build break at late stage of the full build;
../src/scripts/build-many-glibcs.py . checkout --replace-sources &&
../src/scripts/build-many-glibcs.py . host-libraries &&
../src/scripts/build-many-glibcs.py . compilers &&
../src/scripts/build-many-glibcs.py . glibcs

To avoid such situation, this check has been added to inform user
early of required (and missing) essential programs.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---
Changes for v2:
- Use the shutil.which() to determine if the program is installed.
  The shutil is part of standard Python library (no extra dependencies
  introduced).
---
 scripts/build-many-glibcs.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 6046048b75..b76b4e2ff2 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1852,9 +1852,20 @@ def get_parser():
                         nargs='*')
     return parser
 
+def check_required_programs():
+    # List programs required to run this glibc CI script.
+    required_sw = ['flex', 'bison', 'git', 'makeinfo', 'patch', 'tar']
+    for prog in required_sw:
+        if not shutil.which(prog):
+            print(f"error: Required program: '{prog}' NOT installed!")
+            return False
+
+    return True
 
 def main(argv):
     """The main entry point."""
+    if not check_required_programs():
+        sys.exit(0)
     parser = get_parser()
     opts = parser.parse_args(argv)
     topdir = os.path.abspath(opts.topdir)
-- 
2.20.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-08 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 20:19 [PATCH v2] ci: Check for necessary programs when running build-many-glibcs.py Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).