aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/release_handler.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-11-18 11:19:08 +0100
committerHenrik Nord <[email protected]>2011-11-18 11:19:13 +0100
commit2e6181a106f0dfd1b588b9aeb408e5883a662c76 (patch)
tree0d7557676b23fae6743e43dece7697619b74f589 /lib/sasl/src/release_handler.erl
parent83c82e2a2f2e13e748460ed7fcdfb87482f9fe21 (diff)
parent66be346a3b0f04bb010608ad6125ecec501384c2 (diff)
downloadotp-2e6181a106f0dfd1b588b9aeb408e5883a662c76.tar.gz
otp-2e6181a106f0dfd1b588b9aeb408e5883a662c76.tar.bz2
otp-2e6181a106f0dfd1b588b9aeb408e5883a662c76.zip
Merge branch 'jw/release_handler-which-releases'
* jw/release_handler-which-releases: Add release_handler:which_releases/1 OTP-9717
Diffstat (limited to 'lib/sasl/src/release_handler.erl')
-rw-r--r--lib/sasl/src/release_handler.erl22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/sasl/src/release_handler.erl b/lib/sasl/src/release_handler.erl
index bc08f94dff..5650f1433d 100644
--- a/lib/sasl/src/release_handler.erl
+++ b/lib/sasl/src/release_handler.erl
@@ -27,7 +27,8 @@
unpack_release/1,
check_install_release/1, check_install_release/2,
install_release/1, install_release/2, remove_release/1,
- which_releases/0, make_permanent/1, reboot_old_release/1,
+ which_releases/0, which_releases/1, make_permanent/1,
+ reboot_old_release/1,
set_unpacked/2, set_removed/1, install_file/2]).
-export([upgrade_app/2, downgrade_app/2, downgrade_app/3,
upgrade_script/2, downgrade_script/3,
@@ -305,6 +306,14 @@ which_releases() ->
call(which_releases).
%%-----------------------------------------------------------------
+%% Returns: [{Name, Vsn, [LibName], Status}]
+%% Status = unpacked | current | permanent | old
+%%-----------------------------------------------------------------
+which_releases(Status) ->
+ Releases = which_releases(),
+ get_releases_with_status(Releases, Status, []).
+
+%%-----------------------------------------------------------------
%% check_script(Script, LibDirs) -> ok | {error, Reason}
%%-----------------------------------------------------------------
check_script(Script, LibDirs) ->
@@ -2010,3 +2019,14 @@ get_new_libs([{App,Vsn,_LibDir}|CurrentLibs], NewLibs) ->
end;
get_new_libs([],_) ->
[].
+
+%%-----------------------------------------------------------------
+%% Return a list of releases witch a specific status
+%%-----------------------------------------------------------------
+get_releases_with_status([], _, Acc) ->
+ Acc;
+get_releases_with_status([ {_, _, _, ReleaseStatus } = Head | Tail],
+ Status, Acc) when ReleaseStatus == Status ->
+ get_releases_with_status(Tail, Status, [Head | Acc]);
+get_releases_with_status([_ | Tail], Status, Acc) ->
+ get_releases_with_status(Tail, Status, Acc).