summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-09 16:57:04 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-09 16:57:04 +0100
commitb6f9070d915df799b3ad4342a8b73fda28133fd6 (patch)
tree44bc9014ee9e82c5a0c9eda75861d301bae328a2 /src
parent0896d9eba13a335b32195cc305e5d543643173e3 (diff)
downloadrabbitmq-server-git-b6f9070d915df799b3ad4342a8b73fda28133fd6.tar.gz
filter available applications from the dependency list
I.e. remove kernel, stdlib and the like.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_plugin.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_plugin.erl b/src/rabbit_plugin.erl
index f1f5ade3c5..9dc7d96f89 100644
--- a/src/rabbit_plugin.erl
+++ b/src/rabbit_plugin.erl
@@ -119,7 +119,8 @@ get_plugin_info(EZ) ->
{application, Name, Props} ->
Version = proplists:get_value(vsn, Props, "0"),
Description = proplists:get_value(description, Props, ""),
- Dependencies = proplists:get_value(applications, Props, []),
+ Dependencies =
+ filter_applications(proplists:get_value(applications, Props, [])),
#plugin{name = Name, version = Version, description = Description,
dependencies = Dependencies, location = EZ};
{error, Reason} ->
@@ -181,3 +182,13 @@ usort_plugins(Plugins) ->
plugins_cmp(#plugin{name = N1, version = V1}, #plugin{name = N2, version = V2}) ->
{N1, V1} =< {N2, V2}.
+
+%% Filter applications that can be loaded *right now*.
+filter_applications(Applications) ->
+ [Application || Application <- Applications,
+ case application:load(Application) of
+ {error, {already_loaded, _}} -> false;
+ ok -> application:unload(Application),
+ false;
+ _ -> true
+ end].