nixpkgs-update: include packages shared updateScripts
This commit is contained in:
parent
a497c31ac2
commit
be63c3a072
1 changed files with 29 additions and 19 deletions
|
@ -9,14 +9,14 @@ let
|
||||||
/* Remove duplicate elements from the list based on some extracted value. O(n^2) complexity.
|
/* Remove duplicate elements from the list based on some extracted value. O(n^2) complexity.
|
||||||
*/
|
*/
|
||||||
nubOn = f: list:
|
nubOn = f: list:
|
||||||
if list == [ ] then
|
if list == [] then
|
||||||
[ ]
|
[]
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
x = lib.head list;
|
x = lib.head list;
|
||||||
xs = lib.filter (p: f x != f p) (lib.drop 1 list);
|
xs = lib.filter (p: f x != f p) (lib.drop 1 list);
|
||||||
in
|
in
|
||||||
[ x ] ++ nubOn f xs;
|
[x] ++ nubOn f xs;
|
||||||
|
|
||||||
/* Recursively find all packages (derivations) in `pkgs` matching `cond` predicate.
|
/* Recursively find all packages (derivations) in `pkgs` matching `cond` predicate.
|
||||||
|
|
||||||
|
@ -33,27 +33,37 @@ let
|
||||||
let
|
let
|
||||||
result = builtins.tryEval pathContent;
|
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
|
in
|
||||||
if result.success then
|
if result.success then
|
||||||
let
|
let
|
||||||
evaluatedPathContent = result.value;
|
evaluatedPathContent = result.value;
|
||||||
in
|
in
|
||||||
if lib.isDerivation evaluatedPathContent then
|
if lib.isDerivation evaluatedPathContent then
|
||||||
lib.optional (cond path evaluatedPathContent) { attrPath = lib.concatStringsSep "." path; package = evaluatedPathContent; }
|
lib.optional (cond path evaluatedPathContent) { attrPath = lib.concatStringsSep "." path; package = evaluatedPathContent; }
|
||||||
else if lib.isAttrs evaluatedPathContent then
|
else if lib.isAttrs evaluatedPathContent then
|
||||||
# If user explicitly points to an attrSet or it is marked for recursion, we recur.
|
# If user explicitly points to an attrSet or it is marked for recursion, we recur.
|
||||||
if path == rootPath || evaluatedPathContent.recurseForDerivations or false || evaluatedPathContent.recurseForRelease or false then
|
if path == rootPath || evaluatedPathContent.recurseForDerivations or false || evaluatedPathContent.recurseForRelease or false then
|
||||||
dedupResults (lib.mapAttrsToList (name: elem: packagesWithPathInner (path ++ [ name ]) elem) evaluatedPathContent)
|
dedupResults (lib.mapAttrsToList (name: elem: packagesWithPathInner (path ++ [name]) elem) evaluatedPathContent)
|
||||||
else [ ]
|
else []
|
||||||
else [ ]
|
else []
|
||||||
else [ ];
|
else [];
|
||||||
in
|
in
|
||||||
packagesWithPathInner rootPath pkgs;
|
packagesWithPathInner rootPath pkgs;
|
||||||
|
|
||||||
/* Recursively find all packages (derivations) in `pkgs` matching `cond` predicate.
|
/* Recursively find all packages (derivations) in `pkgs` matching `cond` predicate.
|
||||||
*/
|
*/
|
||||||
packagesWith = packagesWithPath [ ];
|
packagesWith = packagesWithPath [];
|
||||||
|
|
||||||
/* Recursively find all packages in `pkgs` with updateScript matching given predicate.
|
/* Recursively find all packages in `pkgs` with updateScript matching given predicate.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue