[FIX] grep: skip its host-vetting bootstrap; util-linux: lib64 again

grep is the only package here that INSPECTS the version of the m4
macros its build host provides, and refuses to proceed:

  ./bootstrap: do not use pkg.m4 serial 12

That is not an s390x incompatibility -- the same refusal happens on any
Ubuntu host, x86 included. The release tarball is already bootstrapped,
so re-running ./bootstrap regenerates what is already there and
skipping it costs nothing.

util-linux hits the lib64-versus-lib divergence already handled in
gcc.sh. Here it surfaces as

  rm: cannot remove '.../usr/lib/lib*.la': No such file or directory

a glob that matched nothing, which rm reports as a missing file rather
than an empty expansion -- so the error names a path that was never
going to exist. Same remedy: merge the trees before package() touches
anything, leaving the upstream paths working unchanged.

That divergence has now appeared twice. If a third package hits it, it
belongs in the shared bootstrap rather than in per-package hooks.

--- FR ---

grep est le seul paquet ici a EXAMINER la version des macros m4 que lui
fournit son hote, et a refuser de poursuivre :

  ./bootstrap: do not use pkg.m4 serial 12

Ce n est pas une incompatibilite s390x -- le meme refus survient sur
n importe quel hote Ubuntu, x86 compris. L archive de version est deja
amorcee, donc relancer ./bootstrap regenere ce qui existe deja et le
sauter ne coute rien.

util-linux rencontre la divergence lib64 contre lib deja traitee dans
gcc.sh. Elle apparait ici sous la forme

  rm: cannot remove '.../usr/lib/lib*.la': No such file or directory

un motif qui ne correspond a rien, que rm signale comme un fichier
manquant plutot que comme une expansion vide -- l erreur nomme donc un
chemin qui n allait jamais exister. Meme remede : fusionner les arbres
avant que package() ne touche a quoi que ce soit.

Cette divergence est apparue deux fois. Si un troisieme paquet la
rencontre, sa place est dans l amorcage partage et non dans des
crochets par paquet.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-16 23:26:54 -04:00
parent 36d726f0a1
commit 231514904a
2 changed files with 52 additions and 0 deletions

18
patches/pkgbuild/grep.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# grep: skip ./bootstrap, which vets its host's autotools macros.
#
# ./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
# 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.
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)"

34
patches/pkgbuild/util-linux.sh Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# util-linux: s390x installs to lib64, Arch expects lib.
#
# rm: cannot remove '.../pkg/util-linux/usr/lib/lib*.la': No such file
#
# The same divergence already handled in gcc.sh: 64-bit Z installs libraries
# into usr/lib64, while every Arch PKGBUILD names usr/lib. Here it shows up
# as a glob that matches nothing, which `rm` reports as a missing file rather
# than an empty expansion -- so the error names a path that was never going
# to exist.
#
# Merged before package() touches anything, so the upstream paths keep
# working unchanged.
set -euo pipefail
python3 - <<'PY'
import io, re
s = io.open("PKGBUILD", encoding="utf-8").read()
merge = """ # s390x installs 64-bit libraries to lib64; Arch expects lib.
if [ -d "$pkgdir/usr/lib64" ]; then
mkdir -p "$pkgdir/usr/lib"
cp -a "$pkgdir/usr/lib64/." "$pkgdir/usr/lib/"
rm -rf "$pkgdir/usr/lib64"
fi
"""
m = re.search(r"\npackage_util-linux\(\) \{\n", s)
if not m:
m = re.search(r"\npackage\(\) \{\n", s)
assert m, "package function not found"
s = s[:m.end()] + merge + s[m.end():]
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
PY
grep -q 'installs 64-bit libraries to lib64' PKGBUILD || {
echo "util-linux: lib64 merge not inserted" >&2; exit 1; }
echo "util-linux: lib64 merged into lib before packaging"