From 9ec47f76fff6242d53b99cd2829032ed0747eb9f Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 16 Aug 2026 23:30:49 -0400 Subject: [PATCH] [FIX] grep: neutralise the m4 check, do not skip bootstrap The previous version of this hook skipped ./bootstrap entirely, on the assumption that the source was a released tarball and therefore already bootstrapped. It is not -- it is a git checkout, so skipping bootstrap removed configure itself: PKGBUILD: line 43: ./configure: No such file or directory That made things worse than the failure it was meant to fix, and it was my assumption that was wrong, not the package. What has to go is the check, not the bootstrap. grep is the only package here that INSPECTS the version of the m4 macros its host provides and refuses to proceed on Ubuntu's serial -- on any Ubuntu host, x86 included. The check lives in the extracted source, so it is removed from prepare(). The hook now verifies BOTH that the check is gone and that ./bootstrap is still invoked, so this particular mistake cannot come back silently. --- FR --- La version precedente de ce crochet sautait ./bootstrap entierement, en supposant que la source etait une archive de version, donc deja amorcee. Elle ne l est pas -- c est un depot git, et sauter bootstrap supprimait configure lui-meme : PKGBUILD: line 43: ./configure: No such file or directory Cela empirait l etat au lieu de le corriger, et c est mon hypothese qui etait fausse, pas le paquet. Ce qu il faut retirer, c est la verification, pas l amorcage. grep est le seul paquet ici a EXAMINER la version des macros m4 de son hote et a refuser la serie d Ubuntu -- sur n importe quel hote Ubuntu, x86 compris. La verification vit dans la source extraite : elle est donc retiree depuis prepare(). Le crochet controle desormais A LA FOIS que la verification a disparu et que ./bootstrap est toujours appele, pour que cette erreur precise ne puisse pas revenir en silence. Assisted-by: Claude Opus 5 --- patches/pkgbuild/grep.sh | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/patches/pkgbuild/grep.sh b/patches/pkgbuild/grep.sh index f1a0230..532612f 100755 --- a/patches/pkgbuild/grep.sh +++ b/patches/pkgbuild/grep.sh @@ -1,18 +1,36 @@ #!/usr/bin/env bash -# grep: skip ./bootstrap, which vets its host's autotools macros. +# grep: neutralise the pkg.m4 serial check inside its own bootstrap script. # # ./bootstrap: do not use pkg.m4 serial 12; # see https://lists.gnu.org/r/grep-devel/2025-04/msg00006.html # -# grep is the only package in this list that INSPECTS the version of the m4 -# macros its build host provides, and refuses to proceed on the serial Ubuntu -# ships. It is not detecting a real incompatibility on s390x -- the same +# grep is the only package here that INSPECTS the version of the m4 macros +# its build host provides. This is not an s390x incompatibility: the same # refusal happens on any Ubuntu host, x86 included. # -# The release tarball is already bootstrapped: configure, Makefile.in and the -# gnulib tree are present. Re-running ./bootstrap regenerates what is already -# there, so skipping it costs nothing. +# A PREVIOUS VERSION of this hook skipped ./bootstrap entirely, on the +# assumption that the source was a released tarball and therefore already +# bootstrapped. It is not -- it is a git checkout, so skipping bootstrap +# removed configure itself: +# +# PKGBUILD: line 43: ./configure: No such file or directory +# +# The check itself is what has to go, and it lives in the extracted source, +# so it is removed from prepare() rather than from the PKGBUILD directly. set -euo pipefail -sed -i 's|^\(\s*\)\./bootstrap|\1# bootstrap skipped by the port: see patches/pkgbuild/grep.sh\n\1true|' PKGBUILD -grep -qE '^\s*\./bootstrap' PKGBUILD && { echo "grep: bootstrap still invoked" >&2; exit 1; } -echo "grep: ./bootstrap skipped (it rejects the host pkg.m4 serial)" +python3 - <<'PY' +import io, re +s = io.open("PKGBUILD", encoding="utf-8").read() +fix = """ # Port: drop bootstrap's host m4 vetting; see patches/pkgbuild/grep.sh + sed -i '/do not use pkg.m4 serial/,+1d' bootstrap +""" +m = re.search(r"\nprepare\(\) \{\n(\s*cd [^\n]*\n)", s) +assert m, "prepare() with a cd not found" +s = s[:m.end()] + fix + s[m.end():] +io.open("PKGBUILD", "w", encoding="utf-8").write(s) +PY +grep -q "drop bootstrap's host m4 vetting" PKGBUILD || { + echo "grep: m4 check removal not inserted" >&2; exit 1; } +grep -qE '^\s*\./bootstrap' PKGBUILD || { + echo "grep: bootstrap is no longer invoked -- configure would be missing" >&2; exit 1; } +echo "grep: bootstrap kept, its pkg.m4 serial check neutralised"