From 2381bcd86f3bc79fffc025ffd99ea75ae5a9b7b5 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 13 Mar 2018 18:04:29 +0100 Subject: [PATCH] maintainers/scripts/update.nix: use saner nubbing --- maintainers/scripts/update.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix index cb819a053c43..c637540a5aa4 100755 --- a/maintainers/scripts/update.nix +++ b/maintainers/scripts/update.nix @@ -6,11 +6,22 @@ # TODO: add assert statements let + /* Remove duplicate elements from the list based on some extracted value. O(n^2) complexity. + */ + nubOn = f: list: + if list == [] then + [] + else + let + x = pkgs.lib.head list; + xs = pkgs.lib.filter (p: f x != f p) (pkgs.lib.drop 1 list); + in + [x] ++ nubOn f xs; pkgs = import ./../../default.nix { }; packagesWith = cond: return: set: - pkgs.lib.unique + nubOn (pkg: pkg.updateScript) (pkgs.lib.flatten (pkgs.lib.mapAttrsToList (name: pkg: