meta/problems: add hostPlatform to genCheckProblems#113
Open
andir wants to merge 8 commits into
Open
Conversation
This unclutters the file a little and makes it easier to pass them all on as a collection. This will be helpful in the migration from check into meta.problems where we generally want to emit the (almost) identical error and retain all the remediation information without duplicating the text.
Previously problems only gave a hint at how to define generic problem handlers. Some of our problems also have different (legacy?) ways to deal with them. While we probably want to move to a more uniform handling we should keep the escape hatches that we previously provided (config attributes, env vars) and at the same time continue provide the guidance, until it is properly deprecated. Currently there are no problems emitting remediation information and they are currently only included in the warnings. A TODO has been added to the error message as that requires further refactoring.
This will enable future work where e.g. unsupported platform errors can be handled with the new problems framework.
This allows the problems to depend on the current hostPlatform rather than just on the attributes passed to the functions. In a future change we can then use the hostSystem to implement the unsupportedSystem which will then become a meta.problem rather than an unconditional eval error.
The idea here being that we don't have to return a `kindName` anymore since we can only ever have one implementation of a kind anyway. The previous implementation would silently shadow previous problems of the same kind. Notes: * a builtins.filterMapAttrs would be nice to remove a few extra copies but the new code doesn't seem to be slower. There is a PR on Nix to introduce filterAttrs which is close and could maybe steered the right way as filterMap vs filter is just the map+filter function arg: https://github.com/NixOS/nix/pull/15100/files
This moves the unsupported platform support into the meta.problems code while retaining all the typical (legacy?) escape hatches. Benefit of this work is that the generic problem handlers can be used to deal with the errors instead of just blanket opt-outs. An example use case of putting this on warn instead of error would be when porting to a new platform. You might want to attempt compiling all packages but at the same time want to know which ones are actually supposedly unsupported (so you can later on fix their platform(s) attribute).
5e40604 to
fa4b43e
Compare
|
@andir for what it's worth, your work should integrate nicely with the stuff I'm preparing in NixOS#533181. Happy to chat if you have any questions about how I intend to use it -- it's one of the gaps in the current meta.problems implementation. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This will enable future work where e.g. unsupported platform errors
can be handled with the new problems framework.<!--
^ Please summarise the changes you have done and explain why they are necessary here ^
For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.This will enable future work where e.g. unsupported platform errors
can be handled with the new problems framework.