Skip to content

Commit 0785ad8

Browse files
pbsdsmergify[bot]
authored andcommitted
Try pkg.meta.position after unsafeGetAttrPos
`meta.position` is prone to point at files where `src` and `version` is not contained, as is the case for overridden packages and packages that use a generic builder.
1 parent f6f817b commit 0785ad8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nix_update/eval.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ def eval_expression(
153153
154154
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
155155
156-
position = if pkg ? meta.position then
157-
sanitizePosition (positionFromMeta pkg)
158-
else if pkg ? isRubyGem then
156+
position = if pkg ? isRubyGem then
159157
raw_version_position
160158
else if pkg ? isPhpExtension then
161159
raw_version_position
160+
else if (builtins.unsafeGetAttrPos "src" pkg) != null then
161+
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg)
162162
else
163-
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
163+
sanitizePosition (positionFromMeta pkg);
164164
in {{
165165
name = pkg.name;
166166
old_version = pkg.version or (builtins.parseDrvName pkg.name).version;

0 commit comments

Comments
 (0)