public inbox for buildbot@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] autoregen.py: adapt to Gentoo
@ 2024-03-02  6:02 Sam James
  2024-03-02  6:02 ` [PATCH v2 2/2] autoregen.py: style tweaks Sam James
  2024-03-03 17:53 ` [PATCH v2 1/2] autoregen.py: adapt to Gentoo Mark Wielaard
  0 siblings, 2 replies; 3+ messages in thread
From: Sam James @ 2024-03-02  6:02 UTC (permalink / raw)
  To: buildbot; +Cc: arsen, Sam James

In Gentoo, we have autoconf-vanilla and automake-vanilla packaged for toolchain
development with no patches applied. The binaries are named differently.

Adapt the script to check a list of binaries for each tool, and check the
vanilla names first as we want to prefer those if they exist.

This makes the script work out-of-the-box on Gentoo.

Signed-off-by: Sam James <sam@gentoo.org>
---
mjw, could you double check this does the right thing for you on your systems?

It should be OK as I've checked with a few combinations.

v2:
- Set WANT_{AUTOCONF,AUTOMAKE} environment variables for Gentoo's wrappers.
- Add some style tweaks in patch 2.

 builder/containers/autoregen.py | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/builder/containers/autoregen.py b/builder/containers/autoregen.py
index bfb8f3d..f33fb78 100755
--- a/builder/containers/autoregen.py
+++ b/builder/containers/autoregen.py
@@ -1,15 +1,32 @@
 #!/usr/bin/env python3
 
 import os
+import shutil
 import subprocess
 from pathlib import Path
 
-AUTOCONF_BIN = 'autoconf-2.69'
-AUTOMAKE_BIN = 'automake-1.15.1'
-ACLOCAL_BIN = 'aclocal-1.15.1'
-AUTOHEADER_BIN = 'autoheader-2.69'
+# On Gentoo, vanilla unpatched autotools are packaged separately.
+# We place the vanilla names first as we want to prefer those if both exist.
+autoconf_names = ['autoconf-vanilla-2.69', 'autoconf-2.69']
+automake_names = ['automake-vanilla-1.15', 'automake-1.15.1']
+aclocal_names = ['aclocal-vanilla-1.15', 'aclocal-1.15.1']
+autoheader_names = ['autoheader-vanilla-2.69', 'autoheader-2.69']
+
+# Pick the first for each list that exists on this system.
+AUTOCONF_BIN = next(name for name in autoconf_names if shutil.which(name))
+AUTOMAKE_BIN = next(name for name in automake_names if shutil.which(name))
+ACLOCAL_BIN = next(name for name in aclocal_names if shutil.which(name))
+AUTOHEADER_BIN = next(name for name in autoheader_names if shutil.which(name))
+
+# autoconf-wrapper and automake-wrapper from Gentoo look at this environment variable.
+# It's harmless to set it on other systems though.
+ENV = f'WANT_AUTOCONF={AUTOCONF_BIN.split("-", 1)[1]} '
+ENV += f'WANT_AUTOMAKE={AUTOMAKE_BIN.split("-", 1)[1]} '
+
+ENV += f' AUTOCONF={AUTOCONF_BIN} '
+ENV += f' ACLOCAL={ACLOCAL_BIN} '
+ENV += f' AUTOMAKE={AUTOMAKE_BIN}'
 
-ENV = f'AUTOCONF={AUTOCONF_BIN} ACLOCAL={ACLOCAL_BIN} AUTOMAKE={AUTOMAKE_BIN}'
 
 config_folders = []
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-03 17:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02  6:02 [PATCH v2 1/2] autoregen.py: adapt to Gentoo Sam James
2024-03-02  6:02 ` [PATCH v2 2/2] autoregen.py: style tweaks Sam James
2024-03-03 17:53 ` [PATCH v2 1/2] autoregen.py: adapt to Gentoo Mark Wielaard

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).