[FIX] four more packages that build without their documentation

git, xz, meson and pam. Each uses the project's own switch where one exists.

git is the one worth reading: `man` appears as a make target twice and
`install-man` twice, once each for git proper and once for contrib/subtree.
Removing the build targets and leaving the install targets gives "No rule to
make target 'install-man'", which reads like a broken Makefile. Four places,
again.

pam is different in kind from the others: xmllint EXISTS here, from our own
libxml2. It fails because pam validates its DocBook sources against DTDs that
are not installed and --nonet forbids fetching them. Shipping the DocBook XML
data would be a package; disabling the documentation is a flag.

--- FR ---

git, xz, meson et pam. Chacun par l'interrupteur du projet lui-même, quand il
existe.

git mérite lecture : `man` figure deux fois comme cible make et `install-man`
deux fois, une paire pour git et une pour contrib/subtree. Retirer les cibles de
construction en laissant celles d'installation donne « No rule to make target
'install-man' », ce qui se lit comme un Makefile cassé. Quatre endroits, encore.

pam diffère en nature : xmllint EXISTE ici, il vient de notre libxml2. Il échoue
parce que pam valide ses sources DocBook contre des DTD non installées, et que
--nonet interdit de les chercher. Livrer les données DocBook serait un paquet ;
désactiver la documentation est un drapeau.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-22 00:07:14 -04:00
parent 0602a2b64c
commit adb6c4f21d
4 changed files with 101 additions and 40 deletions

View file

@ -45,3 +45,34 @@ grep -q "'zlib-ng'" PKGBUILD && {
grep -qF "'grep' 'shadow' 'zlib')" PKGBUILD || {
echo "git: zlib not substituted in depends" >&2; exit 1; }
echo "git: plain zlib (no zlib-ng headers on the host); STAGE-1 ONLY"
# --- no man pages -------------------------------------------------------------
#
# asciidoc: command not found
#
# git's man pages come from asciidoc and xmlto, the Python documentation stack
# this port has declined four times now. FOUR PLACES, which is what makes this
# worth a comment: `man` appears as a make target twice and `install-man` twice,
# once each for git proper and once each for contrib/subtree. Removing the build
# targets and leaving the install targets gives
#
# make: *** No rule to make target 'install-man'
#
# which reads like a broken Makefile.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
b = [i for i, l in enumerate(lines) if re.search(r"_make .*\ball man\b", l)]
i2 = [i for i, l in enumerate(lines) if re.search(r"\binstall install-man\b", l)]
assert len(b) == 2, "git: expected two `all man` targets, got %d" % len(b)
assert len(i2) == 2, "git: expected two `install install-man` targets, got %d" % len(i2)
for i in b:
lines[i] = re.sub(r"\ball man\b", "all", lines[i])
for i in i2:
lines[i] = re.sub(r"\binstall install-man\b", "install", lines[i])
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -qE "\ball man\b|\binstall-man\b" PKGBUILD && {
echo "git: a man target survived" >&2; exit 1; }
echo "git: man pages dropped (no asciidoc, four places)"

View file

@ -89,3 +89,31 @@ ZZPY
grep -q 'posix_local scheme installs' PKGBUILD || {
echo "meson: the relocation was not inserted" >&2; exit 1; }
echo "meson: wheel relocated out of /usr/local; STAGE-1 ONLY"
# --- no reference manual ------------------------------------------------------
#
# meson.build:6:4: ERROR: Problem encountered: Cannot build documentation
#
# meson builds its own reference manual with hotdoc, and its docs/meson.build
# refuses outright when the tool is absent rather than degrading. FOUR LINES:
# the setup, the compile, the install, and a reference_manual.json copied
# separately. Leaving any of the last three behind fails on a path in
# docs.build/ that was never created.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
pats = [r"meson\.py setup docs docs\.build", r"meson\.py compile -C docs\.build",
r"meson\.py install -C docs\.build", r"docs\.build/reference_manual\.json"]
keep = []
found = 0
for l in lines:
if any(re.search(p, l) for p in pats):
found += 1
continue
keep.append(l)
assert found == 4, "meson: expected four docs lines, got %d" % found
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(keep))
ZZPY
grep -q "docs.build" PKGBUILD && { echo "meson: a docs.build line survived" >&2; exit 1; }
echo "meson: reference manual dropped (no hotdoc)"

View file

@ -1,44 +1,24 @@
#!/usr/bin/env bash
# pam: the PDF removal assumes fop, which the Ubuntu host does not have.
# pam: no XML documentation.
#
# rm: cannot remove
# '.../pkg/pam/usr/share/doc/Linux-PAM/*.pdf': No such file or directory
# meson.build:42:2: ERROR: Command `/usr/bin/xmllint --nonet --noout ...`
#
# 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.
# xmllint EXISTS here -- it comes from our libxml2 -- and that is what makes this
# one different from the other documentation failures. It fails because pam
# validates its DocBook sources against DTDs that are not installed, and
# --nonet forbids fetching them. Shipping the DocBook XML data would be a
# package; disabling the documentation is a flag.
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)"
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"^[ \t]*-Dselinux=disabled", l)]
assert len(hit) == 1, "pam: expected one -Dselinux option line, got %d" % len(hit)
i = hit[0]
ind = re.match(r"^[ \t]*", lines[i]).group(0)
assert lines[i].rstrip().endswith("\\"), "pam: the option list does not continue"
lines.insert(i + 1, ind + "-Ddocs=disabled \\")
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -q -- "-Ddocs=disabled" PKGBUILD || { echo "pam: docs not disabled" >&2; exit 1; }
echo "pam: DocBook documentation disabled"

22
patches/pkgbuild/xz.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# xz: autogen.sh without po4a.
#
# po4a/update-po: Translated man pages were not generated.
# ==> ERROR: A failure occurred in prepare().
#
# prepare() runs only `./autogen.sh`, and that script regenerates the translated
# man pages with po4a -- a Perl toolchain this port declined along with the rest
# of the documentation stack. xz's autogen.sh takes --no-po4a for exactly this,
# so the switch is upstream's, not ours.
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.match(r"^[ \t]*\./autogen\.sh[ \t]*$", l)]
assert len(hit) == 1, "xz: expected one bare ./autogen.sh, got %d" % len(hit)
lines[hit[0]] = lines[hit[0]].rstrip() + " --no-po4a"
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -q -- "autogen.sh --no-po4a" PKGBUILD || {
echo "xz: --no-po4a was not added" >&2; exit 1; }
echo "xz: translated man pages skipped"