public inbox for buildbot@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: buildbot@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] Add gcc autotools checker
Date: Sun, 12 Nov 2023 13:10:51 +0100	[thread overview]
Message-ID: <20231112121051.1490556-1-mark@klomp.org> (raw)

This introduces the autoregen.py by Martin Liska as posted by
Martin Jambor. A new Containerfile autotools is added that has
builds for autoconf 2.69 and automake 1.15.1 and the new autoregen.py
script. This new Containerfile is then used to check that
regenerating the auto* files doesn't introduce any diffs.
---
 builder/containers/Containerfile-autotools | 50 ++++++++++++++++++++++
 builder/containers/autoregen.py            | 33 ++++++++++++++
 builder/master.cfg                         | 26 +++++++++++
 3 files changed, 109 insertions(+)
 create mode 100644 builder/containers/Containerfile-autotools
 create mode 100755 builder/containers/autoregen.py

diff --git a/builder/containers/Containerfile-autotools b/builder/containers/Containerfile-autotools
new file mode 100644
index 0000000..ed40f6b
--- /dev/null
+++ b/builder/containers/Containerfile-autotools
@@ -0,0 +1,50 @@
+# Container file for setting up autotools versions as used by gcc
+
+# Setup the (minimal) image, upgrade and install all devel packages
+FROM debian:stable
+RUN apt-get update && \
+    apt-get upgrade -y && \
+    apt-get install -y \
+      build-essential libtool ccache perl python3 bash \
+      patch util-linux diffutils cpio procps \
+      coreutils make git \
+      gettext bison flex \
+      gawk m4 pkg-config \
+      bzip2 xz-utils gzip zstd \
+      findutils file tar wget \
+      buildbot-worker && \
+    apt-get clean
+
+# Get, build and install autoconf 2.69 and automake 1.15.1
+RUN wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz && \
+    wget https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz && \
+    tar zxf autoconf-2.69.tar.gz && \
+    tar zxf automake-1.15.1.tar.gz && \
+    cd autoconf-2.69 && \
+    ./configure --program-suffix=-2.69 && \
+    make && make install && cd .. && \
+    cd automake-1.15.1 && \
+    ./configure --program-suffix=-1.15.1 \
+    && make && make install && cd ..
+
+# Get and install the autoregen.py script
+RUN wget -O /usr/local/bin/autoregen.py \
+ 'https://sourceware.org/cgit/builder/plain/builder/containers/autoregen.py' \
+ && chmod 755 /usr/local/bin/autoregen.py
+
+# Setup user with same id as host user id.
+RUN adduser --home /home/builder --uid 1001 builder
+
+# Set image specific environment variables used by bb-start.sh
+ENV IMAGE_NAME=autotools
+ENV CCACHE_LIBDIR=/usr/lib/ccache
+
+# Put bb-start.sh script in homedir and make it executable
+RUN wget -O /home/builder/bb-start.sh \
+ 'https://sourceware.org/cgit/builder/plain/builder/containers/bb-start.sh' \
+ && chmod 755 /home/builder/bb-start.sh
+
+# And now run the script
+USER builder
+WORKDIR /home/builder
+ENTRYPOINT /home/builder/bb-start.sh
diff --git a/builder/containers/autoregen.py b/builder/containers/autoregen.py
new file mode 100755
index 0000000..4ebf445
--- /dev/null
+++ b/builder/containers/autoregen.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import os
+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'
+
+ENV = f'AUTOCONF={AUTOCONF_BIN} ACLOCAL={ACLOCAL_BIN} AUTOMAKE={AUTOMAKE_BIN}'
+
+config_folders = []
+
+for root, _, files in os.walk('.'):
+    for file in files:
+        if file == 'configure':
+            config_folders.append(Path(root).resolve())
+
+for folder in sorted(config_folders):
+    print(folder, flush=True)
+    os.chdir(folder)
+    configure_lines = open('configure.ac').read().splitlines()
+    if any(True for line in configure_lines if line.startswith('AC_CONFIG_HEADERS')):
+        subprocess.check_output(f'{ENV} {AUTOHEADER_BIN} -f', shell=True, encoding='utf8')
+    # apparently automake is somehow unstable -> skip it for gotools
+    if (any(True for line in configure_lines if line.startswith('AM_INIT_AUTOMAKE'))
+            and not str(folder).endswith('gotools')):
+        subprocess.check_output(f'{ENV} {AUTOMAKE_BIN} -f',
+                                shell=True, encoding='utf8')
+    subprocess.check_output(f'{ENV} {AUTOCONF_BIN} -f', shell=True, encoding='utf8')
+
diff --git a/builder/master.cfg b/builder/master.cfg
index 32a3653..d92fcfe 100644
--- a/builder/master.cfg
+++ b/builder/master.cfg
@@ -942,6 +942,7 @@ gcc_build_scheduler = schedulers.SingleBranchScheduler(
         reason="gcc project master branch update",
         builderNames=["gcc-fedora-x86_64",
                       "gcc-fedora-mingw",
+                      "gcc-autoregen",
                       "gcc-debian-arm64",
                       "gcc-gentoo-sparc",
                       "gcc-rawhide-x86_64",
@@ -3383,6 +3384,16 @@ gcc_build_make_clean_step = steps.ShellCommand(
         command=["make", "clean"],
         name="make clean")
 
+gcc_autoregen_step = steps.ShellCommand(
+        command="autoregen.py",
+        name="autoregen.py",
+        haltOnFailure=True)
+
+gcc_git_diff_step = steps.ShellCommand(
+        command=['git', 'diff', '--exit-code'],
+        name="git diff",
+        haltOnFailure=True)
+
 gcc_factory = util.BuildFactory()
 gcc_factory.addStep(gcc_git_step)
 gcc_factory.addStep(steps.Configure(
@@ -3428,6 +3439,21 @@ gcc_build_factory.addStep(steps.Compile(
         haltOnFailure=True))
 gcc_build_factory.addStep(gcc_rm_build_step)
 
+gcc_autoregen_factory = util.BuildFactory()
+gcc_autoregen_factory.addStep(gcc_git_step)
+gcc_autoregen_factory.addStep(gcc_autoregen_step)
+gcc_autoregen_factory.addStep(gcc_git_diff_step)
+
+gcc_autoregen_builder = util.BuilderConfig(
+        name="gcc-autoregen",
+        collapseRequests=True,
+        properties={'container-file':
+                    readContainerFile('autotools')},
+        workernames=vm_workers,
+        tags=["gcc-autotools", "debian"],
+        factory=gcc_autoregen_factory)
+c['builders'].append(gcc_autoregen_builder)
+
 gcc_mingw_factory = util.BuildFactory()
 gcc_mingw_factory.addStep(gcc_build_git_step)
 gcc_mingw_factory.addStep(gcc_rm_build_step)
-- 
2.39.3


                 reply	other threads:[~2023-11-12 12:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231112121051.1490556-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=buildbot@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).