From 0785ad865a81eae8170aa0f95d0daf59f2a2bbd1 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sat, 10 Aug 2024 16:00:07 +0200 Subject: [PATCH] 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. --- nix_update/eval.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nix_update/eval.py b/nix_update/eval.py index b3747cb..9d6f2c5 100644 --- a/nix_update/eval.py +++ b/nix_update/eval.py @@ -153,14 +153,14 @@ def eval_expression( raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg); - position = if pkg ? meta.position then - sanitizePosition (positionFromMeta pkg) - else if pkg ? isRubyGem then + position = if pkg ? isRubyGem then raw_version_position else if pkg ? isPhpExtension then raw_version_position + else if (builtins.unsafeGetAttrPos "src" pkg) != null then + sanitizePosition (builtins.unsafeGetAttrPos "src" pkg) else - sanitizePosition (builtins.unsafeGetAttrPos "src" pkg); + sanitizePosition (positionFromMeta pkg); in {{ name = pkg.name; old_version = pkg.version or (builtins.parseDrvName pkg.name).version;