From 2b38f8262ad88c10eccaa072bd26466f756b8146 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 12 Oct 2016 23:07:12 +0300 Subject: jenkinsWithPlugins: recursion --- modules/pkgs/jenkinsWithPlugins/default.nix | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'modules/pkgs/jenkinsWithPlugins') diff --git a/modules/pkgs/jenkinsWithPlugins/default.nix b/modules/pkgs/jenkinsWithPlugins/default.nix index 0b1fb94..74f6aa7 100644 --- a/modules/pkgs/jenkinsWithPlugins/default.nix +++ b/modules/pkgs/jenkinsWithPlugins/default.nix @@ -51,13 +51,21 @@ let ''; }; - requestedPlugins = + neededPlugins = let - explicit = pluginsFunc updateCenter.plugins; - deps = map (p: map (d: updateCenter.plugins.${d.name}) - (filter (d: ! d.optional) p.dependencies) - ) explicit; - in unique ( explicit ++ flatten deps ); + rootPlugins = map (p: p.name) (pluginsFunc updateCenter.plugins); + directDeps = names: + let + pluginDeps = p: map (d: d.name) (filter (d: ! d.optional) p.dependencies); + deps = map (n: pluginDeps updateCenter.plugins.${n}) names; + in flatten deps; + + getDepsRecursive = names: + if names == [] then [] + else names ++ getDepsRecursive (directDeps names) + ; + all = unique ( getDepsRecursive rootPlugins ); + in map (n: updateCenter.plugins.${n}) all; pack = stdenv.mkDerivation rec { name = "jenkins-${updateCenter.core.version}+plugins.war"; @@ -70,7 +78,7 @@ let - + @@ -93,5 +101,5 @@ let installPhase = "cp jenkins.war $out"; }; -in if requestedPlugins == [] then core else pack +in if neededPlugins == [] then core else pack -- cgit v1.2.3