8000 [3.12] gh-112088: Run autoreconf in GHA check_generated_files (GH-112… · python/cpython@a498433 · GitHub
[go: up one dir, main page]

Skip to content

Commit a498433

Browse files
authored
[3.12] gh-112088: Run autoreconf in GHA check_generated_files (GH-112090) (#112159)
gh-112088: Run autoreconf in GHA check_generated_files (#112090) 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. (cherry picked from commit d9fd33a)
1 parent 2e17a81 commit a498433

File tree

9 files changed

+139
-168
lines changed

9 files changed

+139
-168
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ jobs:
147147

148148
check_generated_files:
149149
name: 'Check if generated files are up to date'
150-
runs-on: ubuntu-latest
150+
# Don't use ubuntu-latest but a specific version to make the job
151+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
152+
runs-on: ubuntu-22.04
151153
timeout-minutes: 60
152154
needs: check_source
153155
if: needs.check_source.outputs.run_tests == 'true'
@@ -170,15 +172,16 @@ jobs:
170172
- name: Check Autoconf and aclocal versions
171173
run: |
172174
grep "Generated by GNU Autoconf 2.71" configure
173-
grep "aclocal 1.16.4" aclocal.m4
175+
grep "aclocal 1.16.5" aclocal.m4
174176
grep -q "runstatedir" configure
175177
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
176178
- name: Configure CPython
177179
run: |
178180
# Build Python with the libpython dynamic library
179181
./configure --config-cache --with-pydebug --enable-shared
180-
- name: Regenerate autoconf files with container image
181-
run: make regen-configure
182+
- name: Regenerate autoconf files
183+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
184+
run: autoreconf -ivf -Werror
182185
- name: Build CPython
183186
run: |
184187
# Deepfreeze will usually cause global objects to be added or removed,

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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,21 @@ files. Commands to regenerate all generated files::
5757
The ``Makefile.pre.in`` file documents generated files, their inputs, and tools used
5858
to regenerate them. Search for ``regen-*`` make targets.
5959

60-
The ``make regen-configure`` command runs `tiran/cpython_autoconf
61-
<https://github.com/tiran/cpython_autoconf>`_ container for reproducible build;
62-
see container ``entry.sh`` script. The container is optional, the following
63-
command can be run locally, the generated files depend on autoconf and aclocal
64-
versions::
60+
configure script
61+
----------------
62+
63+
The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and
64+
the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell
65+
script which uses an Ubuntu container to get the same tools versions and have a
66+
reproducible output.
67+
68+
The container is optional, the following command can be run locally::
6569

6670
autoreconf -ivf -Werror
6771

72+
The generated files can change depending on the exact ``autoconf-archive``,
73+
``aclocal`` and ``pkg-config`` versions.
74+
6875

6976
.. _configure-options:
7077

Makefile.pre.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,15 +2594,9 @@ recheck:
25942594
autoconf:
25952595
(cd $(srcdir); autoreconf -ivf -Werror)
25962596

2597-
# See https://github.com/tiran/cpython_autoconf container
25982597
.PHONY: regen-configure
25992598
regen-configure:
2600-
@if command -v podman >/dev/null; then RUNTIME="podman"; else RUNTIME="docker"; fi; \
2601-
if ! command -v $$RUNTIME; then echo "$@ needs either Podman or Docker container runtime." >&2; exit 1; fi; \
2602-
if command -v selinuxenabled >/dev/null && selinuxenabled; then OPT=":Z"; fi; \
2603-
CMD="$$RUNTIME run --rm --pull=always -v $(abs_srcdir):/src$$OPT quay.io/tiran/cpython_autoconf:271"; \
2604-
echo $$CMD; \
2605-
$$CMD || exit $?
2599+
$(srcdir)/Tools/build/regen-configure.sh
26062600

26072601
# Create a tags file for vi
26082602
tags::
Lines changed: 5 additions & 0 deletions
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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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. Use the same container image than the job so the job
7+
# doesn't need to run autoreconf in a container.
8+
IMAGE="ubuntu:22.04"
9+
DEPENDENCIES="autotools-dev autoconf autoconf-archive pkg-config"
10+
AUTORECONF="autoreconf -ivf -Werror"
11+
12+
WORK_DIR="/src"
13+
SHELL_CMD="apt-get update && apt-get -yq install $DEPENDENCIES && cd $WORK_DIR && $AUTORECONF"
14+
15+
abs_srcdir=$(cd $(dirname $0)/../..; pwd)
16+
17+
if podman --version &>/dev/null; then
18+
RUNTIME="podman"
19+
elif docker --version &>/dev/null; then
20+
RUNTIME="docker"
21+
else
22+
echo "$@ needs either Podman or Docker container runtime." >&2
23+
exit 1
24+
fi
25+
26+
PATH_OPT=""
27+
if command -v selinuxenabled >/dev/null && selinuxenabled; then
28+
PATH_OPT=":Z"
29+
fi
30+
31+
"$RUNTIME" run --rm -v "$abs_srcdir:$WORK_DIR$PATH_OPT" "$IMAGE" /usr/bin/bash -c "$SHELL_CMD"

aclocal.m4

Lines changed: 7 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0