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.
This commit is contained in:
Victor Stinner 2023-11-15 21:47:14 +01:00 committed by GitHub
parent 7e2308aaa2
commit d9fd33a869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 131 additions and 160 deletions

View File

@ -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'
@ -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

View File

@ -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 \

View File

@ -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:

View File

@ -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::

View File

@ -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
Tools/build/regen-configure.sh Executable file
View File

@ -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"

76
aclocal.m4 generated vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
@ -276,7 +276,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 11 (pkg-config-0.29.1)
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
@ -318,7 +318,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
@ -419,7 +419,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
@ -551,74 +551,6 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
dnl [DESCRIPTION], [DEFAULT])
dnl ------------------------------------------
dnl
dnl Prepare a "--with-" configure option using the lowercase
dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
dnl PKG_CHECK_MODULES in a single macro.
AC_DEFUN([PKG_WITH_MODULES],
[
m4_pushdef([with_arg], m4_tolower([$1]))
m4_pushdef([description],
[m4_default([$5], [build with ]with_arg[ support])])
m4_pushdef([def_arg], [m4_default([$6], [auto])])
m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
m4_case(def_arg,
[yes],[m4_pushdef([with_without], [--without-]with_arg)],
[m4_pushdef([with_without],[--with-]with_arg)])
AC_ARG_WITH(with_arg,
AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
[AS_TR_SH([with_]with_arg)=def_arg])
AS_CASE([$AS_TR_SH([with_]with_arg)],
[yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
[auto],[PKG_CHECK_MODULES([$1],[$2],
[m4_n([def_action_if_found]) $3],
[m4_n([def_action_if_not_found]) $4])])
m4_popdef([with_arg])
m4_popdef([description])
m4_popdef([def_arg])
])dnl PKG_WITH_MODULES
dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [DESCRIPTION], [DEFAULT])
dnl -----------------------------------------------
dnl
dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
dnl check._[VARIABLE-PREFIX] is exported as make variable.
AC_DEFUN([PKG_HAVE_WITH_MODULES],
[
PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
AM_CONDITIONAL([HAVE_][$1],
[test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
])dnl PKG_HAVE_WITH_MODULES
dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
dnl [DESCRIPTION], [DEFAULT])
dnl ------------------------------------------------------
dnl
dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
dnl and preprocessor variable.
AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
[
PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
[AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
])dnl PKG_HAVE_DEFINE_WITH_MODULES
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2021 Free Software Foundation, Inc.

60
configure generated vendored
View File

@ -13040,8 +13040,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBUUID" >&5
printf %s "checking for LIBUUID... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uuid >= 2.20" >&5
printf %s "checking for uuid >= 2.20... " >&6; }
if test -n "$LIBUUID_CFLAGS"; then
pkg_cv_LIBUUID_CFLAGS="$LIBUUID_CFLAGS"
@ -13929,8 +13929,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBFFI" >&5
printf %s "checking for LIBFFI... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libffi" >&5
printf %s "checking for libffi... " >&6; }
if test -n "$LIBFFI_CFLAGS"; then
pkg_cv_LIBFFI_CFLAGS="$LIBFFI_CFLAGS"
@ -14461,8 +14461,8 @@ fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBSQLITE3" >&5
printf %s "checking for LIBSQLITE3... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sqlite3 >= 3.15.2" >&5
printf %s "checking for sqlite3 >= 3.15.2... " >&6; }
if test -n "$LIBSQLITE3_CFLAGS"; then
pkg_cv_LIBSQLITE3_CFLAGS="$LIBSQLITE3_CFLAGS"
@ -15225,8 +15225,8 @@ for _QUERY in \
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TCLTK" >&5
printf %s "checking for TCLTK... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $_QUERY" >&5
printf %s "checking for $_QUERY... " >&6; }
if test -n "$TCLTK_CFLAGS"; then
pkg_cv_TCLTK_CFLAGS="$TCLTK_CFLAGS"
@ -15322,8 +15322,8 @@ case $ac_sys_system in #(
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11" >&5
printf %s "checking for X11... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for x11" >&5
printf %s "checking for x11... " >&6; }
if test -n "$X11_CFLAGS"; then
pkg_cv_X11_CFLAGS="$X11_CFLAGS"
@ -19442,8 +19442,8 @@ fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZLIB" >&5
printf %s "checking for ZLIB... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib >= 1.2.0" >&5
printf %s "checking for zlib >= 1.2.0... " >&6; }
if test -n "$ZLIB_CFLAGS"; then
pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS"
@ -19790,8 +19790,8 @@ fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZIP2" >&5
printf %s "checking for BZIP2... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bzip2" >&5
printf %s "checking for bzip2... " >&6; }
if test -n "$BZIP2_CFLAGS"; then
pkg_cv_BZIP2_CFLAGS="$BZIP2_CFLAGS"
@ -20018,8 +20018,8 @@ fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBLZMA" >&5
printf %s "checking for LIBLZMA... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5
printf %s "checking for liblzma... " >&6; }
if test -n "$LIBLZMA_CFLAGS"; then
pkg_cv_LIBLZMA_CFLAGS="$LIBLZMA_CFLAGS"
@ -24015,8 +24015,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBREADLINE" >&5
printf %s "checking for LIBREADLINE... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for readline" >&5
printf %s "checking for readline... " >&6; }
if test -n "$LIBREADLINE_CFLAGS"; then
pkg_cv_LIBREADLINE_CFLAGS="$LIBREADLINE_CFLAGS"
@ -24246,8 +24246,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5
printf %s "checking for LIBEDIT... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libedit" >&5
printf %s "checking for libedit... " >&6; }
if test -n "$LIBEDIT_CFLAGS"; then
pkg_cv_LIBEDIT_CFLAGS="$LIBEDIT_CFLAGS"
@ -25134,8 +25134,8 @@ then :
if test "$ac_sys_system" != "Darwin"; then
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CURSES" >&5
printf %s "checking for CURSES... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncursesw" >&5
printf %s "checking for ncursesw... " >&6; }
if test -n "$CURSES_CFLAGS"; then
pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS"
@ -25334,8 +25334,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CURSES" >&5
printf %s "checking for CURSES... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5
printf %s "checking for ncurses... " >&6; }
if test -n "$CURSES_CFLAGS"; then
pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS"
@ -25569,8 +25569,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PANEL" >&5
printf %s "checking for PANEL... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panelw" >&5
printf %s "checking for panelw... " >&6; }
if test -n "$PANEL_CFLAGS"; then
pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS"
@ -25765,8 +25765,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PANEL" >&5
printf %s "checking for PANEL... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panel" >&5
printf %s "checking for panel... " >&6; }
if test -n "$PANEL_CFLAGS"; then
pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS"
@ -27788,8 +27788,8 @@ then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBB2" >&5
printf %s "checking for LIBB2... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libb2" >&5
printf %s "checking for libb2... " >&6; }
if test -n "$LIBB2_CFLAGS"; then
pkg_cv_LIBB2_CFLAGS="$LIBB2_CFLAGS"

View File

@ -1,15 +1,12 @@
dnl ***************************************************
dnl * Please run autoreconf -if to test your changes! *
dnl ***************************************************
dnl ************************************************************
dnl * Please run autoreconf -ivf -Werror to test your changes! *
dnl ************************************************************
dnl
dnl Python's configure script requires autoconf 2.71, autoconf-archive,
dnl pkgconf's m4 macros.
dnl aclocal 1.16, and pkg-config.
dnl
dnl It is recommended to use a cpython_autoconf container to regenerate the
dnl configure script:
dnl
dnl podman run --rm --pull=always -v $(pwd):/src:Z quay.io/tiran/cpython_autoconf:271
dnl docker run --rm --pull=always -v $(pwd):/src quay.io/tiran/cpython_autoconf:271
dnl It is recommended to use the Tools/build/regen-configure.sh shell script
dnl to regenerate the configure script.
dnl
# Set VERSION so we only need to edit in one place (i.e., here)