-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
tests.nixpkgs-check-by-name: Fix for aliases to packages in pkgs/by-name
and better testing
#281390
Conversation
This test actually fails right now
This was an oversight in NixOS#275539 not accounted for, which would've failed in CI
@ofborg build tests.nixpkgs-check-by-name tests.nixpkgs-check-by-name.tests |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/ci-will-soon-enforce-pkgs-by-name-for-new-packages/38098/2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sad but makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all changes are trivial enough for me to understand
so LGTM
Context
In #275539 I made an oversight which shows itself when you run the tool on the current Nixpkgs:
See #281374 to prevent the broken tooling from being used on master, that should be merged fairly soon before the nixos-unstable channel updates in like a day.
The problem
The problem is that there's some detection logic that makes sure the internal
_internalCallByNamePackageFile
attribute isn't used by packages.If such a top-level attribute that's not in
pkgs/by-name
was detected to use this, an error is thrown. However, the detection logic can't distinguish between aliases and non-aliases.So it gives errors even for aliases to packages defined in
pkgs/by-name
, e.g.nixpkgs/pkgs/top-level/aliases.nix
Line 1099 in 5df0c94
https://github.com/NixOS/nixpkgs/blob/5df0c94c5ed9c4b9664d63047f2f3a7f93c0bb43/pkgs/top-level/all-packages.nix#L28854
The solution
It would be non-trivial to improve the detection logic, so instead this PR just changes the tool to not give an error in these cases.
Furthermore, a
passthru.tests
is added, addressing #256789 and preventing future such problems. It should be triggered automatically after ofborg finishes evaluation of a PR with atests.nixpkgs-check-by-name: ...
commit.Add a 👍 reaction to pull requests you find important.