Skip to content
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

check-meta.nix: Add package warnings #177272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

piegamesde
Copy link
Member

Implements RFC 127 NixOS/rfcs#127

Description of changes

See the RFC

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 11, 2022
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 11, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jun 11, 2022
@piegamesde piegamesde marked this pull request as ready for review June 11, 2022 11:16
pkgs/stdenv/generic/check-meta.nix Outdated Show resolved Hide resolved
pkgs/stdenv/generic/check-meta.nix Outdated Show resolved Hide resolved
pkgs/stdenv/generic/check-meta.nix Outdated Show resolved Hide resolved
@piegamesde piegamesde force-pushed the advisories branch 2 times, most recently from b6095f2 to 62a0b0c Compare June 13, 2022 18:40
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 15, 2022
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 15, 2022
@piegamesde

This comment was marked as resolved.

pkgs/top-level/config.nix Outdated Show resolved Hide resolved
lib/strings.nix Outdated Show resolved Hide resolved
pkgs/build-support/substitute/substitute.nix Outdated Show resolved Hide resolved
pkgs/stdenv/generic/check-meta.nix Outdated Show resolved Hide resolved
warnings = mkOption {
type = types.listOf types.str;
default = [];
internal = true;
};
assertions = mkOption {
type = types.listOf types.unspecified;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use types.unspecified, also because it has poor merge semantics. types.raw or types.anything instead. Or better: Specify the full type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simply copied out of the NixOS module and is only temporary, the full type should be specified in #207187 (comment)

pkgs/top-level/config.nix Outdated Show resolved Hide resolved
pkgs/top-level/config.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 27, 2023
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 28, 2023
@piegamesde piegamesde requested a review from cole-h August 7, 2023 14:58
@github-actions github-actions bot removed the 6.topic: lib The Nixpkgs function library label Sep 17, 2023
@piegamesde piegamesde requested a review from a user September 23, 2023 08:54
@ofborg ofborg bot added 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux and removed 10.rebuild-linux: 1-10 labels Sep 23, 2023
@ConnorBaker
Copy link
Contributor

@piegamesde thank you so much for leading this effort! Are there any blockers preventing further progress on this PR?

I've been doing a somewhat ad-hoc version of this to allow for easier diagnoses of build failures, like so:

brokenConditions = attrsets.filterAttrs (_: cond: cond) {
"CUDA and ROCm are mutually exclusive" = cudaSupport && rocmSupport;
"CUDA is not targeting Linux" = cudaSupport && !stdenv.isLinux;
"Unsupported CUDA version" = cudaSupport && !(builtins.elem cudaPackages.cudaMajorVersion [ "11" "12" ]);
"MPI cudatoolkit does not match cudaPackages.cudatoolkit" = MPISupport && cudaSupport && (mpi.cudatoolkit != cudaPackages.cudatoolkit);
"Magma cudaPackages does not match cudaPackages" = cudaSupport && (effectiveMagma.cudaPackages != cudaPackages);
};

broken = builtins.any trivial.id (builtins.attrValues brokenConditions);

I would love to see this merged -- let me know if there's any way I can help!

@infinisil
Copy link
Member

Me and @piegamesde sat together at NixCon to discuss this, but my conclusion there was that mkDerivation's code is very messy, and this PR makes the mess worse. It would take considerable effort to make it not messy, but I think that's what we need if we want to have any chance of maintaining this over time. And I think currently @piegamesde's priorities are with NixOS/rfcs#166

@piegamesde
Copy link
Member Author

@ConnorBaker This code does a minimal implementation, which I have hopes of getting merged eventually. The current bigger task to do here is QA, especially writing unit tests for the different conditions. That's why I factored out the business logic into its own file, as Infinisil requested back then. Feel free to take on that task, I won't be working on it for a bit probably. Apart from that this change has been heavily review-stalled for a lot of time, so simply watching here and giving review as necessary would be a big help too

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@infinisil
Copy link
Member

It seems like I'm unintentionally blocking this from progressing. I'm just taking another look, and unless I'm just missing it, the PR changes itself really aren't bad. What I think needs to be done before merging:

  • Very important: Have decent tests, there's currently none. Somewhere in pkgs/test would fit.
  • Double-Check that this PR actually implements the RFC correctly.
  • Try to make reasonably sure that CI (ofborg and Hydra) doesn't break. Can still be reverted if it does end up breaking CI

I'd also really like for somebody to think about how we could clean up check-meta.nix over time, because while this RFC introduces a more consistent mechanism, the old mechanism is also still there for now. I think that's what I was thinking of in the previous comment.

Unfortunately I'm pretty spread out with my availability, so I don't have time to do this myself, I'll dismiss my review and don't intend to interfere with this anymore.

@infinisil infinisil dismissed their stale review June 5, 2024 15:47

It's okay

@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
@infinisil
Copy link
Member

I was asked by @AkechiShiro to help a bit with how to write tests for this, so here's some proof of concept for how it could work: tweag@9b55daf

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2024
@AkechiShiro
Copy link
Contributor

AkechiShiro commented Aug 11, 2024

Hello all,

Here are the tests cases, I've though of so far, this matrix needs to be made 3 times to cover for each handlers (ignore,warn,error), in total 39 tests would be needed for full coverage for all handlers, in case I'm missing anything feel free to let me know.

So far, I have almost full coverage on the error handler and partial coverage on the warn handler.

Problem kinds Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 8 Case 9 Case 10 Case 11 Case 12 Case 13
Removal X X X XX XX XX XX (X)
Maintainerless X X X XX XX XX XX (X)
Deprecated X X X XX XX XX XX (X)

Note

Case 12 : is each of the problems alone on their own

Thanks a lot for your help for establishing the ground work for the tests @infinisil

@AkechiShiro
Copy link
Contributor

The new PR is ready for review, thanks to all involved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: stdenv Standard environment 8.has: documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.