archlinux-s390x/patches/pkgbuild/groff.sh

95 lines
5.2 KiB
Bash
Raw Normal View History

[FIX] systemd without AppArmor, gpgme without its test harness, groff without a logo gpgme is the one worth reading. It failed while BUILDING, not testing: make[3]: Entering directory '.../gpgme/tests/gpg' gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 EL_NOCHECK skips check(), but `make all` still descends into tests/gpg and sets up a throwaway GNUPGHOME, which means starting an agent -- and the chroot has no dbus, no session and no tty. Third time this port has found that "no tests" and "no test harness" are different requests. groff needs xpmtoppm from netpbm to draw the GNU logo for its own manual. There is no configure switch: groff has neither --without-doc nor --disable-doc, so inventing a flag would have failed identically while the hook's check passed -- autoconf only warns about options it does not know. The generated Makefile's DOC_GNU_EPS is emptied instead, and the verification runs inside build(), where the generated file actually exists. --- FR --- gpgme mérite lecture. Il échouait en CONSTRUISANT, pas en testant : make[3]: Entering directory '.../gpgme/tests/gpg' gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 EL_NOCHECK saute check(), mais `make all` descend quand même dans tests/gpg et met en place un GNUPGHOME jetable, donc démarre un agent — or le chroot n'a ni dbus, ni session, ni terminal. Troisième fois que ce portage constate que « pas de tests » et « pas de harnais de test » sont deux demandes différentes. groff a besoin de xpmtoppm, de netpbm, pour dessiner le logo GNU de son propre manuel. Aucun interrupteur n'existe : ni --without-doc ni --disable-doc, donc inventer un drapeau aurait échoué à l'identique pendant que le contrôle du hook passait — autoconf ne fait qu'avertir des options qu'il ignore. La variable DOC_GNU_EPS du Makefile généré est vidée, et la vérification tourne dans build(), là où le fichier généré existe. Assisted-by: Claude Opus 5
2026-08-22 22:02:56 -04:00
#!/usr/bin/env bash
# groff: one decorative figure, and no netpbm to draw it.
#
# program 'xpmtoppm' is missing; can't generate doc/gnu.eps
# make[2]: *** [Makefile:19801: doc/gnu.eps] Error 1
#
# xpmtoppm belongs to netpbm. What it produces is the GNU logo, as EPS, for
# groff's own manual -- and getting it would mean packaging netpbm and the image
# libraries under it (libjpeg-turbo, libpng, libtiff, jbigkit), none of which
# anything else in this bootstrap wants.
#
# NO CONFIGURE SWITCH EXISTS: groff's configure has neither --without-doc nor
# --disable-doc, so there was nothing to turn off. Adding an invented flag would
# have been worse than useless -- autoconf merely warns about options it does not
# know, the build would have failed identically, and the hook's own check would
# have passed.
#
# The Makefile is generated, so it is edited after configure and before make. The
# variable is emptied rather than the rule patched, because the INSTALL side is
# already tolerant:
#
# if test -f "$$d/gnu.eps"; then ... fi
#
# so with nothing built, nothing is installed and nothing complains. One line,
# and the only one whose absence the rest of the Makefile already handles.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
mk = [i for i, l in enumerate(lines) if re.match(r"^[ \t]*make[ \t]*$", l)]
assert len(mk) >= 1, "groff: no bare `make` line found in build()"
i = mk[0]
ind = re.match(r"^[ \t]*", lines[i]).group(0)
lines[i:i] = [
ind + "# doc/gnu.eps needs xpmtoppm from netpbm, which this port does not",
ind + "# package. The install side already skips the file when it is absent.",
ind + 'sed -i "s|^DOC_GNU_EPS = doc/gnu.eps$|DOC_GNU_EPS =|" Makefile',
ind + 'grep -q "^DOC_GNU_EPS =$" Makefile',
ind + "# And its CONSUMER. Emptying DOC_GNU_EPS removed the rule that",
ind + "# builds the figure and not the document that includes it:",
ind + "#",
ind + "# doc/webpage.ms:45: error: cannot open 'gnu.eps'",
ind + "# doc/webpage.ms:45: fatal error: PSPIC failed to include 'gnu.eps'",
ind + "#",
ind + "# PROCESSEDEXAMPLEFILES_PS lists webpage.ps and grnexmpl.ps. The",
ind + "# HTML variant right above it is ALREADY empty, with its real value",
ind + "# left as a comment -- groff's own configure empties that one when",
ind + "# the tools are missing. This does the same for PS, which is the",
ind + "# decision groff would have made had it checked.",
ind + 'sed -i "/^PROCESSEDEXAMPLEFILES_PS = /,/^$/ s|^.*$||" Makefile',
ind + 'grep -q "^PROCESSEDEXAMPLEFILES_PS" Makefile && { echo "groff: PS example list not emptied" >&2; exit 1; }',
[FIX] groff: the second consumer of a figure that is not built Emptying PROCESSEDEXAMPLEFILES_PS was not enough: contrib/hdtbl/examples/mixed_pickles.roff:51: error: cannot open 'gnu.eps' fatal error: PSPIC failed to include 'gnu.eps' hdtbl renders its example tables to PostScript and one of them shows the GNU logo. Rather than chase a third, the consumers were COUNTED: exactly two files include it, doc/webpage.ms and mixed_pickles.roff. Both lists are emptied, and the hook now fails loudly if a third ever appears -- so the next reader gets a sentence instead of a PSPIC error. Considered and rejected: supplying a placeholder gnu.eps. It would have ended the whack-a-mole in one line, and it would have put a blank box where a logo belongs in a document this port then ships. Not rendering the document at all is honest; rendering it wrong is not. --- FR --- Vider PROCESSEDEXAMPLEFILES_PS ne suffisait pas : contrib/hdtbl/examples/mixed_pickles.roff:51: error: cannot open 'gnu.eps' fatal error: PSPIC failed to include 'gnu.eps' hdtbl rend ses tables d'exemple en PostScript, et l'une montre le logo GNU. Plutôt que d'en poursuivre un troisième, les consommateurs ont été COMPTÉS : exactement deux fichiers l'incluent, doc/webpage.ms et mixed_pickles.roff. Les deux listes sont vidées, et le hook échoue bruyamment si un troisième apparaît — le prochain lecteur aura une phrase au lieu d'une erreur PSPIC. Envisagé puis rejeté : fournir un gnu.eps de remplacement. Cela aurait clos la poursuite en une ligne, et aurait mis un cadre vide là où un logo doit être, dans un document que ce portage livre ensuite. Ne pas rendre le document est honnête ; le rendre faux ne l'est pas. Assisted-by: Claude Opus 5
2026-08-23 22:49:24 -04:00
ind + "# THE SECOND consumer. Two files include the logo, and only two --",
ind + "# counted rather than guessed:",
ind + "#",
ind + "# doc/webpage.ms (above)",
ind + "# contrib/hdtbl/examples/mixed_pickles.roff (this)",
ind + "#",
ind + "# hdtbl renders its example tables to PostScript, and one of them shows",
ind + "# the GNU logo. HDTBLPROCESSEDEXAMPLEFILES lists all twelve; the whole",
ind + "# list goes, because there is no reason to render eleven examples of a",
ind + "# table macro package into a documentation set nothing here reads.",
[FIX] groff's remaining lists, systemd man pages, git without libsecret groff was the third round on the same package: DOC_GNU_EPS, then PROCESSEDEXAMPLEFILES_PS, then HDTBL -- and mom's examples were waiting behind those. groff renders its own manuals and every contrib package's examples with the groff being built, each list a separate variable. Finding them one failure at a time cost three passes; all seven are emptied together now. systemd is the fourth package to stop on missing DocBook DATA rather than a missing tool -- xsltproc exists, our libxslt supplies it: compilation error: file ../systemd/man/custom-man.xsl line 12 element import It has the largest man page set here, which is the strongest argument in this port for shipping docbook-xsl eventually. git's libsecret helper needed THREE places, one spanning two lines. The first version asserted "expected one _make, got 2" and stopped -- the guard working. Replacing the install's first line alone would have left its continuation as a command of its own, which is the binutils trap again. --- FR --- groff en était au troisième tour sur le même paquet : DOC_GNU_EPS, puis PROCESSEDEXAMPLEFILES_PS, puis HDTBL — et les exemples de mom attendaient derrière. groff rend ses propres manuels et les exemples de chaque contrib avec le groff en cours de construction, chaque liste étant une variable distincte. Les trouver un échec à la fois a coûté trois passes ; les sept sont vidées ensemble. systemd est le quatrième paquet à s'arrêter sur des DONNÉES DocBook absentes et non sur un outil manquant — xsltproc existe, notre libxslt le fournit : compilation error: file ../systemd/man/custom-man.xsl line 12 element import Il porte le plus grand ensemble de pages de manuel du portage : c'est le meilleur argument pour livrer docbook-xsl à terme. L'aide libsecret de git demandait TROIS endroits, dont un sur deux lignes. La première version a affirmé « expected one _make, got 2 » et s'est arrêtée — le garde faisant son travail. Remplacer la première ligne de l'installation aurait laissé sa continuation comme commande à part, soit le piège de binutils à nouveau. Assisted-by: Claude Opus 5
2026-08-23 23:58:32 -04:00
ind + "# ALL of them, not one per failure. This is the third round on the",
ind + "# same package: DOC_GNU_EPS, then PROCESSEDEXAMPLEFILES_PS, then",
ind + "# HDTBL, and mom's examples were waiting behind those --",
ind + "#",
ind + "# pdfmom: fatal error: test-groff exited with status 4",
ind + "# contrib/mom/examples/typesetting.pdf",
ind + "#",
ind + "# groff renders its own manuals and every contrib package's examples",
ind + "# to PostScript and PDF using the groff being built. Each list is a",
ind + "# separate variable, and finding them one failure at a time is how",
ind + "# three passes went by. They are emptied together.",
ind + 'for _v in HDTBLPROCESSEDEXAMPLEFILES MOMPROCESSEDEXAMPLEFILES \\',
ind + ' PROCESSEDDOCFILES_PDF PROCESSEDDOCFILES_PS \\',
ind + ' PROCESSEDDOCFILES_TXT PROCESSEDDOCFILES \\',
ind + ' GENERATEDDOCFILES; do',
ind + ' sed -i "/^$_v = /,/^$/ s|^.*$||" Makefile',
ind + ' grep -q "^$_v" Makefile && { echo "groff: $_v not emptied" >&2; exit 1; }',
ind + 'done',
[FIX] groff: the second consumer of a figure that is not built Emptying PROCESSEDEXAMPLEFILES_PS was not enough: contrib/hdtbl/examples/mixed_pickles.roff:51: error: cannot open 'gnu.eps' fatal error: PSPIC failed to include 'gnu.eps' hdtbl renders its example tables to PostScript and one of them shows the GNU logo. Rather than chase a third, the consumers were COUNTED: exactly two files include it, doc/webpage.ms and mixed_pickles.roff. Both lists are emptied, and the hook now fails loudly if a third ever appears -- so the next reader gets a sentence instead of a PSPIC error. Considered and rejected: supplying a placeholder gnu.eps. It would have ended the whack-a-mole in one line, and it would have put a blank box where a logo belongs in a document this port then ships. Not rendering the document at all is honest; rendering it wrong is not. --- FR --- Vider PROCESSEDEXAMPLEFILES_PS ne suffisait pas : contrib/hdtbl/examples/mixed_pickles.roff:51: error: cannot open 'gnu.eps' fatal error: PSPIC failed to include 'gnu.eps' hdtbl rend ses tables d'exemple en PostScript, et l'une montre le logo GNU. Plutôt que d'en poursuivre un troisième, les consommateurs ont été COMPTÉS : exactement deux fichiers l'incluent, doc/webpage.ms et mixed_pickles.roff. Les deux listes sont vidées, et le hook échoue bruyamment si un troisième apparaît — le prochain lecteur aura une phrase au lieu d'une erreur PSPIC. Envisagé puis rejeté : fournir un gnu.eps de remplacement. Cela aurait clos la poursuite en une ligne, et aurait mis un cadre vide là où un logo doit être, dans un document que ce portage livre ensuite. Ne pas rendre le document est honnête ; le rendre faux ne l'est pas. Assisted-by: Claude Opus 5
2026-08-23 22:49:24 -04:00
ind + "# And say it out loud: if a THIRD consumer appears, this is the pattern",
ind + "# to look for, not a new kind of problem.",
ind + 'if grep -rl "gnu\\.eps" --include="*.roff" --include="*.ms" . 2>/dev/null | grep -qv "^\\./doc/webpage.ms$\\|mixed_pickles"; then',
ind + ' echo "groff: a third file includes gnu.eps; see patches/pkgbuild/groff.sh" >&2',
ind + ' exit 1',
ind + 'fi',
[FIX] systemd without AppArmor, gpgme without its test harness, groff without a logo gpgme is the one worth reading. It failed while BUILDING, not testing: make[3]: Entering directory '.../gpgme/tests/gpg' gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 EL_NOCHECK skips check(), but `make all` still descends into tests/gpg and sets up a throwaway GNUPGHOME, which means starting an agent -- and the chroot has no dbus, no session and no tty. Third time this port has found that "no tests" and "no test harness" are different requests. groff needs xpmtoppm from netpbm to draw the GNU logo for its own manual. There is no configure switch: groff has neither --without-doc nor --disable-doc, so inventing a flag would have failed identically while the hook's check passed -- autoconf only warns about options it does not know. The generated Makefile's DOC_GNU_EPS is emptied instead, and the verification runs inside build(), where the generated file actually exists. --- FR --- gpgme mérite lecture. Il échouait en CONSTRUISANT, pas en testant : make[3]: Entering directory '.../gpgme/tests/gpg' gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 EL_NOCHECK saute check(), mais `make all` descend quand même dans tests/gpg et met en place un GNUPGHOME jetable, donc démarre un agent — or le chroot n'a ni dbus, ni session, ni terminal. Troisième fois que ce portage constate que « pas de tests » et « pas de harnais de test » sont deux demandes différentes. groff a besoin de xpmtoppm, de netpbm, pour dessiner le logo GNU de son propre manuel. Aucun interrupteur n'existe : ni --without-doc ni --disable-doc, donc inventer un drapeau aurait échoué à l'identique pendant que le contrôle du hook passait — autoconf ne fait qu'avertir des options qu'il ignore. La variable DOC_GNU_EPS du Makefile généré est vidée, et la vérification tourne dans build(), là où le fichier généré existe. Assisted-by: Claude Opus 5
2026-08-22 22:02:56 -04:00
]
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -q "DOC_GNU_EPS" PKGBUILD || { echo "groff: the figure was not dropped" >&2; exit 1; }
# The grep inside build() is the real check: it runs against the generated
# Makefile and fails the build if the variable was not what this hook expects.
grep -q 'grep -q "\^DOC_GNU_EPS =\$" Makefile' PKGBUILD || {
echo "groff: the in-build verification is missing" >&2; exit 1; }
echo "groff: GNU logo figure dropped (no netpbm)"