Skip to content

gh-112088: Run autoreconf in GHA check_generated_files #112090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ jobs:

check_generated_files:
name: 'Check if generated files are up to date'
runs-on: ubuntu-latest
# Don't use ubuntu-latest but a specific version to make the job
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
runs-on: ubuntu-22.04
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
Expand All @@ -143,15 +145,16 @@ jobs:
- name: Check Autoconf and aclocal versions
run: |
grep "Generated by GNU Autoconf 2.71" configure
grep "aclocal 1.16.4" aclocal.m4
grep "aclocal 1.16.5" aclocal.m4
grep -q "runstatedir" configure
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
- name: Configure CPython
run: |
# Build Python with the libpython dynamic library
./configure --config-cache --with-pydebug --enable-shared
- name: Regenerate autoconf files with container image
run: make regen-configure
- name: Regenerate autoconf files
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
run: autoreconf -ivf -Werror
- name: Build CPython
run: |
make -j4 regen-all
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/posix-deps-apt.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/sh
apt-get update

# autoconf-archive is needed by autoreconf (check_generated_files job)
apt-get -yq install \
build-essential \
pkg-config \
autoconf-archive \
ccache \
gdb \
lcov \
Expand Down
17 changes: 12 additions & 5 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,21 @@ files. Commands to regenerate all generated files::
The ``Makefile.pre.in`` file documents generated files, their inputs, and tools used
to regenerate them. Search for ``regen-*`` make targets.

The ``make regen-configure`` command runs `tiran/cpython_autoconf
<https://github.com/tiran/cpython_autoconf>`_ container for reproducible build;
see container ``entry.sh`` script. The container is optional, the following
command can be run locally, the generated files depend on autoconf and aclocal
versions::
configure script
----------------

The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and
the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell
script which uses an Ubuntu container to get the same tools versions and have a
reproducible output.

The container is optional, the following command can be run locally::

autoreconf -ivf -Werror

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


.. _configure-options:

Expand Down
8 changes: 1 addition & 7 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -2642,15 +2642,9 @@ recheck:
autoconf:
(cd $(srcdir); autoreconf -ivf -Werror)

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

# Create a tags file for vi
tags::
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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 (`tiran/cpython_autoconf
<https://github.com/tiran/cpython_autoconf>`_) is no longer used. Patch by
Victor Stinner.
31 changes: 31 additions & 0 deletions Tools/build/regen-configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -e -x

# The check_generated_files job of .github/workflows/build.yml must kept in
# sync with this script. Use the same container image than the job so the job
# doesn't need to run autoreconf in a container.
IMAGE="ubuntu:22.04"
DEPENDENCIES="autotools-dev autoconf autoconf-archive pkg-config"
AUTORECONF="autoreconf -ivf -Werror"

WORK_DIR="/src"
SHELL_CMD="apt-get update && apt-get -yq install $DEPENDENCIES && cd $WORK_DIR && $AUTORECONF"

abs_srcdir=$(cd $(dirname $0)/../..; pwd)

if podman --version &>/dev/null; then
RUNTIME="podman"
elif docker --version &>/dev/null; then
RUNTIME="docker"
else
echo "$@ needs either Podman or Docker container runtime." >&2
exit 1
fi

PATH_OPT=""
if command -v selinuxenabled >/dev/null && selinuxenabled; then
PATH_OPT=":Z"
fi

"$RUNTIME" run --rm -v "$abs_srcdir:$WORK_DIR$PATH_OPT" "$IMAGE" /usr/bin/bash -c "$SHELL_CMD"
82 changes: 7 additions & 75 deletions aclocal.m4

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading