about summary refs log tree commit diff
path: root/pkgs/test/texlive
diff options
context:
space:
mode:
authorVincenzo Mantova <1962985+xworld21@users.noreply.github.com>2023-08-26 22:12:41 +0100
committerGitHub <noreply@github.com>2023-08-26 17:12:41 -0400
commit4e49e4928d44ce1ffc9a880ec035d1441a1b7650 (patch)
treeeec59e7d2a29f5f4ffe650643a32a89657231c84 /pkgs/test/texlive
parenta7253c72bb5254d24e401306eb3aadc581a27caa (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/test/texlive')
-rw-r--r--pkgs/test/texlive/default.nix21
1 files changed, 21 insertions, 0 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
+  '';
 }