summaryrefslogtreecommitdiff
path: root/src/rabbit_plugins.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-08-07 20:05:27 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2012-08-07 20:05:27 +0100
commite5c00753ace4dfe553aaeb160d7fecb9bc001c98 (patch)
tree8aa336e93d6bca3c9bcd942c64b6720bbd231a2f /src/rabbit_plugins.erl
parentf67f3666eee79aae80a813919bbf722150359ea6 (diff)
downloadrabbitmq-server-e5c00753ace4dfe553aaeb160d7fecb9bc001c98.tar.gz
Eric's patches
Diffstat (limited to 'src/rabbit_plugins.erl')
-rw-r--r--src/rabbit_plugins.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index a7178563..514c5ed9 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -98,11 +98,22 @@ read_enabled(PluginsFile) ->
%% When Reverse =:= true the bottom/leaf level applications are returned in
%% the resulting list, otherwise they're skipped.
dependencies(Reverse, Sources, AllPlugins) ->
+ %% A dict here is used en lieu of sets to dedup each Name, while
+ %% still maintaining the Deps list for each whose deps are
+ %% known. Missing plugins' dependencies cannot be known.
+ DepMap = lists:foldl(
+ fun({Name, Deps}, Acc) ->
+ dict:append_list(Name, Deps, Acc)
+ end,
+ dict:new(),
+ [{Name, Deps} || #plugin{name = Name,
+ dependencies = Deps} <- AllPlugins] ++
+ [{Dep, []} || #plugin{dependencies = Deps} <- AllPlugins,
+ Dep <- Deps]),
{ok, G} = rabbit_misc:build_acyclic_graph(
fun (App, _Deps) -> [{App, App}] end,
fun (App, Deps) -> [{App, Dep} || Dep <- Deps] end,
- [{Name, Deps}
- || #plugin{name = Name, dependencies = Deps} <- AllPlugins]),
+ dict:to_list(DepMap)),
Dests = case Reverse of
false -> digraph_utils:reachable(Sources, G);
true -> digraph_utils:reaching(Sources, G)