git and meson kept failing in stage 2 on exactly what their own hooks fix, while the log said hook skipped (stage-1 only) Both were named in STAGE2_SKIP_HOOKS, correctly, when their whole content was a host workaround: git dropped ZLIB_NG because the host had no zlib-ng headers, meson moved a wheel out of /usr/local. Then each grew a second section that BOTH stages need -- git's asciidoc man pages, meson's hotdoc reference manual -- and the list skips the whole FILE, so the new sections never ran. Two hooks that were by then two thirds relevant, silently ignored. A list of filenames cannot say why a hook is listed, and cannot notice when that reason stops covering the file. The hooks now read EL_STAGE and decide per section, with the reason written beside each guard; the list is gone. libgcrypt and libarchive keep a whole-file guard, which now states its reason instead of being an entry somewhere else. Verified at both stages: git drops its man pages in each, and keeps ZLIB_NG in the chroot where zlib-ng exists. --- FR --- git et meson échouaient à l'étage 2 sur précisément ce que leurs propres hooks corrigent, pendant que le journal disait hook skipped (stage-1 only) Tous deux étaient nommés dans STAGE2_SKIP_HOOKS, à juste titre quand tout leur contenu était un contournement de l'hôte : git abandonnait ZLIB_NG faute d'en-têtes zlib-ng, meson déplaçait une roue hors de /usr/local. Puis chacun a gagné une seconde section utile aux DEUX étages — les pages asciidoc de git, le manuel hotdoc de meson — et la liste saute le FICHIER entier : ces sections n'ont jamais tourné. Deux hooks devenus pertinents aux deux tiers, ignorés en silence. Une liste de noms de fichiers ne peut pas dire pourquoi un hook y figure, ni remarquer que cette raison a cessé de couvrir le fichier. Les hooks lisent désormais EL_STAGE et tranchent par section, la raison écrite à côté de chaque garde ; la liste disparaît. libgcrypt et libarchive gardent une garde de fichier entier, qui énonce sa raison au lieu d'être une entrée ailleurs. Vérifié aux deux étages : git abandonne ses pages de manuel dans les deux, et conserve ZLIB_NG dans le chroot, où zlib-ng existe. Assisted-by: Claude Opus 5
80 lines
3.7 KiB
Bash
Executable file
80 lines
3.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# libarchive: no xar during the bootstrap. STAGE 1 ONLY.
|
|
#
|
|
# THE CYCLE, exactly as it presented itself. Stage 2 reached its very first
|
|
# packaging step and stopped on
|
|
#
|
|
# bsdtar: error while loading shared libraries: libicuuc.so.76
|
|
# ==> ERROR: Failed to create package file.
|
|
#
|
|
# after libxml2 had compiled and installed perfectly. The chain:
|
|
#
|
|
# bsdtar -> libarchive.so.13 -> libxml2.so.16 -> libicuuc.so.76
|
|
#
|
|
# The libxml2 in the chroot is our own stage-1 build, and stage 1 builds
|
|
# against the HOST, whose ICU is 76. Our icu package ships 78. So bsdtar
|
|
# cannot start -- and bsdtar is what makepkg uses to write the package. The
|
|
# package that would fix it is the one being built. Nothing can come out of
|
|
# the chroot until this is broken from outside.
|
|
#
|
|
# WHY NOT SUPPLY libicuuc.so.76. Copying the host's ICU into the chroot is the
|
|
# obvious move and it is the wrong one: it puts untracked host binaries in
|
|
# /usr/lib, which is precisely what test-chroot.sh's ARTEFACT check exists to
|
|
# catch. A symlink to 78 does not work either -- ICU version-suffixes every
|
|
# symbol, so libicuuc.so.78 does not define u_strlen_76.
|
|
#
|
|
# THE ROOT is that libarchive links libxml2 at all. It wants it for the xar
|
|
# format, which is an Apple installer container. Nothing in this bootstrap
|
|
# reads one: makepkg writes .pkg.tar.gz, pacman reads it. Dropping xar removes
|
|
# the entire ICU chain rather than papering over its version.
|
|
#
|
|
# STAGE 1 ONLY -- build-stage2.sh lists libarchive in STAGE2_SKIP_HOOKS. Stage
|
|
# 2 builds it as Arch does, with xar, against our own libxml2 and icu, where
|
|
# the versions agree. The divergence lives exactly as long as the cycle does.
|
|
#
|
|
# BOTH depends ARRAYS. libxml2 is declared twice: once at the top and once as
|
|
# libxml2.so in the depends+= inside package(). Removing only the visible one
|
|
# leaves the package uninstallable for a reason the diff appears to fix -- the
|
|
# fifth place, and the one that has cost the most time in this port.
|
|
set -euo pipefail
|
|
|
|
# STAGE 1 ONLY, the whole file. Expressed here rather than in a list kept by the
|
|
# driver: a list of file names cannot say WHY, and when a hook later grows a
|
|
# section that both stages need, the list silently skips that too. That happened
|
|
# to git and meson.
|
|
if [ "${EL_STAGE:-1}" != 1 ]; then
|
|
echo "libarchive: nothing to do at stage 2 -- our libxml2 and icu agree in the chroot"
|
|
exit 0
|
|
fi
|
|
python3 - <<'ZZPY'
|
|
import io, re
|
|
s = io.open("PKGBUILD", encoding="utf-8").read()
|
|
|
|
# ./configure: refuse xar outright. libarchive probes for BOTH libxml2 and
|
|
# expat and uses whichever it finds, so declining only one leaves the other
|
|
# to reintroduce the dependency the day the host installs it.
|
|
old = " --without-nettle \\\n"
|
|
assert s.count(old) == 1, "libarchive: --without-nettle is not where expected"
|
|
s = s.replace(old, old + " --without-xml2 \\\n --without-expat \\\n", 1)
|
|
|
|
# depends=(...): the top-level array.
|
|
old = " 'libxml2'\n"
|
|
assert s.count(old) == 1, "libarchive: 'libxml2' not in depends as expected"
|
|
s = s.replace(old, "", 1)
|
|
|
|
# depends+=(...) inside package(): the soname form.
|
|
old = " 'libxml2.so'\n"
|
|
assert s.count(old) == 1, "libarchive: 'libxml2.so' not in package() depends"
|
|
s = s.replace(old, "", 1)
|
|
|
|
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
|
|
ZZPY
|
|
grep -q -- '--without-xml2' PKGBUILD || { echo "libarchive: xar not disabled" >&2; exit 1; }
|
|
# Nothing named libxml2 may remain in ANY depends array -- checked by counting
|
|
# rather than by eye, because there were two and both looked like the only one.
|
|
if grep -nE "^\s*'?libxml2" PKGBUILD | grep -q .; then
|
|
echo "libarchive: a libxml2 dependency survived:" >&2
|
|
grep -nE "^\s*'?libxml2" PKGBUILD >&2
|
|
exit 1
|
|
fi
|
|
echo "libarchive: xar disabled, libxml2 dropped from both depends arrays"
|