diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2018-04-30 17:17:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 17:17:24 +0000 |
commit | a591d28c179398ce8da59a25e7bcac7420a8dd0c (patch) | |
tree | 4b6b436ec563b84bdee89515217596abd766bb10 /pkgs/stdenv/generic/make-derivation.nix | |
parent | 2d7e313e7c310f47c23a860bc9bf847bee98d3c9 (diff) | |
parent | 87651b32fe44b9cdeb5dc55d6197d5c5158ce42a (diff) | |
download | nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar.gz nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar.bz2 nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar.lz nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar.xz nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.tar.zst nixlib-a591d28c179398ce8da59a25e7bcac7420a8dd0c.zip |
Merge pull request #39464 from oxij/stdenv/docheck-infra
stdenv: implement most of #33599
Diffstat (limited to 'pkgs/stdenv/generic/make-derivation.nix')
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 7b5f9f7d6b0b..b523374454fc 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -36,6 +36,9 @@ rec { , depsTargetTarget ? [] # 1 -> 1 , depsTargetTargetPropagated ? [] # 1 -> 1 + , checkInputs ? [] + , installCheckInputs ? [] + # Configure Phase , configureFlags ? [] , # Target is not included by default because most programs don't care. @@ -46,11 +49,13 @@ rec { (stdenv.hostPlatform != stdenv.buildPlatform) [ "build" "host" ] + # TODO(@Ericson2314): Make unconditional / resolve #33599 # Check phase - , doCheck ? false + , doCheck ? config.doCheckByDefault or false + # TODO(@Ericson2314): Make unconditional / resolve #33599 # InstallCheck phase - , doInstallCheck ? false + , doInstallCheck ? config.doCheckByDefault or false , crossConfig ? null , meta ? {} @@ -99,7 +104,9 @@ rec { ] [ (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 doInstallCheck' installCheckInputs)) ] [ (map (drv: drv.__spliced.targetTarget or drv) depsTargetTarget) @@ -120,34 +127,43 @@ 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 []); + computedSandboxProfile = + lib.concatMap (input: input.__propagatedSandboxProfile or []) + (stdenv.extraNativeBuildInputs + ++ stdenv.extraBuildInputs + ++ lib.concatLists dependencies); + + computedPropagatedSandboxProfile = + lib.concatMap (input: input.__propagatedSandboxProfile or []) + (lib.concatLists propagatedDependencies); + + computedImpureHostDeps = + lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) + (stdenv.extraNativeBuildInputs + ++ stdenv.extraBuildInputs + ++ lib.concatLists dependencies)); + + computedPropagatedImpureHostDeps = + lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) + (lib.concatLists propagatedDependencies)); + derivationArg = (removeAttrs attrs ["meta" "passthru" "crossAttrs" "pos" + "doCheck" "doInstallCheck" + "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) - // (let - computedSandboxProfile = - lib.concatMap (input: input.__propagatedSandboxProfile or []) - (stdenv.extraNativeBuildInputs - ++ stdenv.extraBuildInputs - ++ lib.concatLists dependencies); - computedPropagatedSandboxProfile = - lib.concatMap (input: input.__propagatedSandboxProfile or []) - (lib.concatLists propagatedDependencies); - computedImpureHostDeps = - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) - (stdenv.extraNativeBuildInputs - ++ stdenv.extraBuildInputs - ++ lib.concatLists dependencies)); - computedPropagatedImpureHostDeps = - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) - (lib.concatLists propagatedDependencies)); - in - { + // { # A hack to make `nix-env -qa` and `nix search` ignore broken packages. # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix. name = assert validity.handled; name + lib.optionalString @@ -186,6 +202,13 @@ rec { } // 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 = @@ -200,15 +223,7 @@ rec { "/bin/sh" ]; __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; - } // lib.optionalAttrs (outputs' != [ "out" ]) { - outputs = outputs'; - } // lib.optionalAttrs (attrs ? doCheck) { - # TODO(@Ericson2314): Make unconditional / resolve #33599 - doCheck = doCheck && (stdenv.hostPlatform == stdenv.buildPlatform); - } // lib.optionalAttrs (attrs ? doInstallCheck) { - # TODO(@Ericson2314): Make unconditional / resolve #33599 - doInstallCheck = doInstallCheck && (stdenv.hostPlatform == stdenv.buildPlatform); - }); + }; validity = import ./check-meta.nix { inherit lib config meta; |