texlive: use lists instead of sets to represent dependencies (#217230)

This commit is contained in:
Vincenzo Mantova 2023-02-21 17:24:08 +00:00 committed by GitHub
parent 417dd2ad16
commit ef15288944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6220 additions and 5595 deletions

View file

@ -15,7 +15,7 @@ let
];
};
pkgList = rec {
all = lib.filter pkgFilter (combinePkgs pkgSet);
all = lib.filter pkgFilter (combinePkgs (lib.attrValues pkgSet));
splitBin = builtins.partition (p: p.tlType == "bin") all;
bin = mkUniqueOutPaths splitBin.right
++ lib.optional

View file

@ -30,9 +30,9 @@ let
# the set of TeX Live packages, collections, and schemes; using upstream naming
tl = let
orig = import ./pkgs.nix tl;
orig = import ./pkgs.nix;
removeSelfDep = lib.mapAttrs
(n: p: if p ? deps then p // { deps = lib.filterAttrs (dn: _: n != dn) p.deps; }
(n: p: if p ? deps then p // { deps = lib.filter (dn: n != dn) p.deps; }
else p);
clean = removeSelfDep (orig // {
# overrides of texlive.tlpdb
@ -42,24 +42,24 @@ let
};
xdvi = orig.xdvi // { # it seems to need it to transform fonts
deps = (orig.xdvi.deps or {}) // { inherit (tl) metafont; };
deps = (orig.xdvi.deps or []) ++ [ "metafont" ];
};
# remove dependency-heavy packages from the basic collections
collection-basic = orig.collection-basic // {
deps = removeAttrs orig.collection-basic.deps [ "metafont" "xdvi" ];
deps = lib.filter (n: n != "metafont" && n != "xdvi") orig.collection-basic.deps;
};
# add them elsewhere so that collections cover all packages
collection-metapost = orig.collection-metapost // {
deps = orig.collection-metapost.deps // { inherit (tl) metafont; };
deps = orig.collection-metapost.deps ++ [ "metafont" ];
};
collection-plaingeneric = orig.collection-plaingeneric // {
deps = orig.collection-plaingeneric.deps // { inherit (tl) xdvi; };
deps = orig.collection-plaingeneric.deps ++ [ "xdvi" ];
};
# override cyclic dependency until #167226 is fixed
xecjk = orig.xecjk // {
deps = removeAttrs orig.xecjk.deps [ "ctex" ];
deps = lib.remove "ctex" orig.xecjk.deps;
};
texdoc = orig.texdoc // {
@ -82,8 +82,11 @@ let
};
}); # overrides
# tl =
in lib.mapAttrs flatDeps clean;
linkDeps = lib.mapAttrs (_: attrs: attrs // lib.optionalAttrs (attrs ? deps) {
deps = builtins.map (n: tl.${n}) attrs.deps;
}); # transform [ "dep1" "dep2" ... ] into [ tl."dep1" ... ]
in lib.mapAttrs flatDeps (linkDeps clean);
# TODO: texlive.infra for web2c config?
@ -113,7 +116,7 @@ let
++ lib.optional (attrs.sha512 ? source) (mkPkgV "source")
++ lib.optional (bin ? ${pname})
( bin.${pname} // { inherit pname; tlType = "bin"; } )
++ combinePkgs (attrs.deps or {});
++ combinePkgs (attrs.deps or []);
};
# for daily snapshots
@ -183,8 +186,8 @@ let
);
# combine a set of TL packages into a single TL meta-package
combinePkgs = pkgSet: lib.concatLists # uniqueness is handled in `combine`
(lib.mapAttrsToList (_n: a: a.pkgs) pkgSet);
combinePkgs = pkgList: lib.concatLists # uniqueness is handled in `combine`
(builtins.map (a: a.pkgs) pkgList);
in
tl // {

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
# wrap whole file into an attrset
1itl: { # no indentation
1i{ # no indentation
$a}
# form an attrmap per package
@ -28,16 +28,16 @@ $a}
# extract deps
/^depend [^.]+$/{
s/^depend (.+)$/ deps."\1" = tl."\1";/
s/^depend (.+)$/ deps = [\n "\1"/
# loop through following depend lines
:next
h ; N # save & read next line
s/\ndepend (.+)\.(.+)$//
s/\ndepend (.+)$/\n deps."\1" = tl."\1";/
s/\ndepend (.+)$/\n "\1"/
t next # loop if the previous lines matched
x; p; x # print saved deps
x; s/$/\n ];/p ; x # print saved deps
s/^.*\n// # remove deps, resume processing
}