From 75cff944a8aabb5459be74ed423ad77f53b7cf41 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 23 Aug 2026 22:05:26 -0400 Subject: [PATCH] [FIX] binutils records a usr/lib64 path, and cmake deletes html it did not make MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pacman refused the rebuilt binutils: binutils: /usr/lib64 exists in filesystem (owned by filesystem) binutils: /usr/lib64/libiberty.a exists in filesystem --libdir=/usr/lib was not enough. libiberty installs into $(libdir)$(MULTIOSSUBDIR), and gcc reports ../lib64 for -print-multi-os-directory on s390x. In the installed system that resolves through the symlink filesystem now provides, so the file lands in /usr/lib -- but pkgdir has no symlink, so make creates a real pkg/usr/lib64/ and makepkg records the literal path. The two fixes are not alternatives: the symlink is what keeps meson and cmake choosing lib, and this moves the one file that still writes through the multi-os subdirectory. cmake is the eleventh instance of removing a documentation build and leaving its cleanup: with Sphinx off there is no html, and the PKGBUILD deletes _sources from it. rm -rf rather than deleted -- on a machine with Sphinx it is real. The binutils hook also assumed package_binutils(). binutils is not a split package; its own assertion caught that. --- FR --- pacman a refusé le binutils reconstruit : binutils: /usr/lib64 exists in filesystem (owned by filesystem) binutils: /usr/lib64/libiberty.a exists in filesystem --libdir=/usr/lib ne suffisait pas. libiberty s'installe dans $(libdir)$(MULTIOSSUBDIR), et gcc annonce ../lib64 pour -print-multi-os-directory sur s390x. Dans le système installé cela se résout par le lien que filesystem fournit désormais, donc le fichier atterrit dans /usr/lib — mais pkgdir n'a pas de lien : make crée un vrai pkg/usr/lib64/ et makepkg enregistre le chemin littéral. Les deux correctifs ne sont pas des alternatives : le lien est ce qui fait choisir lib à meson et cmake, et celui-ci déplace le seul fichier qui écrive encore par le sous-répertoire multi-os. cmake est la onzième occurrence du retrait d'une documentation sans son nettoyage : sans Sphinx il n'y a pas de html, et le PKGBUILD en supprime _sources. rm -rf plutôt que supprimé — sur une machine dotée de Sphinx, il est réel. Le hook binutils supposait aussi package_binutils(). binutils n'est pas un paquet scindé ; sa propre assertion l'a arrêté. Assisted-by: Claude Opus 5 --- patches/pkgbuild/binutils.sh | 51 ++++++++++++++++++++++++++++++++++++ patches/pkgbuild/cmake.sh | 23 ++++++++++++++++ scripts/packages.sh | 4 +++ 3 files changed, 78 insertions(+) diff --git a/patches/pkgbuild/binutils.sh b/patches/pkgbuild/binutils.sh index 7d20d70..43fabcd 100755 --- a/patches/pkgbuild/binutils.sh +++ b/patches/pkgbuild/binutils.sh @@ -149,3 +149,54 @@ grep -q "x86_64-pep" PKGBUILD && { echo "binutils: an x86_64 target survived" >& grep -q -- "--disable-gold" PKGBUILD || { echo "binutils: gold not disabled" >&2; exit 1; } grep -q -- "--enable-gold" PKGBUILD && { echo "binutils: gold still enabled" >&2; exit 1; } echo "binutils: gold dropped (its s390 support needs an obsolete target)" + +# --- libiberty still records a usr/lib64 path --------------------------------- +# +# --libdir=/usr/lib above is not enough. pacman refused to install the result: +# +# binutils: /usr/lib64 exists in filesystem (owned by filesystem) +# binutils: /usr/lib64/libiberty.a exists in filesystem +# +# libiberty installs into $(libdir)$(MULTIOSSUBDIR), and on s390x gcc reports +# ../lib64 for -print-multi-os-directory. In the INSTALLED system that resolves +# through the symlink the filesystem package now provides, so the file lands in +# /usr/lib -- but pkgdir has no such symlink, so make creates a real +# pkg/usr/lib64/ and makepkg records `usr/lib64/libiberty.a` as the package's +# own path. Installing it then collides with the symlink. +# +# The two fixes are not alternatives: filesystem's symlink is what keeps meson +# and cmake choosing lib, and this moves the one file that still writes through +# the multi-os subdirectory. Done in package(), on pkgdir, so nothing depends on +# the order the two packages are installed in. +python3 - <<'ZZPY' +import io, re +lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n") +# The last package function is where pkgdir is complete. +# package(), not package_binutils(). binutils is NOT a split package here -- +# pkgname=binutils, one function -- and the first version of this assumed the +# split form and asserted its way out. Both shapes are in this port; a hook has +# to look. +hit = [i for i, l in enumerate(lines) if re.match(r"^package(_binutils)?\(\)", l)] +assert len(hit) == 1, "binutils: expected one package function, got %d" % len(hit) +# Find that function's closing brace. +i = hit[0] + 1 +while i < len(lines) and lines[i] != "}": + i += 1 +assert i < len(lines), "binutils: package_binutils() has no closing brace" +lines[i:i] = [ + "", + " # libiberty writes through gcc's multi-os subdirectory (../lib64 on", + " # s390x). In the installed system usr/lib64 is a symlink to lib, but pkgdir", + " # has no symlink, so the path is recorded literally and collides with the", + " # filesystem package. Move it to where it resolves to anyway.", + ' if [ -d "$pkgdir/usr/lib64" ]; then', + ' install -d "$pkgdir/usr/lib"', + ' mv "$pkgdir"/usr/lib64/* "$pkgdir/usr/lib/"', + ' rmdir "$pkgdir/usr/lib64"', + ' fi', +] +io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines)) +ZZPY +grep -q 'rmdir "\$pkgdir/usr/lib64"' PKGBUILD || { + echo "binutils: the lib64 move was not inserted" >&2; exit 1; } +echo "binutils: libiberty moved out of usr/lib64" diff --git a/patches/pkgbuild/cmake.sh b/patches/pkgbuild/cmake.sh index 5e49f6b..955040a 100755 --- a/patches/pkgbuild/cmake.sh +++ b/patches/pkgbuild/cmake.sh @@ -110,3 +110,26 @@ ZZPY grep -qE "^[[:space:]]*--sphinx-" PKGBUILD && { echo "cmake: a --sphinx flag survived" >&2; exit 1; } echo "cmake: Sphinx manual and man pages dropped" + +# --- and the html it no longer generates -------------------------------------- +# +# rm: cannot remove '/usr/share/doc/cmake/html/_sources': No such file +# +# ELEVENTH time in this port. With Sphinx off, cmake generates no html, and the +# PKGBUILD deletes _sources from it -- Sphinx leaves the reStructuredText inputs +# beside the rendered pages and they are not wanted in a package. +# +# rm -rf rather than deleted: on a machine with Sphinx the directory is real and +# still has to go. +python3 - <<'ZZPY' +import io, re +lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n") +hit = [i for i, l in enumerate(lines) if "_sources" in l and l.lstrip().startswith("rm ")] +assert len(hit) == 1, "cmake: expected one _sources removal, got %d" % len(hit) +i = hit[0] +lines[i] = lines[i].replace("rm -r ", "rm -rf ", 1) +io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines)) +ZZPY +grep -qE "^[[:space:]]*rm -rf .*_sources" PKGBUILD || { + echo "cmake: the _sources removal was not made tolerant" >&2; exit 1; } +echo "cmake: _sources cleanup tolerates its absence" diff --git a/scripts/packages.sh b/scripts/packages.sh index 270b954..a925ced 100644 --- a/scripts/packages.sh +++ b/scripts/packages.sh @@ -329,6 +329,10 @@ STAGE1_PACKAGES=( # "Backend subprocess exited when trying to invoke build_wheel" -- a backend # complaint about a package that split upstream. python-vcs-versioning + # python-fastjsonschema: poetry-core validates pyproject.toml against a JSON + # schema, so it needs a schema validator to build anything -- including + # itself. ModuleNotFoundError: No module named 'fastjsonschema'. + python-fastjsonschema # libaio: a real closure gap. lvm2 stops on # # device/bcache.c:30:10: fatal error: libaio.h: No such file or directory