From a53504f4a428529e08beda8956f96e7337bb6d12 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 5 Aug 2018 19:24:32 +0000 Subject: stdenv: shadow doCheck and doInstallCheck --- pkgs/stdenv/generic/make-derivation.nix | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 48ee68f4c00c..9aed883d57ca 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -78,6 +78,11 @@ rec { , ... } @ attrs: let + # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when + # no package has `doCheck = true`. + doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; + doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; + fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated ++ depsHostHost ++ depsHostHostPropagated @@ -97,6 +102,9 @@ rec { inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags; }) else let + doCheck = doCheck'; + doInstallCheck = doInstallCheck'; + references = nativeBuildInputs ++ buildInputs ++ propagatedNativeBuildInputs ++ propagatedBuildInputs; @@ -111,7 +119,7 @@ rec { [ (map (drv: drv.__spliced.hostHost or drv) depsHostHost) (map (drv: drv.crossDrv or drv) (buildInputs - ++ lib.optionals doCheck' checkInputs + ++ lib.optionals doCheck checkInputs ++ lib.optionals doInstallCheck' installCheckInputs)) ] [ @@ -133,11 +141,6 @@ rec { ] ]; - # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when - # no package has `doCheck = true`. - doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; - doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; - outputs' = outputs ++ (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); @@ -165,7 +168,6 @@ rec { derivationArg = (removeAttrs attrs ["meta" "passthru" "pos" - "doCheck" "doInstallCheck" "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) @@ -212,15 +214,11 @@ rec { ++ optional (elem "host" configurePlatforms) "--host=${stdenv.hostPlatform.config}" ++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}"; + inherit doCheck doInstallCheck; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; } // lib.optionalAttrs (outputs' != [ "out" ]) { outputs = outputs'; - } // lib.optionalAttrs doCheck' { - doCheck = true; - } // lib.optionalAttrs doInstallCheck' { - doInstallCheck = true; - } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { # TODO: remove lib.unique once nix has a list canonicalization primitive __sandboxProfile = -- cgit 1.4.1 From eb5b313b1669d41f301363824e20cd3669d7da64 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 5 Aug 2018 19:24:46 +0000 Subject: stdenv: shadow outputs --- pkgs/stdenv/generic/make-derivation.nix | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 9aed883d57ca..560aa72eb392 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -83,6 +83,10 @@ rec { doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; + outputs' = + outputs ++ + (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); + fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated ++ depsHostHost ++ depsHostHostPropagated @@ -105,6 +109,8 @@ rec { doCheck = doCheck'; doInstallCheck = doInstallCheck'; + outputs = outputs'; + references = nativeBuildInputs ++ buildInputs ++ propagatedNativeBuildInputs ++ propagatedBuildInputs; @@ -141,10 +147,6 @@ rec { ] ]; - outputs' = - outputs ++ - (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); - computedSandboxProfile = lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraNativeBuildInputs @@ -215,10 +217,10 @@ rec { ++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}"; inherit doCheck doInstallCheck; + + inherit outputs; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; - } // lib.optionalAttrs (outputs' != [ "out" ]) { - outputs = outputs'; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { # TODO: remove lib.unique once nix has a list canonicalization primitive __sandboxProfile = @@ -259,9 +261,8 @@ rec { # unless they are comfortable with this default. outputsToInstall = let - outs = outputs'; # the value passed to derivation primitive - hasOutput = out: builtins.elem out outs; - in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )]; + hasOutput = out: builtins.elem out outputs; + in [( lib.findFirst hasOutput null (["bin" "out"] ++ outputs) )]; } // attrs.meta or {} # Fill `meta.position` to identify the source location of the package. -- cgit 1.4.1