[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
This commit is contained in:
Mathieu Benoit 2026-08-23 22:49:24 -04:00
parent 7fa489b5bb
commit 41f0bc4897

View file

@ -49,6 +49,24 @@ lines[i:i] = [
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; }',
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.",
ind + 'sed -i "/^HDTBLPROCESSEDEXAMPLEFILES = /,/^$/ s|^.*$||" Makefile',
ind + 'grep -q "^HDTBLPROCESSEDEXAMPLEFILES" Makefile && { echo "groff: hdtbl example list not emptied" >&2; exit 1; }',
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',
]
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY