stdenv: shadow doCheck and doInstallCheck

This commit is contained in:
Jan Malakhovski 2018-08-05 19:24:32 +00:00
parent 71680eb127
commit a53504f4a4

View File

@ -78,6 +78,11 @@ rec {
, ... } @ attrs: , ... } @ attrs:
let 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; fixedOutputDrv = attrs ? outputHash;
noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated
++ depsHostHost ++ depsHostHostPropagated ++ depsHostHost ++ depsHostHostPropagated
@ -97,6 +102,9 @@ rec {
inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags; inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags;
}) })
else let else let
doCheck = doCheck';
doInstallCheck = doInstallCheck';
references = nativeBuildInputs ++ buildInputs references = nativeBuildInputs ++ buildInputs
++ propagatedNativeBuildInputs ++ propagatedBuildInputs; ++ propagatedNativeBuildInputs ++ propagatedBuildInputs;
@ -111,7 +119,7 @@ rec {
[ [
(map (drv: drv.__spliced.hostHost or drv) depsHostHost) (map (drv: drv.__spliced.hostHost or drv) depsHostHost)
(map (drv: drv.crossDrv or drv) (buildInputs (map (drv: drv.crossDrv or drv) (buildInputs
++ lib.optionals doCheck' checkInputs ++ lib.optionals doCheck checkInputs
++ lib.optionals doInstallCheck' installCheckInputs)) ++ 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' =
outputs ++ outputs ++
(if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
@ -165,7 +168,6 @@ rec {
derivationArg = derivationArg =
(removeAttrs attrs (removeAttrs attrs
["meta" "passthru" "pos" ["meta" "passthru" "pos"
"doCheck" "doInstallCheck"
"checkInputs" "installCheckInputs" "checkInputs" "installCheckInputs"
"__impureHostDeps" "__propagatedImpureHostDeps" "__impureHostDeps" "__propagatedImpureHostDeps"
"sandboxProfile" "propagatedSandboxProfile"]) "sandboxProfile" "propagatedSandboxProfile"])
@ -212,15 +214,11 @@ rec {
++ optional (elem "host" configurePlatforms) "--host=${stdenv.hostPlatform.config}" ++ optional (elem "host" configurePlatforms) "--host=${stdenv.hostPlatform.config}"
++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}"; ++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}";
inherit doCheck doInstallCheck;
} // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) {
NIX_HARDENING_ENABLE = enabledHardeningOptions; NIX_HARDENING_ENABLE = enabledHardeningOptions;
} // lib.optionalAttrs (outputs' != [ "out" ]) { } // lib.optionalAttrs (outputs' != [ "out" ]) {
outputs = outputs'; outputs = outputs';
} // lib.optionalAttrs doCheck' {
doCheck = true;
} // lib.optionalAttrs doInstallCheck' {
doInstallCheck = true;
} // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
# TODO: remove lib.unique once nix has a list canonicalization primitive # TODO: remove lib.unique once nix has a list canonicalization primitive
__sandboxProfile = __sandboxProfile =