about summary refs log tree commit diff
path: root/maintainers/scripts/update.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-02-17 12:21:31 +0100
committerJan Tojnar <jtojnar@gmail.com>2022-02-17 12:30:27 +0100
commit30dbdffcb51730949cb03cb483fac32163658861 (patch)
treee58172cb4d0b88eb6b67831ab828744424bde241 /maintainers/scripts/update.nix
parentd67ffe7bcb11d76d88e4d0ea66a98162f8cf5de9 (diff)
maintainers/scripts/update.nix: Fix deduplication for unstableGitUpdater
Some updaters like `unstableGitUpdater` rely solely `UPDATE_NIX_ATTR_PATH`
environment variable to find out package attribute so they all have
the same `passthru.updateScript`. This means we cannot rely
on that attribute to filter out aliased packages because it would
consider all packages using `unstableGitUpdater` the same.

We need to use different criterion to distinguish them. `meta.position`
is a reasonable candidate but we cannot always utilize it since
it might not be available or it might be shared among multiple packages
(e.g. when using custom mkDerivation wrapper).

Combination of the two attributes should distinguish most cases.

Fixes: https://github.com/NixOS/nixpkgs/issues/112583
Diffstat (limited to 'maintainers/scripts/update.nix')
-rwxr-xr-xmaintainers/scripts/update.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix
index d881d68301bad..1217d10999c7b 100755
--- a/maintainers/scripts/update.nix
+++ b/maintainers/scripts/update.nix
@@ -48,7 +48,17 @@ let
         let
           result = builtins.tryEval pathContent;
 
-          dedupResults = lst: nubOn ({ package, attrPath }: package.updateScript) (lib.concatLists lst);
+          somewhatUniqueRepresentant =
+            { package, attrPath }: {
+              inherit (package) updateScript;
+              # Some updaters use the same `updateScript` value for all packages.
+              # Also compare `meta.description`.
+              position = package.meta.position or null;
+              # We cannot always use `meta.position` since it might not be available
+              # or it might be shared among multiple packages.
+            };
+
+          dedupResults = lst: nubOn somewhatUniqueRepresentant (lib.concatLists lst);
         in
           if result.success then
             let