diff options
author | Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> | 2023-08-26 22:12:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-26 17:12:41 -0400 |
commit | 4e49e4928d44ce1ffc9a880ec035d1441a1b7650 (patch) | |
tree | eec59e7d2a29f5f4ffe650643a32a89657231c84 /pkgs | |
parent | a7253c72bb5254d24e401306eb3aadc581a27caa (diff) |
tests.texlive.fixedHashes: init (#248746)
The assertion that all TeX Live packages have a fixed hash is time consuming and should only be checked when running tests.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/test/texlive/default.nix | 21 | ||||
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/default.nix | 6 |
2 files changed, 22 insertions, 5 deletions
diff --git a/pkgs/test/texlive/default.nix b/pkgs/test/texlive/default.nix index 1d339c1ddd0b1..50f274f6f7e04 100644 --- a/pkgs/test/texlive/default.nix +++ b/pkgs/test/texlive/default.nix @@ -511,4 +511,25 @@ echo "$errorText" false ''); + + # verify that all fixed hashes are present + # this is effectively an eval-time assertion, converted into a derivation for + # ease of testing + fixedHashes = with lib; let + combine = findFirst (p: (head p.pkgs).pname == "combine") { pkgs = []; } (head texlive.collection-latexextra.pkgs).tlDeps; + all = concatLists (map (p: p.pkgs or []) (attrValues (removeAttrs texlive [ "bin" "combine" "combined" "tlpdb" ]))) ++ combine.pkgs; + fods = filter (p: isDerivation p && p.tlType != "bin") all; + errorText = concatMapStrings (p: optionalString (! p ? outputHash) "${p.pname + optionalString (p.tlType != "run") ("." + p.tlType)} does not have a fixed output hash\n") fods; + in runCommand "texlive-test-fixed-hashes" { + inherit errorText; + passAsFile = [ "errorText" ]; + } '' + if [[ -s "$errorTextPath" ]] ; then + cat "$errorTextPath" + echo Failed: some TeX Live packages do not have fixed output hashes. Please read UPGRADING.md for how to generate a new fixed-hashes.nix. + exit 1 + else + touch "$out" + fi + ''; } diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index 9839d764adf4e..b382dc258e8c5 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -496,11 +496,7 @@ let assertions = with lib; assertMsg (tlpdbVersion.year == version.texliveYear) "TeX Live year in texlive does not match tlpdb.nix, refusing to evaluate" && - assertMsg (tlpdbVersion.frozen == version.final) "TeX Live final status in texlive does not match tlpdb.nix, refusing to evaluate" && - (!useFixedHashes || - (let all = concatLists (catAttrs "pkgs" (attrValues tl)); - fods = filter (p: isDerivation p && p.tlType != "bin") all; - in builtins.all (p: assertMsg (p ? outputHash) "The TeX Live package '${p.pname + lib.optionalString (p.tlType != "run") ("." + p.tlType)}' does not have a fixed output hash. Please read UPGRADING.md on how to build a new 'fixed-hashes.nix'.") fods)); + assertMsg (tlpdbVersion.frozen == version.final) "TeX Live final status in texlive does not match tlpdb.nix, refusing to evaluate"; in tl // { |