texlive.tlpdb.nix: extract binary files, formats, script extensions

This commit is contained in:
Vincenzo Mantova 2023-07-10 21:28:35 +01:00
parent bcd641697e
commit fba0cc72fe
4 changed files with 1620 additions and 37 deletions

View file

@ -153,7 +153,7 @@ in (buildEnv {
(let
hyphens = lib.filter (p: p.hasHyphens or false && p.tlType == "run") pkgList.splitBin.wrong;
hyphenPNames = map (p: p.pname) hyphens;
formats = lib.filter (p: p.hasFormats or false && p.tlType == "run") pkgList.splitBin.wrong;
formats = lib.filter (p: p ? formats && p.tlType == "run") pkgList.splitBin.wrong;
formatPNames = map (p: p.pname) formats;
# sed expression that prints the lines in /start/,/end/ except for /end/
section = start: end: "/${start}/,/${end}/{ /${start}/p; /${end}/!p; };\n";

View file

@ -96,13 +96,12 @@ let
# tarball of a collection/scheme itself only contains a tlobj file
[( if (attrs.hasRunfiles or false) then mkPkgV "run"
# the fake derivations are used for filtering of hyphenation patterns and formats
else {
else ({
inherit pname version;
tlType = "run";
hasFormats = attrs.hasFormats or false;
hasHyphens = attrs.hasHyphens or false;
tlDeps = map (n: tl.${n}) (attrs.deps or []);
}
} // lib.optionalAttrs (attrs ? formats) { inherit (attrs) formats; })
)]
++ lib.optional (attrs.sha512 ? doc) (mkPkgV "doc")
++ lib.optional (attrs.sha512 ? source) (mkPkgV "source")
@ -188,11 +187,10 @@ let
} // lib.optionalAttrs (tlType == "run" && args ? deps) {
tlDeps = map (n: tl.${n}) args.deps;
} // lib.optionalAttrs (tlType == "run") {
hasFormats = args.hasFormats or false;
hasHyphens = args.hasHyphens or false;
} // lib.optionalAttrs (tlType == "tlpkg" && args ? postactionScript) {
postactionScript = args.postactionScript;
};
} // lib.optionalAttrs (tlType == "run" && args ? formats) { inherit (args) formats; };
} // lib.optionalAttrs (fixedHash != null) {
outputHash = fixedHash;
outputHashAlgo = "sha256";

View file

@ -89,9 +89,25 @@ $a}
N
s/\n / / # remove newline
t next-file # loop if previous line matched
s/\n/ \n/ # add space before last newline for accurate matching below
/ (RELOC|texmf-dist)\//i\ hasRunfiles = true;
/ tlpkg\//i\ hasTlpkg = true;
# extract script extensions
/ texmf-dist\/scripts\/.*\.(jar|lua|py|rb|sno|tcl|texlua|tlu) /{
i\ scriptExts = [
/ texmf-dist\/scripts\/.*\.jar /i\ "jar"
/ texmf-dist\/scripts\/.*\.lua /i\ "lua"
/ texmf-dist\/scripts\/.*\.py /i\ "py"
/ texmf-dist\/scripts\/.*\.rb /i\ "rb"
/ texmf-dist\/scripts\/.*\.sno /i\ "sno"
/ texmf-dist\/scripts\/.*\.tcl /i\ "tcl"
/ texmf-dist\/scripts\/.*\.texlua /i\ "texlua"
/ texmf-dist\/scripts\/.*\.tlu /i\ "tlu"
i\ ];
}
D # restart cycle from the current line
}
@ -101,8 +117,50 @@ $a}
# extract hyphenation patterns and formats
# (this may create duplicate lines, use uniq to remove them)
/^execute\sAddHyphen/i\ hasHyphens = true;
/^execute\sAddFormat/i\ hasFormats = true;
# extract format details
/^execute\sAddFormat\s/{
# open a list
i\ formats = [
# create one attribute set per format
# note that format names are not unique
# plain keys: name, engine, patterns
# optionally double quoted key: options
# boolean key: mode (enabled/disabled)
# comma-separated lists: fmttriggers, patterns
:next-fmt
s/(^|\n)execute\sAddFormat/ {/
s/\s+options="([^"]+)"/\n options = "\1";/
s/\s+(name|engine|options)=([^ \t\n]+)/\n \1 = "\2";/g
s/\s+mode=enabled//
s/\s+mode=disabled/\n enabled = false;/
s/\s+(fmttriggers|patterns)=([^ \t\n]+)/\n \1 = [ "\2" ];/g
s/$/\n }/
:split-triggers
s/"([^,]+),([^"]+)" ]/"\1" "\2" ]/;
t split-triggers # repeat until there are no commas
p
s/^.*$// # clear pattern space
N
/^\nexecute\sAddFormat\s/b next-fmt
# close the list
i\ ];
D # restart cycle from the current line
}
# close attrmap
/^$/i};
}
# add list of binaries from one of the architecture-specific packages
/^name ([^.]+|texlive\.infra)\.x86_64-linux$/,/^$/{
s/^name ([0-9].*|texlive\.infra)\.x86_64-linux$/"\1".binfiles = [/p
s/^name (.*)\.x86_64-linux$/\1.binfiles = [/p
s!^ bin/x86_64-linux/(.+)$! "\1"!p
/^$/i];
}

File diff suppressed because it is too large Load diff