[PATCH] autoregen.py: Regenerate files in GCC gcc/m2/gm2-libs
Simon Marchi
simark@simark.ca
Thu Nov 19 04:19:08 GMT 2026
On 11/18/26 5:25 PM, Pietro Monteiro wrote:
> Autoconf and autoheader generate `gcc/m2/gm2-libs/config-host` and
> `gcc/m2/gm2-libs/gm2-libs-host.h.in`, respectively, from
> `gcc/m2/gm2-libs/config-host.ac`.
>
> Regenerate them is we're in a GCC tree.
is -> if
>
> Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
> ---
> builder/containers/autoregen.py | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/builder/containers/autoregen.py b/builder/containers/autoregen.py
> index a134d2c..0c599b0 100755
> --- a/builder/containers/autoregen.py
> +++ b/builder/containers/autoregen.py
> @@ -72,6 +72,9 @@ def regenerate_with_autoreconf():
> def regenerate_with_autogen():
> run_shell(f"{AUTOGEN_BIN} Makefile.def")
>
> +def regenerate_gm2_libs():
> + run_shell(f"{AUTOCONF_BIN} -f -o config-host config-host.ac")
> + run_shell(f"{AUTOHEADER_BIN} -f config-host.ac")
>
> run_shell(f"{AUTOCONF_BIN} --version")
> run_shell(f"{AUTOMAKE_BIN} --version")
> @@ -82,13 +85,18 @@ print(f"Extra environment: {EXTRA_ENV}", flush=True)
>
> config_folders: list[Path] = []
> autogen_folders: list[Path] = []
> +gm2_libs_folder: Path | None = None
> +gm2_libs_folder_rel: Path = os.path.join(".", "gcc", "m2", "gm2-libs")
>
> -for root, _, files in os.walk("."):
> +for dir, _, files in os.walk("."):
> for file in files:
> if file == "configure.ac":
> - config_folders.append(Path(root).resolve())
> + config_folders.append(Path(dir).resolve())
> if file == "Makefile.tpl":
> - autogen_folders.append(Path(root).resolve())
> + autogen_folders.append(Path(dir).resolve())
> +
> + if dir == gm2_libs_folder_rel:
> + gm2_libs_folder = Path(dir).resolve()
This should check if gcc/m2/gm2-libs/config-host.ac exists, rather than
the directory. Otherwise, if a job runs on an older commit where
config-host.ac does not exist (e.g. on a release branch), it will fail.
It also does not need to be in the loop. You can justadd something
like this at the end:
if Path("gcc/m2/gm2-libs/config-host.ac").is_file():
... regenerate gm2 ...
The loop does not need to change.
It's a bit of a shame to re-introduce some repo-specific knowledge in
this script though ;/.
Simon
More information about the Buildbot
mailing list