Skip to content

Commit e713876

Browse files
committed
gh-112088: Run autoreconf in GHA check_generated_files
The "Check if generated files are up to date" job of GitHub Actions now runs the "autoreconf -ivf -Werror" command instead of the "make regen-configure" command to avoid depending on the external quay.io server. Add Tools/build/regen-configure.sh script to regenerate the configure with an Ubuntu container image. The "quay.io/tiran/cpython_autoconf:271" container image (https://github.com/tiran/cpython_autoconf) is no longer used.
1 parent d4f83e1 commit e713876

File tree

9 files changed

+130
-160
lines changed

9 files changed

+130
-160
lines changed

.github/workflows/build.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ jobs:
120120

121121
check_generated_files:
122122
name: 'Check if generated files are up to date'
123-
runs-on: ubuntu-latest
123+
# Don't use ubuntu-latest but a specific version to make the job
124+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
125+
runs-on: ubuntu-22.04
124126
timeout-minutes: 60
125127
needs: check_source
126128
if: needs.check_source.outputs.run_tests == 'true'
@@ -143,15 +145,16 @@ jobs:
143145
- name: Check Autoconf and aclocal versions
144146
run: |
145147
grep "Generated by GNU Autoconf 2.71" configure
146-
grep "aclocal 1.16.4" aclocal.m4
148+
grep "aclocal 1.16.5" aclocal.m4
147149
grep -q "runstatedir" configure
148150
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
149151
- name: Configure CPython
150152
run: |
151153
# Build Python with the libpython dynamic library
152154
./configure --config-cache --with-pydebug --enable-shared
153-
- name: Regenerate autoconf files with container image
154-
run: make regen-configure
155+
- name: Regenerate autoconf files
156+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
157+
run: autoreconf -ivf -Werror
155158
- name: Build CPython
156159
run: |
157160
make -j4 regen-all

.github/workflows/posix-deps-apt.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
apt-get update
33

4+
# autoconf-archive is needed by autoreconf (check_generated_files job)
45
apt-get -yq install \
56
build-essential \
67
pkg-config \
8+
autoconf-archive \
79
ccache \
810
gdb \
911
lcov \

Doc/using/configure.rst

+12-5
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,21 @@ files. Commands to regenerate all generated files::
7474
The ``Makefile.pre.in`` file documents generated files, their inputs, and tools used
7575
to regenerate them. Search for ``regen-*`` make targets.
7676

77-
The ``make regen-configure`` command runs `tiran/cpython_autoconf
78-
<https://github.com/tiran/cpython_autoconf>`_ container for reproducible build;
79-
see container ``entry.sh`` script. The container is optional, the following
80-
command can be run locally, the generated files depend on autoconf and aclocal
81-
versions::
77+
configure script
78+
----------------
79+
80+
The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and
81+
the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell
82+
script which uses an Ubuntu container to get the same tools versions and have a
83+
reproducible output.
84+
85+
The container is optional, the following command can be run locally::
8286

8387
autoreconf -ivf -Werror
8488

89+
The generated files can change depending on the exact ``autoconf-archive``,
90+
``aclocal`` and ``pkg-config`` versions.
91+
8592

8693
.. _configure-options:
8794

Makefile.pre.in

+1-7
Original file line numberDiff line numberDiff line change
@@ -2642,15 +2642,9 @@ recheck:
26422642
autoconf:
26432643
(cd $(srcdir); autoreconf -ivf -Werror)
26442644

2645-
# See https://github.com/tiran/cpython_autoconf container
26462645
.PHONY: regen-configure
26472646
regen-configure:
2648-
@if command -v podman >/dev/null; then RUNTIME="podman"; else RUNTIME="docker"; fi; \
2649-
if ! command -v $$RUNTIME; then echo "$@ needs either Podman or Docker container runtime." >&2; exit 1; fi; \
2650-
if command -v selinuxenabled >/dev/null && selinuxenabled; then OPT=":Z"; fi; \
2651-
CMD="$$RUNTIME run --rm --pull=always -v $(abs_srcdir):/src$$OPT quay.io/tiran/cpython_autoconf:271"; \
2652-
echo $$CMD; \
2653-
$$CMD || exit $?
2647+
$(srcdir)/Tools/build/regen-configure.sh
26542648

26552649
# Create a tags file for vi
26562650
tags::
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Add ``Tools/build/regen-configure.sh`` script to regenerate the ``configure``
2+
with an Ubuntu container image. The ``quay.io/tiran/cpython_autoconf:271``
3+
container image (`tiran/cpython_autoconf
4+
-<https://github.com/tiran/cpython_autoconf>`_) is no longer used. Patch by
5+
Victor Stinner.

Tools/build/regen-configure.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -x
4+
5+
# The check_generated_files job of .github/workflows/build.yml must kept in
6+
# sync with this script.
7+
IMAGE="ubuntu:22.04"
8+
DEPENDENCIES="autotools-dev autoconf autoconf-archive pkg-config"
9+
AUTORECONF="autoreconf -ivf -Werror"
10+
11+
WORK_DIR="/src"
12+
SHELL_CMD="apt-get update && apt-get -yq install $DEPENDENCIES && cd $WORK_DIR && $AUTORECONF"
13+
14+
abs_srcdir=$(cd $(dirname $0)/../..; pwd)
15+
16+
if podman --version &>/dev/null; then
17+
RUNTIME="podman"
18+
elif docker --version &>/dev/null; then
19+
RUNTIME="docker"
20+
else
21+
echo "$@ needs either Podman or Docker container runtime." >&2
22+
exit 1
23+
fi
24+
25+
PATH_OPT=""
26+
if command -v selinuxenabled >/dev/null && selinuxenabled; then
27+
PATH_OPT=":Z"
28+
fi
29+
30+
"$RUNTIME" run --rm -v "$abs_srcdir:$WORK_DIR$PATH_OPT" "$IMAGE" /usr/bin/bash -c "$SHELL_CMD"

aclocal.m4

+7-75
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)