From 8f35ef724a8e7f7e7ef2b4d4120182acf2ef7119 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 3 Mar 2019 21:36:10 -0500 Subject: [PATCH] texlive/combine.nix: fix bugs in languages filter Initial language.{dat,def} configuration files provided by `texlive.hyphen-base` may declare languages that were not part of the combined packages. Those are filtered out by a sed script that had few problems: 1) The sed script was generated from a list of potentially non-unique packages. Every repetition of a select and print clause would produce a copy of a language declaration in the output file. This became a problem for update to the 2018-final, the fmtutil would crash from too much German hyphenation. 2) The select clauses were ambiguous: both '^% from hyphen' and '^% from hyphen-welsh' will match a line 'from hyphen-welsh'. --- pkgs/tools/typesetting/tex/texlive/combine.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 834828248e2..7a06689c5e6 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -132,10 +132,15 @@ in buildEnv { # updmap.cfg seems like not needing changes # now filter hyphenation patterns, in a hacky way ATM - (let script = - writeText "hyphens.sed" ( - lib.concatMapStrings (pkg: "/^\% from ${pkg.pname}/,/^\%/p;\n") pkgList.splitBin.wrong - + "1,/^\% from/p;" ); + (let + pnames = uniqueStrings (map (p: p.pname) pkgList.splitBin.wrong); + script = + writeText "hyphens.sed" ( + # pick up the header + "1,/^\% from/p;" + # pick up all sections matching packages that we combine + + lib.concatMapStrings (pname: "/^\% from ${pname}:$/,/^\%/p;\n") pnames + ); in '' ( cd ./share/texmf/tex/generic/config/