summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@rabbitmq.com>2016-12-20 17:22:12 +0000
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2017-10-17 19:01:33 +0200
commit904744d2c3e039105e2c3aeba4c2bb3ceff27fb2 (patch)
treed02391f8e4ed2b752e15be61bb994d36c1646501
parenta2640d1968b0c6f85392abbe9d537971ce4c0123 (diff)
downloadrabbitmq-server-git-904744d2c3e039105e2c3aeba4c2bb3ceff27fb2.tar.gz
Ignore indirect dependencies of rabbit in rabbit_plugins
The goal of maybe_keep_required_deps() is still the same: we don't want to list applications from $RABBITMQ_PLUGINS_DIR the rabbit application depends on. Now, the function handles indirect dependencies. Signed-off-by: Jean-Sébastien Pedron <jean-sebastien@rabbitmq.com> [#136346167] This commit is cherry-picked from `master` because rabbit_common now depends on recon: having rabbit_common depend on 3rd-party applications didn't happen so far in stable and wasn't supported. This broke the creation of the standalone package. (cherry picked from commit cbbcc3e32f97b6047b4f82f0776717dd3e85430c)
-rw-r--r--Makefile2
-rw-r--r--src/rabbit_plugins.erl25
2 files changed, 21 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 5b204cf876..cb7d07e650 100644
--- a/Makefile
+++ b/Makefile
@@ -114,7 +114,7 @@ define PROJECT_ENV
]
endef
-LOCAL_DEPS = sasl mnesia os_mon xmerl
+LOCAL_DEPS = sasl mnesia os_mon
DEPS = ranch rabbit_common
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index 10906575f1..f5f249185f 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -418,16 +418,31 @@ remove_duplicate_plugins([Plugin|Rest], {Plugins0, Problems0}) ->
maybe_keep_required_deps(true, Plugins) ->
Plugins;
maybe_keep_required_deps(false, Plugins) ->
- %% We load the "rabbit" application to be sure we can get the
- %% "applications" key. This is required for rabbitmq-plugins for
- %% instance.
- application:load(rabbit),
- {ok, RabbitDeps} = application:get_key(rabbit, applications),
+ RabbitDeps = list_all_deps([rabbit]),
lists:filter(fun(#plugin{name = Name}) ->
not lists:member(Name, RabbitDeps)
end,
Plugins).
+list_all_deps(Applications) ->
+ list_all_deps(Applications, []).
+
+list_all_deps([Application | Applications], Deps) ->
+ %% We load the application to be sure we can get the "applications" key.
+ %% This is required for rabbitmq-plugins for instance.
+ application:load(Application),
+ NewDeps = [Application | Deps],
+ case application:get_key(Application, applications) of
+ {ok, ApplicationDeps} ->
+ RemainingApplications0 = ApplicationDeps ++ Applications,
+ RemainingApplications = RemainingApplications0 -- NewDeps,
+ list_all_deps(RemainingApplications, NewDeps);
+ undefined ->
+ list_all_deps(Applications, NewDeps)
+ end;
+list_all_deps([], Deps) ->
+ Deps.
+
remove_otp_overrideable_plugins(Plugins) ->
lists:filter(fun(P) -> not plugin_provided_by_otp(P) end,
Plugins).