diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-09-18 16:55:42 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2018-09-18 16:55:42 -0400 |
commit | 7319013ea14f94cb360c7bef9e403de7f1db83b0 (patch) | |
tree | cb6d4763cee2cc982648762c019b3b77b9ba18b2 /pkgs/stdenv/generic | |
parent | ce6e72a11cc2f52d6e92224791fe5db7f9e2ecdd (diff) | |
parent | 35378f014161c1d794dc89b6969275396cb601de (diff) | |
download | nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar.gz nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar.bz2 nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar.lz nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar.xz nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.tar.zst nixpkgs-7319013ea14f94cb360c7bef9e403de7f1db83b0.zip |
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/check-meta.nix | 25 | ||||
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 6 |
2 files changed, 27 insertions, 4 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index a5c8ca70523..28b69f5c2dc 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -81,6 +81,7 @@ let unsupported = remediate_whitelist "UnsupportedSystem"; blacklisted = x: ""; insecure = remediate_insecure; + broken-outputs = remediateOutputsToInstall; unknown-meta = x: ""; }; remediate_whitelist = allow_attr: attrs: @@ -125,6 +126,20 @@ let ''; + remediateOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in '' + The package ${attrs.name} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} + + however ${attrs.name} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} + + and is missing the following ouputs: + + ${lib.concatStrings (builtins.map (output: " - ${output}\n") missingOutputs)} + ''; + handleEvalIssue = attrs: { reason , errormsg ? "" }: let msg = '' @@ -185,6 +200,14 @@ let in anyMatch (attrs.meta.platforms or lib.platforms.all) && ! anyMatch (attrs.meta.badPlatforms or []); + checkOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in if shouldCheckMeta + then builtins.length missingOutputs > 0 + else false; + # Check if a derivation is valid, that is whether it passes checks for # e.g brokenness or license. # @@ -202,6 +225,8 @@ let { valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.config}’"; } else if !(hasAllowedInsecure attrs) then { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; } + else if checkOutputsToInstall attrs then + { valid = false; reason = "broken-outputs"; errormsg = "has invalid meta.outputsToInstall"; } else let res = checkMeta (attrs.meta or {}); in if res != [] then { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; } else { valid = true; }; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 3f35dce2eb2..2db40fc43e3 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -83,9 +83,7 @@ rec { doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; - outputs' = - outputs ++ - (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); + outputs' = outputs ++ lib.optional separateDebugInfo "debug"; fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated @@ -176,7 +174,7 @@ rec { // { # 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 + name = assert validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); name + lib.optionalString # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the |