gnupg builds two architecture diagrams into its manual, one needing ImageMagick and one transfig -- two toolchains for two pictures. --disable-doc is gnupg own switch, verified present in configure before use. The hook was written twice. The first version looked for a ./configure line ending in a backslash and asserted its way out; gnupg uses an options ARRAY. Both shapes appear in this port, so a hook has to read the file rather than assume the house style. systemd generates source from jinja2 templates and stops without it. Not documentation this time -- the build cannot proceed. --- FR --- gnupg construit deux diagrammes dans son manuel, l un exigeant ImageMagick et l autre transfig -- deux chaines d outils pour deux images. --disable-doc est son propre interrupteur, verifie present dans configure avant usage. Le hook a ete ecrit deux fois. La premiere version cherchait une ligne ./configure terminee par une contre-oblique et s est arretee sur son assertion ; gnupg emploie un TABLEAU d options. Les deux formes existent dans ce portage : un hook doit lire le fichier plutot que supposer le style maison. systemd genere du code depuis des gabarits jinja2 et s arrete sans lui. Pas de la documentation cette fois -- la construction ne peut pas avancer. Assisted-by: Claude Opus 5
41 lines
2.2 KiB
Bash
Executable file
41 lines
2.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# gnupg: no manual, because two diagrams in it need two image toolchains.
|
|
#
|
|
# /bin/sh: line 1: convert: command not found
|
|
# make[2]: *** [Makefile:1199: gnupg-module-overview.pdf] Error 127
|
|
# /bin/sh: line 1: fig2dev: command not found
|
|
# make[2]: *** [Makefile:1211: gnupg-card-architecture.pdf] Error 127
|
|
#
|
|
# `convert` is ImageMagick, `fig2dev` is transfig. Two separate toolchains, for
|
|
# two architecture diagrams in gnupg's own documentation.
|
|
#
|
|
# --disable-doc is gnupg's own switch, and it was CHECKED before being used:
|
|
# `grep -oE '\-\-(disable|enable)-doc' configure` finds both, so autoconf knows
|
|
# the option. groff had no such switch and needed its generated Makefile edited
|
|
# instead -- the difference matters, because an invented flag draws only a
|
|
# warning from autoconf and the build fails exactly as before, with the hook's
|
|
# own check passing.
|
|
set -euo pipefail
|
|
# AN ARRAY, not a continued command. The first version of this hook looked for a
|
|
# ./configure line ending in a backslash and asserted its way out:
|
|
#
|
|
# AssertionError: gnupg: ./configure does not continue
|
|
#
|
|
# gnupg collects its options in `local configure_options=( ... )` and then calls
|
|
# `./configure "${configure_options[@]}"`. Both shapes appear in this port --
|
|
# binutils, cryptsetup and libxcrypt use continued commands; gnupg and shadow use
|
|
# arrays -- so a hook has to look at the file rather than assume the house style.
|
|
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]*local configure_options=\($", l)]
|
|
assert len(hit) == 1, "gnupg: expected one configure_options array, got %d" % len(hit)
|
|
i = hit[0] + 1
|
|
ind = re.match(r"^[ \t]*", lines[i]).group(0)
|
|
# The array is kept in alphabetical order upstream; --disable-doc sorts first.
|
|
lines.insert(i, ind + "--disable-doc # no ImageMagick, no transfig for the diagrams")
|
|
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
|
|
ZZPY
|
|
grep -A2 "local configure_options=(" PKGBUILD | grep -q -- "--disable-doc" || {
|
|
echo "gnupg: the flag is not inside the options array" >&2; exit 1; }
|
|
echo "gnupg: manual disabled (no ImageMagick, no transfig)"
|