aboutsummaryrefslogtreecommitdiff
path: root/modules/pkgs
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-10-12 23:07:12 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-10-12 23:07:12 +0300
commit2b38f8262ad88c10eccaa072bd26466f756b8146 (patch)
tree740b139e45087bf5b8cac3840e2366a33f0964e0 /modules/pkgs
parentda6afc4acaba528c6aabb9977b3be613462a454d (diff)
downloadnixsap-2b38f8262ad88c10eccaa072bd26466f756b8146.tar.gz
jenkinsWithPlugins: recursion
Diffstat (limited to 'modules/pkgs')
-rw-r--r--modules/pkgs/jenkinsWithPlugins/default.nix24
1 files changed, 16 insertions, 8 deletions
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
<target name="bundle" description="Merge plugins into jenkins.war">
<zip destfile="jenkins.war" level="9">
<zipfileset src="${core}" />
- <zipfileset dir="${pluginsPack requestedPlugins}" prefix="WEB-INF/plugins" />
+ <zipfileset dir="${pluginsPack neededPlugins}" prefix="WEB-INF/plugins" />
</zip>
</target>
</project>
@@ -93,5 +101,5 @@ let
installPhase = "cp jenkins.war $out";
};
-in if requestedPlugins == [] then core else pack
+in if neededPlugins == [] then core else pack