From e3397e0ace4aeadefe941241bd5b7bfefad850a9 Mon Sep 17 00:00:00 2001 From: Yvan Sraka Date: Tue, 26 Jul 2022 21:10:13 +0000 Subject: [PATCH] Turn off `trace` messages (when `checkMaterialization` is disabled) to not bother user (#1555) --- lib/materialize.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/materialize.nix b/lib/materialize.nix index 1062e444..d2393560 100644 --- a/lib/materialize.nix +++ b/lib/materialize.nix @@ -36,6 +36,11 @@ let then builtins.trace ("Warning: ignoring materialized for " + name + " " + reason) x else x; + traceWhenChecking = message: x: + if checkMaterialization + then builtins.trace message x + else x; + unchecked = let sha256message = "${name}: To make ${this} a fixed-output derivation but not materialized, set `${sha256Arg}` to the output of the 'calculateMaterializedSha' script in 'passthru'."; @@ -50,10 +55,10 @@ let else if sha256 != null then # Let the user know how to materialize if they want to. - builtins.trace materializeMessage calculateUseHash + traceWhenChecking materializeMessage calculateUseHash else # materialized == null && sha256 == null # Let the user know how to calculate a sha256 or materialize if they want to. - builtins.trace sha256message (builtins.trace materializeMessage calculateNoHash); + traceWhenChecking sha256message (traceWhenChecking materializeMessage calculateNoHash); # Build fully and check the hash and materialized versions checked =