-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Allow meta.problems while preventing internal use of certain kinds #533376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eba1d51
meta.problems: Internal refactoring
infinisil 8fcbb35
meta.problems: Fill out output meta with final list of problems
infinisil 7cc4d7d
config: Introduce attrPathsDisallowedForInternalUse
infinisil 19a3165
ci/eval: Refactor attrpaths.nix to a more generic pre-eval.nix
infinisil a90d993
ci/eval: Allow preventing internal Nixpkgs use of certain problem kinds
infinisil 8fa1b2e
release-checks: Prevent meta.problem warnings
infinisil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # This file does a fast pre-evaluation of Nixpkgs to determine: | ||
| # - paths: A *superset* of all attrpaths of derivations which might be part of a release on *any* platform. | ||
| # - attrPathsDisallowedForInternalUse: Attribute paths whose meta.problems has problems whose kinds should not be used internally in Nixpkgs | ||
| # | ||
| # This expression runs single-threaded under all current Nix | ||
| # implementations, but much faster and with much less memory | ||
| # used than ./outpaths.nix itself. | ||
| # | ||
| # Once you have the list of attrnames you can split it up into | ||
| # $NUM_CORES batches and evaluate the outpaths separately for each | ||
| # batch, in parallel. | ||
| # | ||
| # To dump the result: | ||
| # | ||
| # nix-instantiate --eval --strict --json ci/eval/pre-eval.nix -A result | ||
| # | ||
| { | ||
| lib ? import (path + "/lib"), | ||
| trace ? false, | ||
| path ? ./../.., | ||
| extraNixpkgsConfigJson ? "{}", | ||
| }: | ||
| let | ||
|
|
||
| # TODO: Use mapAttrsToListRecursiveCond when this PR lands: | ||
| # https://github.com/NixOS/nixpkgs/pull/395160 | ||
| listAttrs = | ||
| path: value: | ||
| let | ||
| result = | ||
| if path == [ "AAAAAASomeThingsFailToEvaluate" ] || !(lib.isAttrs value) then | ||
| [ ] | ||
| else if lib.isDerivation value then | ||
| [ | ||
| { | ||
| inherit path value; | ||
| } | ||
| ] | ||
| else | ||
| lib.pipe value [ | ||
| (lib.mapAttrsToList ( | ||
| name: value: | ||
| lib.addErrorContext "while evaluating package set attribute path '${ | ||
| lib.showAttrPath (path ++ [ name ]) | ||
| }'" (listAttrs (path ++ [ name ]) value) | ||
| )) | ||
| lib.concatLists | ||
| ]; | ||
| in | ||
| lib.traceIf trace "** ${lib.showAttrPath path}" result; | ||
|
|
||
| outpaths = import ./outpaths.nix { | ||
| inherit path; | ||
| extraNixpkgsConfig = builtins.fromJSON extraNixpkgsConfigJson; | ||
| attrNamesOnly = true; | ||
| }; | ||
|
|
||
| list = | ||
| map | ||
| (path: { | ||
| inherit path; | ||
| # This looks a bit weird, but the only reason we care about this value | ||
| # is for the meta.problems check below, and stdenv's certainly don't | ||
| # have any problems, so this is fine :) | ||
| value = { }; | ||
| }) | ||
| [ | ||
| # Some of the following are based on variants, which are disabled with `attrNamesOnly = true`. | ||
| # Until these have been removed from release.nix / hydra, we manually add them to the list. | ||
| [ | ||
| "pkgsLLVM" | ||
| "stdenv" | ||
| ] | ||
| [ | ||
| "pkgsArocc" | ||
| "stdenv" | ||
| ] | ||
| [ | ||
| "pkgsZig" | ||
| "stdenv" | ||
| ] | ||
| [ | ||
| "pkgsStatic" | ||
| "stdenv" | ||
| ] | ||
| [ | ||
| "pkgsMusl" | ||
| "stdenv" | ||
| ] | ||
| ] | ||
| ++ listAttrs [ ] outpaths; | ||
| paths = map (attrs: attrs.path) list; | ||
| names = map lib.showAttrPath paths; | ||
|
|
||
| inherit (import ../../pkgs/stdenv/generic/problems.nix { inherit lib; }) | ||
| disallowNixpkgsInternalUseKinds | ||
| ; | ||
|
|
||
| # Determine the list of attributes whose packages have any meta.problems | ||
| # with a kind that's disallowed from internal Nixpkgs use | ||
| attrPathsDisallowedForInternalUse = lib.pipe list [ | ||
| (lib.map ( | ||
| attrs: | ||
| attrs | ||
| // { | ||
| problematicProblems = builtins.tryEval ( | ||
| lib.filterAttrs (name: problem: disallowNixpkgsInternalUseKinds ? ${problem.kind}) ( | ||
| attrs.value.meta.problems or { } | ||
| ) | ||
| ); | ||
| } | ||
| )) | ||
| (lib.filter (attrs: attrs.problematicProblems.success && attrs.problematicProblems.value != { })) | ||
| (lib.map (attrs: { | ||
| attrPath = attrs.path; | ||
| reason = "it has certain meta.problems whose kinds are disallowed: ${ | ||
| lib.generators.toPretty { } attrs.problematicProblems.value | ||
| }"; | ||
| })) | ||
| ]; | ||
| in | ||
| { | ||
| # TODO: Do we still need these? Probably not | ||
| inherit paths names; | ||
| result = { | ||
| inherit paths attrPathsDisallowedForInternalUse; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.