archlinux-s390x/patches/pkgbuild/pam.sh
Mathieu Benoit dcaa55b19a [ADD] host deps: the tools six packages needed and nobody declared
--nodeps means every makedepend must be named here by hand. Seven builds
stopped on one, each naming a different tool: itstool, convert, fig2dev,
asciidoctor, libnsl, python -m build, libbpf, history.

The list was also a lie by omission. libreadline-dev, libncurses-dev,
zlib1g-dev, python3-dev, doxygen, xsltproc, docbook-xsl, elinks and
libcap2-bin were on this VM by hand and never declared. They made the
builds pass here and would fail on a fresh Ubuntu, for reasons that have
nothing to do with s390x.

history.pc is generated rather than copied: our own readline package
ships a correct one, but its libdir names /usr/lib, which on a multiarch
host holds no libhistory. The .pc has to describe THIS host.

Three hooks for what apt cannot buy. systemd asks for an EFI arch s390x
does not have -- and says "python3 is missing modules: elftools", which
sends you to apt for four lines before admitting the real reason.

--- FR ---

--nodeps veut dire que chaque makedepend doit être nommé ici à la main.
Sept compilations se sont arrêtées sur l'une d'elles, chacune désignant
un outil différent : itstool, convert, fig2dev, asciidoctor, libnsl,
python -m build, libbpf, history.

La liste mentait aussi par omission. libreadline-dev, libncurses-dev,
zlib1g-dev, python3-dev, doxygen, xsltproc, docbook-xsl, elinks et
libcap2-bin étaient posés à la main sur cette VM, jamais déclarés. Ils
faisaient passer les compilations ici et auraient échoué sur un Ubuntu
neuf, pour des raisons étrangères à s390x.

history.pc est généré et non copié : notre propre paquet readline en
livre un correct, mais son libdir nomme /usr/lib, qui sur un hôte
multiarch ne contient aucun libhistory. Le .pc doit décrire CET hôte-ci.

Trois crochets pour ce qu'apt n'achète pas. systemd réclame une
architecture EFI que s390x n'a pas — et annonce « python3 is missing
modules: elftools », ce qui envoie chez apt pour quatre lignes avant
d'avouer la vraie raison.

Assisted-by: Claude Opus 5
2026-08-17 01:33:41 -04:00

44 lines
2.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# pam: the PDF removal assumes fop, which the Ubuntu host does not have.
#
# rm: cannot remove
# '.../pkg/pam/usr/share/doc/Linux-PAM/*.pdf': No such file or directory
#
# package() ends on
#
# # remove unreproducible pdf files
# rm "${pkgdir}"/usr/share/doc/Linux-PAM/*.pdf
#
# and that line only works because Arch lists fop in makedepends. fop is a
# Java renderer; putting a JVM on the build host to produce three PDFs that
# the very next line deletes buys nothing, so the host stays without it.
#
# Without fop meson drops every PDF target in silence -- doc/adg, doc/mwg and
# doc/sag each guard theirs with `if prog_fop.found()`, and the configured
# build.ninja then holds zero .pdf rules. The DIRECTORY still exists, because
# the HTML and text manuals install beside them, so the glob is never
# expanded and rm is handed the literal string `*.pdf`. Same shape as the
# util-linux glob that started the libdir hunt: the message names a path that
# was never going to exist, and it aborts package() AFTER a successful
# compile -- so the build looks like it failed at the very last step for no
# reason at all.
#
# -f is the whole fix. With fop the PDFs are still removed; without it the
# empty glob stops being an error.
#
# Not a hook, but the other half of pam and worth finding here: libnsl and
# libtirpc are NOT optional on this host even though upstream marks NIS
# `auto`, because arch-meson passes --auto-features enabled, which promotes
# every auto feature to a hard requirement. Same mechanism turns pam's `docs`
# feature into five fatal xmlcatalog probes. All of it is host packages, and
# they are declared in install_host_deps.
set -euo pipefail
# Exactly one removal, and it must be the pdf one. Never a blanket rewrite:
# package() also runs `install` and `chmod +s` on paths under the same tree,
# and meson install itself writes there.
n=$(grep -cF 'rm "${pkgdir}"/usr/share/doc/Linux-PAM/' PKGBUILD || true)
[ "$n" = "1" ] || { echo "pam: expected 1 pdf removal, found $n" >&2; exit 1; }
sed -i 's|rm "${pkgdir}"/usr/share/doc/Linux-PAM/|rm -f "${pkgdir}"/usr/share/doc/Linux-PAM/|' PKGBUILD
grep -qF 'rm -f "${pkgdir}"/usr/share/doc/Linux-PAM/*.pdf' PKGBUILD || {
echo "pam: pdf removal not made tolerant" >&2; exit 1; }
echo "pam: pdf removal tolerates the empty glob (host has no fop)"