-
Notifications
You must be signed in to change notification settings - Fork 43
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
Try pkg.meta.position before unsafeGetAttrPos #247
Conversation
e2d9ad0
to
1aede84
Compare
nix_update/eval.py
Outdated
else if (builtins.unsafeGetAttrPos "src" pkg) != null then | ||
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg) | ||
else | ||
sanitizePosition (positionFromMeta pkg); |
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.
If we have meta.position, should it not be preferred over src
?
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.
i was trying to change as little of existing behaviour as possible, by if you're on board with this change then why not.
nix_update/eval.py
Outdated
@@ -142,13 +142,22 @@ def eval_expression( | |||
return f""" | |||
let | |||
{indent(dedent(let_bindings), " ")} | |||
positionFromMeta = pkg: let | |||
parts = builtins.match "(.*):([0-9]+)" pkg.meta.position; | |||
in if pkg ? meta.position then {{ |
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.
Do we need this if
here? It's already checked on line 158. Also would make the code slightly simpler.
nix_update/eval.py
Outdated
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg); | ||
|
||
position = if pkg ? isRubyGem then | ||
raw_version_position | ||
else if pkg ? isPhpExtension then | ||
raw_version_position | ||
else | ||
else if pkg ? meta.position then | ||
sanitizePosition (positionFromMeta pkg) |
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.
I think we can even overrule the quirks for ruby gems and php here, I would say.
Fixes `nixpkgs.mpvScripts.*`, discovered while reviewing NixOS/nixpkgs#308062
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 63b5a4e |
Some package builders set
meta.position
manually due to clobbering the origin ofsrc
.Fixes
nix-update -u mpvScripts.*
, discovered while reviewing NixOS/nixpkgs#308062.