[FIX] sqlite, libpsl and util-linux

sqlite is the deferred item this port had written down long ago -- "libtcl8.6
versus our tcl 9.0" -- arriving as a missing directory:

  mv: cannot stat '<pkgdir>/usr/lib/tcl8.6/sqlite*': No such file or directory

The version is read from the tree rather than written in, because the tcl package
decides it and hardcoding 9.0 puts the same trap back one release later.

The first attempt guarded with a blanket `grep tcl8.6` and condemned correct
code: the existing section of that hook names tcl8.6 on purpose, because it is
about the HOST's tcl. It also substituted $_tcldir into that older section,
before the variable was defined. The guard caught both.

util-linux is the seventh package to fail on a path at the end of package() after
a compile that worked. libpsl's error names its own fix.

--- FR ---

sqlite est l'élément différé que ce portage avait noté depuis longtemps —
« libtcl8.6 contre notre tcl 9.0 » — arrivant sous la forme d'un répertoire
absent :

  mv: cannot stat '<pkgdir>/usr/lib/tcl8.6/sqlite*': No such file or directory

La version est lue dans l'arbre plutôt qu'écrite en dur, parce que c'est le
paquet tcl qui la décide et qu'inscrire 9.0 remettrait le même piège une version
plus tard.

La première tentative gardait par un `grep tcl8.6` global et condamnait du code
juste : la section existante de ce hook nomme tcl8.6 exprès, car elle traite du
tcl de l'HÔTE. Elle avait aussi injecté $_tcldir dans cette section antérieure,
avant que la variable soit définie. Le garde a attrapé les deux.

util-linux est le septième paquet à échouer sur un chemin en fin de package()
après une compilation réussie. L'erreur de libpsl nomme son propre correctif.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-22 07:33:10 -04:00
parent 7c7a1260d7
commit f67796d04c
3 changed files with 90 additions and 0 deletions

20
patches/pkgbuild/libpsl.sh Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# libpsl: no gtk-doc.
#
# configure: error: ... documentation by adding '--disable-gtk-doc' to
# './configure'.
#
# The error names its own fix, which is the whole of this hook. gtk-doc is a
# GNOME documentation toolchain; --enable-gtk-doc is in the PKGBUILD and the
# tool is not here.
set -euo pipefail
python3 - <<'ZZPY'
import io
s = io.open("PKGBUILD", encoding="utf-8").read()
old = "--enable-gtk-doc"
assert s.count(old) == 1, "libpsl: expected one --enable-gtk-doc, got %d" % s.count(old)
s = s.replace(old, "--disable-gtk-doc", 1)
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
ZZPY
grep -q -- "--disable-gtk-doc" PKGBUILD || { echo "libpsl: gtk-doc not disabled" >&2; exit 1; }
echo "libpsl: gtk-doc disabled"

View file

@ -43,3 +43,39 @@ PY
grep -q "tclConfig.sh puts the tcl package tree" PKGBUILD || { grep -q "tclConfig.sh puts the tcl package tree" PKGBUILD || {
echo "sqlite: tcl relocation not inserted" >&2; exit 1; } echo "sqlite: tcl relocation not inserted" >&2; exit 1; }
echo "sqlite: tcl extension relocated from share/tcltk to lib (host TCL_PACKAGE_PATH)" echo "sqlite: tcl extension relocated from share/tcltk to lib (host TCL_PACKAGE_PATH)"
# --- and in the chroot, our tcl is not 8.6 -----------------------------------
#
# mv: cannot stat '<pkgdir>/usr/lib/tcl8.6/sqlite*': No such file or directory
#
# The section above solves the HOST's problem: Ubuntu's tclConfig.sh says
# share/tcltk, so the tree is relocated to usr/lib/tcl8.6 where the upstream mv
# expects it. Inside the stage-2 chroot neither half of that applies -- Arch's
# tclConfig.sh already says lib, and our tcl is 9.0, so sqlite installs into
# usr/lib/tcl9.0 and the upstream mv finds nothing. The relocation above becomes
# a no-op there, correctly, because it is guarded by [ -d ].
#
# This is the deferred item this port had already written down -- "libtcl8.6
# versus our tcl 9.0" -- arriving as a missing directory rather than as a version
# mismatch.
#
# The version is READ from the tree, not written in. Hardcoding 9.0 would put the
# same trap back one release later, and the tcl package is what decides it.
python3 - <<'ZZPY'
import io
s = io.open("PKGBUILD", encoding="utf-8").read()
old = 'mv "$pkgdir"/usr/lib/tcl8.6/sqlite* "$srcdir"/tcl'
assert s.count(old) == 1, "sqlite: the upstream tcl move is not in the expected form"
new = ('_tcldir=$(cd "$pkgdir"/usr/lib && echo tcl[0-9]*)\n'
' [ -d "$pkgdir/usr/lib/$_tcldir" ] || { echo "sqlite: no tcl dir under usr/lib" >&2; exit 1; }\n'
' mv "$pkgdir"/usr/lib/"$_tcldir"/sqlite* "$srcdir"/tcl')
s = s.replace(old, new, 1)
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
ZZPY
# Only the upstream mv had to change. The relocation above still names tcl8.6 on
# purpose -- it is about the HOST's tcl -- so a blanket grep for tcl8.6 would
# condemn correct code, and did on the first attempt.
grep -qE '^[[:space:]]*mv .*usr/lib/tcl8\.6/sqlite' PKGBUILD && {
echo "sqlite: the hardcoded upstream move survived" >&2; exit 1; }
grep -q '_tcldir=' PKGBUILD || { echo "sqlite: the tcl dir is not discovered" >&2; exit 1; }
echo "sqlite: upstream tcl move reads the version from the tree"

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

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# util-linux: the man3 pages that were never built.
#
# mv: cannot stat '<pkgdir>/usr/share/man/man3': No such file or directory
#
# util-linux renders its man pages from asciidoc, which this port does not have,
# so man3 does not exist. The util-linux-libs split moves it out of pkgdir and
# then back in -- TWO places, and removing only the first fails on the second.
#
# Both moves go. Nothing is left conditional: if the directory is never created,
# a guard around moving it is a guard around nothing, and it would read as if
# the man pages were sometimes present.
#
# Same shape as libxml2's docs split, pam's PDFs, libuv's man page and cmake's
# emacs byte-compilation: a failure on a path at the end of package(), after a
# compile that worked. Seventh time.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
hit = [i for i, l in enumerate(lines)
if re.search(r"\bman3\b", l) and l.lstrip().startswith("mv ")]
assert len(hit) == 2, "util-linux: expected two man3 moves, got %d" % len(hit)
for i in reversed(hit):
ind = re.match(r"^[ \t]*", lines[i]).group(0)
lines[i] = ind + ": # man3 not built: no asciidoc at either stage."
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
if grep -qE "^[[:space:]]*mv .*\bman3\b" PKGBUILD; then
echo "util-linux: a man3 move survived" >&2; exit 1
fi
grep -c "man3 not built" PKGBUILD | grep -qx 2 || {
echo "util-linux: expected both moves replaced" >&2; exit 1; }
echo "util-linux: man3 moves removed (both)"