diff options
author | Siri Hansen <siri@erlang.org> | 2012-03-23 11:48:52 +0100 |
---|---|---|
committer | Siri Hansen <siri@erlang.org> | 2012-03-23 11:48:52 +0100 |
commit | b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa (patch) | |
tree | 0f4bce1eb128326affdaacaeb0b2de2ac19860f8 /lib | |
parent | fd89175a2b17e92a0b90cb28e5af2375d3aa4535 (diff) | |
parent | 38f068341ebf04e5d6bf5eff7fb01e44bce228b6 (diff) | |
download | otp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.tar.gz otp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.tar.bz2 otp-b13b88779b3fbc0ef8bb91a17a5d064cd778e0fa.zip |
Merge branch 'siri/reltool/app-level-lib-dir/OTP-9977' into maint
* siri/reltool/app-level-lib-dir/OTP-9977:
[reltool] Allow lib_dir on app level to use relative path
[reltool] Add configuration parameter lib_dir on application level
Diffstat (limited to 'lib')
15 files changed, 317 insertions, 53 deletions
diff --git a/lib/reltool/doc/src/reltool.xml b/lib/reltool/doc/src/reltool.xml index 696ab52e63..9a4e2d130e 100644 --- a/lib/reltool/doc/src/reltool.xml +++ b/lib/reltool/doc/src/reltool.xml @@ -322,8 +322,21 @@ <item> <p>The version of the application. In an installed system there may exist several versions of an application. The <c>vsn</c> parameter - controls which version of the application will be chosen. If it - is omitted, the latest version will be chosen.</p> + controls which version of the application will be chosen.</p> + <p>This parameter is mutual exclusive with <c>lib_dir</c>. If + <c>vsn</c> and <c>lib_dir</c> are both omitted, the latest version + will be chosen.</p> + </item> + <tag><c>lib_dir</c></tag> + <item> + <p>The directory to read the application from. This parameter + can be used to point out a specific location to fetch the + application from. This is useful for instance if the parent + directory for some reason is no good as a library directory on + system level.</p> + <p>This parameter is mutual exclusive with <c>vsn</c>. If + <c>vsn</c> and <c>lib_dir</c> are both omitted, the latest version + will be chosen.</p> </item> <tag><c>mod</c></tag> <item> @@ -433,6 +446,7 @@ sys() = {root_dir, root_dir()} | {excl_archive_filters, excl_archive_filters()} | {archive_opts, [archive_opt()]} app() = {vsn, app_vsn()} + | {lib_dir, lib_dir()} | {mod, mod_name(), [mod()]} | {mod_cond, mod_cond()} | {incl_cond, incl_cond()} diff --git a/lib/reltool/src/reltool.hrl b/lib/reltool/src/reltool.hrl index 4e5c5b2849..71d3b60a2b 100644 --- a/lib/reltool/src/reltool.hrl +++ b/lib/reltool/src/reltool.hrl @@ -63,6 +63,7 @@ -type mod() :: {incl_cond, incl_cond()} | {debug_info, debug_info()}. -type app() :: {vsn, app_vsn()} + | {lib_dir, lib_dir()} | {mod, mod_name(), [mod()]} | {mod_cond, mod_cond()} | {incl_cond, incl_cond()} @@ -169,7 +170,7 @@ { %% Static info name :: app_name(), is_escript :: boolean() | {inlined, escript_app_name()}, - use_selected_vsn :: boolean() | undefined, + use_selected_vsn :: vsn | dir | undefined, active_dir :: dir(), sorted_dirs :: [dir()], vsn :: app_vsn(), diff --git a/lib/reltool/src/reltool_app_win.erl b/lib/reltool/src/reltool_app_win.erl index e0acfab7aa..6cd0d2f90b 100644 --- a/lib/reltool/src/reltool_app_win.erl +++ b/lib/reltool/src/reltool_app_win.erl @@ -611,7 +611,7 @@ handle_event(#state{sys = Sys, app = App} = S, Wx) -> redraw_window(S2); #wx{userData = use_selected_vsn} -> %% Use selected version - App2 = App#app{use_selected_vsn = true}, + App2 = App#app{use_selected_vsn = dir}, {ok, App3} = reltool_sys_win:set_app(S#state.parent_pid, App2), S2 = S#state{app = App3}, redraw_window(S2); @@ -619,7 +619,8 @@ handle_event(#state{sys = Sys, app = App} = S, Wx) -> event = #wxCommand{type = command_radiobox_selected, cmdString = ActiveDir}} -> %% Change app source - S2 = change_version(S, App, ActiveDir), + App2 = App#app{use_selected_vsn = dir}, + S2 = change_version(S, App2, ActiveDir), redraw_window(S2); #wx{userData = {mod_button, Action, ListCtrl}, event = #wxCommand{type = command_button_clicked}} -> @@ -942,11 +943,11 @@ redraw_config(#state{sys = #sys{incl_cond = GlobalIncl, LatestRadio, SelectedRadio, SourceBox, - fun(true) -> + fun(false) -> + 0; + (_) -> reltool_utils:elem_to_index(ActiveDir, - SortedDirs) - 1; - (false) -> - 0 + SortedDirs) - 1 end). redraw_double_box(Global, Local, GlobalRadio, LocalRadio, LocalBox, GetChoice) -> diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl index c99180a613..034a42e1e2 100644 --- a/lib/reltool/src/reltool_server.erl +++ b/lib/reltool/src/reltool_server.erl @@ -486,15 +486,19 @@ app_set_config_only(Mods,#app{name = Name, vsn = Vsn, mods = Mods}, - %% Some fields shall only be set if it is an escript, e.g. label - %% must never be set for any other applications since that will - %% prevent refreshing. if IsEscript -> + %% Some fields shall only be set if it is an escript, e.g. label + %% must never be set for any other applications since that will + %% prevent refreshing. App#app{is_escript = IsEscript, active_dir = ActiveDir, sorted_dirs = SortedDirs, label = Label, info = Info}; + UseSelectedVsn =:= dir -> + %% Must not loose active_dir if it is configured to be used + App#app{active_dir = ActiveDir, + sorted_dirs = [ActiveDir]}; true -> App end. @@ -1280,11 +1284,11 @@ shrink_app(A) -> {Dir, Dirs, OptVsn} = case A#app.use_selected_vsn of undefined -> - {shrinked, [], undefined}; - false -> - {shrinked, [], undefined}; - true -> - {A#app.active_dir, [A#app.active_dir], A#app.vsn} + {undefined, [], undefined}; + vsn -> + {undefined, [], A#app.vsn}; + dir -> + {A#app.active_dir, [A#app.active_dir], undefined} end, A#app{active_dir = Dir, sorted_dirs = Dirs, @@ -1489,8 +1493,22 @@ decode(#app{} = App, [{Key, Val} | KeyVals]) -> dec_re(Key, Val, App#app.excl_archive_filters)}; archive_opts when is_list(Val) -> App#app{archive_opts = Val}; - vsn when is_list(Val) -> - App#app{use_selected_vsn = true, vsn = Val}; + vsn when is_list(Val), App#app.use_selected_vsn=:=undefined -> + App#app{use_selected_vsn = vsn, vsn = Val}; + lib_dir when is_list(Val), App#app.use_selected_vsn=:=undefined -> + case filelib:is_dir(Val) of + true -> + Dir = reltool_utils:normalize_dir(Val), + App#app{use_selected_vsn = dir, + active_dir = Dir, + sorted_dirs = [Dir]}; + false -> + reltool_utils:throw_error("Illegal lib dir for ~p: ~p", + [App#app.name, Val]) + end; + SelectVsn when SelectVsn=:=vsn; SelectVsn=:=lib_dir -> + reltool_utils:throw_error("Mutual exclusive options " + "'vsn' and 'lib_dir'",[]); _ -> reltool_utils:throw_error("Illegal option: ~p", [{Key, Val}]) end, @@ -1838,7 +1856,10 @@ merge_app_dirs([{Name, Dir} | Rest], Apps) -> merge_app_dirs([], Apps) -> set_active_dirs(Apps). -%% First dir, i.e. the one with highest version, is set to active dir +%% First dir, i.e. the one with highest version, is set to active dir, +%% unless a specific dir is given in config +set_active_dirs([#app{use_selected_vsn = dir} = App | Apps]) -> + [App | set_active_dirs(Apps)]; set_active_dirs([#app{sorted_dirs = [ActiveDir|_]} = App | Apps]) -> [App#app{active_dir = ActiveDir} | set_active_dirs(Apps)]; set_active_dirs([#app{sorted_dirs = []} = App | Apps]) -> @@ -1902,6 +1923,8 @@ ensure_app_info(#app{name = Name, sorted_dirs = []}, _Status) -> reltool_utils:throw_error("~p: : Missing application directory.",[Name]); ensure_app_info(#app{name = Name, vsn = Vsn, + use_selected_vsn = UseSelectedVsn, + active_dir = ActiveDir, sorted_dirs = Dirs, info = undefined}, Status) -> @@ -1929,19 +1952,28 @@ ensure_app_info(#app{name = Name, FirstInfo = hd(AllInfo), FirstDir = hd(Dirs), if - Vsn =:= undefined -> - {FirstInfo, FirstDir, Status3}; - Vsn =:= FirstInfo#app_info.vsn -> - {FirstInfo, FirstDir, Status3}; - true -> - case find_vsn(Vsn, AllInfo, Dirs) of - {Info, VsnDir} -> - {Info, VsnDir, Status3}; - false -> - reltool_utils:throw_error( - "~p: No application directory contains selected version ~p", - [Name,Vsn]) - end + UseSelectedVsn =:= dir -> + if ActiveDir =:= FirstDir -> + {FirstInfo, FirstDir, Status3}; + true -> + Info = find_dir(ActiveDir, AllInfo, Dirs), + {Info, ActiveDir, Status3} + end; + UseSelectedVsn =:= vsn -> + if Vsn =:= FirstInfo#app_info.vsn -> + {FirstInfo, FirstDir, Status3}; + true -> + case find_vsn(Vsn, AllInfo, Dirs) of + {Info, VsnDir} -> + {Info, VsnDir, Status3}; + false -> + reltool_utils:throw_error( + "~p: No application directory contains " + "selected version ~p", [Name,Vsn]) + end + end; + true -> + {FirstInfo, FirstDir, Status3} end; ensure_app_info(#app{active_dir = Dir, info = Info}, Status) -> {Info, Dir, Status}. @@ -1953,6 +1985,11 @@ find_vsn(Vsn, [_ | MoreInfo], [_ | MoreDirs]) -> find_vsn(_, [], []) -> false. +find_dir(Dir, [Info | _], [Dir | _]) -> + Info; +find_dir(Dir, [_ | MoreInfo], [_ | MoreDirs]) -> + find_dir(Dir, MoreInfo, MoreDirs). + get_base(Name, Dir) -> case Name of erts -> diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl index 44f1977ad6..e3a7b02143 100644 --- a/lib/reltool/src/reltool_target.erl +++ b/lib/reltool/src/reltool_target.erl @@ -155,6 +155,7 @@ do_gen_config(#app{name = Name, archive_opts = ArchiveOpts, use_selected_vsn = UseSelected, vsn = Vsn, + active_dir = ActiveDir, mods = Mods, is_included = IsIncl}, InclDefs) -> @@ -170,9 +171,10 @@ do_gen_config(#app{name = Name, emit(excl_archive_filters, ExclArchiveDirs, undefined, InclDefs), emit(archive_opts, ArchiveOpts, undefined, InclDefs), if - IsIncl, InclDefs -> [{vsn, Vsn}]; - UseSelected -> [{vsn, Vsn}]; - true -> [] + IsIncl, InclDefs -> [{vsn, Vsn}, {lib_dir, ActiveDir}]; + UseSelected =:= vsn -> [{vsn, Vsn}]; + UseSelected =:= dir -> [{lib_dir, ActiveDir}]; + true -> [] end, [do_gen_config(M, InclDefs) || M <- Mods] ], diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl index b0def45213..6149d6ef06 100644 --- a/lib/reltool/src/reltool_utils.erl +++ b/lib/reltool/src/reltool_utils.erl @@ -22,6 +22,7 @@ -export([root_dir/0, erl_libs/0, lib_dirs/1, split_app_name/1, prim_consult/1, default_rels/0, choose_default/3, + normalize_dir/1, assign_image_list/1, get_latest_resize/1, wait_for_stop_motion/2, mod_conds/0, list_to_mod_cond/1, mod_cond_to_index/1, @@ -87,6 +88,21 @@ split_app_name(Name) -> {list_to_atom(Name), ""} end. + +normalize_dir(RelDir) -> + Tokens = filename:split(filename:absname(RelDir)), + filename:join(lists:reverse(normalize_dir(Tokens, []))). + +normalize_dir([".."|Dirs], [_Dir|Path]) -> + normalize_dir(Dirs, Path); +normalize_dir(["."|Dirs], Path) -> + normalize_dir(Dirs, Path); +normalize_dir([Dir|Dirs], Path) -> + normalize_dir(Dirs, [Dir|Path]); +normalize_dir([], Path) -> + Path. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prim_consult(Bin) when is_binary(Bin) -> @@ -256,7 +272,7 @@ app_dir_test(Dir1, Dir2) -> Name1 > Name2 -> false; Vsn1 < Vsn2 -> false; Vsn1 > Vsn2 -> true; - Parent1 < Parent2 -> true; + Parent1 =< Parent2 -> true; true -> false end. diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index 4e24a2fb55..8a98dc36cf 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -88,7 +88,9 @@ all() -> reset_config_and_undo, gen_rel_files, save_config, - dependencies]. + dependencies, + use_selected_vsn, + use_selected_vsn_relative_path]. groups() -> []. @@ -150,10 +152,15 @@ get_config(_Config) -> StdVsn = latest(stdlib), SaslVsn = latest(sasl), + LibDir = code:lib_dir(), + KLibDir = filename:join(LibDir,"kernel-"++KVsn), + StdLibDir = filename:join(LibDir,"stdlib-"++StdVsn), + SaslLibDir = filename:join(LibDir,"sasl-"++SaslVsn), + Sys = {sys,[{incl_cond, exclude}, {app,kernel,[{incl_cond,include}]}, {app,sasl,[{incl_cond,include},{vsn,SaslVsn}]}, - {app,stdlib,[{incl_cond,include}]}]}, + {app,stdlib,[{incl_cond,include},{lib_dir,StdLibDir}]}]}, {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Sys}])), ?m({ok, Sys}, reltool:get_config(Pid)), ?m({ok, Sys}, reltool:get_config(Pid,false,false)), @@ -163,7 +170,8 @@ get_config(_Config) -> {erts,[]}, {app,kernel,[{incl_cond,include},{mod,_,[]}|_]}, {app,sasl,[{incl_cond,include},{vsn,SaslVsn},{mod,_,[]}|_]}, - {app,stdlib,[{incl_cond,include},{mod,_,[]}|_]}]}}, + {app,stdlib,[{incl_cond,include},{lib_dir,StdLibDir}, + {mod,_,[]}|_]}]}}, reltool:get_config(Pid,false,true)), %% Include defaults @@ -171,9 +179,12 @@ get_config(_Config) -> {lib_dirs,_}, {mod_cond,all}, {incl_cond,exclude}, - {app,kernel,[{incl_cond,include},{vsn,undefined}]}, - {app,sasl,[{incl_cond,include},{vsn,SaslVsn}]}, - {app,stdlib,[{incl_cond,include},{vsn,undefined}]}, + {app,kernel,[{incl_cond,include},{vsn,undefined}, + {lib_dir,undefined}]}, + {app,sasl,[{incl_cond,include},{vsn,SaslVsn}, + {lib_dir,undefined}]}, + {app,stdlib,[{incl_cond,include},{vsn,undefined}, + {lib_dir,StdLibDir}]}, {boot_rel,"start_clean"}, {rel,"start_clean","1.0",[]}, {rel,"start_sasl","1.0",[sasl]}, @@ -198,9 +209,12 @@ get_config(_Config) -> {mod_cond,all}, {incl_cond,exclude}, {erts,[]}, - {app,kernel,[{incl_cond,include},{vsn,KVsn},{mod,_,[]}|_]}, - {app,sasl,[{incl_cond,include},{vsn,SaslVsn},{mod,_,[]}|_]}, - {app,stdlib,[{incl_cond,include},{vsn,StdVsn},{mod,_,[]}|_]}, + {app,kernel,[{incl_cond,include},{vsn,KVsn}, + {lib_dir,KLibDir},{mod,_,[]}|_]}, + {app,sasl,[{incl_cond,include},{vsn,SaslVsn}, + {lib_dir,SaslLibDir},{mod,_,[]}|_]}, + {app,stdlib,[{incl_cond,include},{vsn,StdVsn}, + {lib_dir,StdLibDir},{mod,_,[]}|_]}, {boot_rel,"start_clean"}, {rel,"start_clean","1.0",[]}, {rel,"start_sasl","1.0",[sasl]}, @@ -1804,9 +1818,12 @@ save_config(Config) -> {lib_dirs,_}, {mod_cond,all}, {incl_cond,exclude}, - {app,kernel,[{incl_cond,include},{vsn,undefined}]}, - {app,sasl,[{incl_cond,include},{vsn,undefined}]}, - {app,stdlib,[{incl_cond,include},{vsn,undefined}]}, + {app,kernel,[{incl_cond,include},{vsn,undefined}, + {lib_dir,undefined}]}, + {app,sasl,[{incl_cond,include},{vsn,undefined}, + {lib_dir,undefined}]}, + {app,stdlib,[{incl_cond,include},{vsn,undefined}, + {lib_dir,undefined}]}, {boot_rel,"start_clean"}, {rel,"start_clean","1.0",[]}, {rel,"start_sasl","1.0",[sasl]}, @@ -1827,6 +1844,12 @@ save_config(Config) -> KVsn = latest(kernel), StdVsn = latest(stdlib), + SaslVsn = latest(sasl), + + LibDir = code:lib_dir(), + KLibDir = filename:join(LibDir,"kernel-"++KVsn), + StdLibDir = filename:join(LibDir,"stdlib-"++StdVsn), + SaslLibDir = filename:join(LibDir,"sasl-"++SaslVsn), All = filename:join(PrivDir,"save_all.reltool"), ?m(ok, reltool_server:save_config(Pid,All,true,true)), @@ -1835,9 +1858,12 @@ save_config(Config) -> {mod_cond,all}, {incl_cond,exclude}, {erts,[]}, - {app,kernel,[{incl_cond,include},{vsn,KVsn},{mod,_,[]}|_]}, - {app,sasl,[{incl_cond,include},{vsn,_},{mod,_,[]}|_]}, - {app,stdlib,[{incl_cond,include},{vsn,StdVsn},{mod,_,[]}|_]}, + {app,kernel,[{incl_cond,include},{vsn,KVsn}, + {lib_dir,KLibDir},{mod,_,[]}|_]}, + {app,sasl,[{incl_cond,include},{vsn,SaslVsn}, + {lib_dir,SaslLibDir},{mod,_,[]}|_]}, + {app,stdlib,[{incl_cond,include},{vsn,StdVsn}, + {lib_dir,StdLibDir},{mod,_,[]}|_]}, {boot_rel,"start_clean"}, {rel,"start_clean","1.0",[]}, {rel,"start_sasl","1.0",[sasl]}, @@ -1996,6 +2022,132 @@ dependencies(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +use_selected_vsn(Config) -> + LibDir1 = filename:join(datadir(Config),"use_selected_vsn"), + B1Dir = filename:join(LibDir1,"b-1.0"), + B3Dir = filename:join(LibDir1,"b-3.0"), + + LibDir2 = filename:join(LibDir1,"lib2"), + B2Dir = filename:join(LibDir2,"b-2.0"), + + %%----------------------------------------------------------------- + %% Pre-selected vsn of app b + Sys1 = {sys,[{lib_dirs,[LibDir1]}, + {incl_cond, exclude}, + {app,kernel,[{incl_cond,include}]}, + {app,sasl,[{incl_cond,include}]}, + {app,stdlib,[{incl_cond,include}]}, + {app,b,[{incl_cond,include},{vsn,"1.0"}]}]}, + {ok, Pid1} = ?msym({ok, _}, reltool:start_server([{config, Sys1}])), + {ok,B11} = ?msym({ok,#app{vsn="1.0",active_dir=B1Dir}}, + reltool_server:get_app(Pid1,b)), + + %% Change from a pre-selected vsn to use a specific dir + ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []}, + reltool_server:set_app(Pid1, + B11#app{active_dir = B3Dir, + use_selected_vsn = dir, + label = undefined, + vsn = undefined, + info = undefined})), + ?m(ok, reltool:stop(Pid1)), + + + %%----------------------------------------------------------------- + %% Pre-selected vsn of app b + Sys2 = {sys,[{lib_dirs,[LibDir1]}, + {incl_cond, exclude}, + {app,kernel,[{incl_cond,include}]}, + {app,sasl,[{incl_cond,include}]}, + {app,stdlib,[{incl_cond,include}]}, + {app,b,[{incl_cond,include},{vsn,"1.0"}]}]}, + {ok, Pid2} = ?msym({ok, _}, reltool:start_server([{config, Sys2}])), + {ok,B21} = ?msym({ok,#app{vsn="1.0",active_dir=B1Dir}}, + reltool_server:get_app(Pid2,b)), + + %% Change from a pre-selected vsn to use latest + ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []}, + reltool_server:set_app(Pid2, + B21#app{use_selected_vsn=undefined, + label = undefined, + vsn = undefined, + info = undefined})), + ?m(ok, reltool:stop(Pid2)), + + + %%----------------------------------------------------------------- + %% Pre-selected directory for app b + Sys3 = {sys,[{lib_dirs,[LibDir1]}, + {incl_cond, exclude}, + {app,kernel,[{incl_cond,include}]}, + {app,sasl,[{incl_cond,include}]}, + {app,stdlib,[{incl_cond,include}]}, + {app,b,[{incl_cond,include},{lib_dir,B2Dir}]}]}, + {ok, Pid3} = ?msym({ok, _}, reltool:start_server([{config, Sys3}])), +% test_server:break("Pid3 = list_to_pid(\""++pid_to_list(Pid3)++"\")."), + {ok,B31} = ?msym({ok,#app{vsn="2.0",active_dir=B2Dir}}, + reltool_server:get_app(Pid3,b)), + %% Change from a pre-selected dir to use latest + {ok,B32,_} = ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []}, + reltool_server:set_app(Pid3, + B31#app{use_selected_vsn=undefined, + label = undefined, + vsn = undefined, + info = undefined})), + %% Change back to use selected dir + {ok,B33,_} = ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []}, + reltool_server:set_app(Pid3, + B32#app{use_selected_vsn = dir})), + %% use dir 1 + {ok,B34,_} = ?msym({ok, #app{vsn ="1.0", active_dir = B1Dir}, []}, + reltool_server:set_app(Pid3, + B33#app{active_dir = B1Dir, + label = undefined, + vsn = undefined, + info = undefined})), + %% use dir 2 + {ok,B35,_} = ?msym({ok, #app{vsn ="2.0", active_dir = B2Dir}, []}, + reltool_server:set_app(Pid3, + B34#app{active_dir = B2Dir, + label = undefined, + vsn = undefined, + info = undefined})), + %% use dir 3 + ?msym({ok, #app{vsn ="3.0", active_dir = B3Dir}, []}, + reltool_server:set_app(Pid3, + B35#app{active_dir = B3Dir, + label = undefined, + vsn = undefined, + info = undefined})), + ?m(ok, reltool:stop(Pid3)), + ok. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +use_selected_vsn_relative_path(Config) -> + LibDir = filename:join([datadir(Config),"use_selected_vsn","b-1.0"]), + RelDir = filename:join(LibDir,"rel"), + + {ok,Cwd} = file:get_cwd(), + ok = file:set_cwd(RelDir), + + Sys = {sys,[{incl_cond, exclude}, + {app,kernel,[{incl_cond,include}]}, + {app,sasl,[{incl_cond,include}]}, + {app,stdlib,[{incl_cond,include}]}, + {app,b,[{incl_cond,include},{lib_dir,".."}]}]}, + {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Sys}])), + + ?msym({ok,#app{vsn="1.0",active_dir=LibDir}},reltool_server:get_app(Pid,b)), + + ?m(ok, reltool:stop(Pid)), + + ok = file:set_cwd(Cwd), + ok. + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Library functions erl_libs() -> diff --git a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src index 8ab077d64b..21410ceaa9 100644 --- a/lib/reltool/test/reltool_server_SUITE_data/Makefile.src +++ b/lib/reltool/test/reltool_server_SUITE_data/Makefile.src @@ -17,8 +17,12 @@ DEPENDENCIES= \ ESCRIPT= \ escript/someapp-1.0/ebin/mymod.@EMULATOR@ +SEL_VSN= \ + use_selected_vsn/b-1.0/ebin/b.@EMULATOR@ \ + use_selected_vsn/b-3.0/ebin/b.@EMULATOR@ \ + use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@ -all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT) +all: $(OTP9229) $(DEPENDENCIES) $(ESCRIPT) $(SEL_VSN) otp_9229/x-1.0/ebin/x.@EMULATOR@: otp_9229/x-1.0/src/x.erl erlc $(EFLAGS) -ootp_9229/x-1.0/ebin otp_9229/x-1.0/src/x.erl @@ -44,3 +48,10 @@ dependencies/z-1.0/ebin/z1.@EMULATOR@: dependencies/z-1.0/src/z1.erl escript/someapp-1.0/ebin/mymod.@EMULATOR@: escript/someapp-1.0/src/mymod.erl erlc $(EFLAGS) -oescript/someapp-1.0/ebin escript/someapp-1.0/src/mymod.erl + +use_selected_vsn/b-1.0/ebin/b.@EMULATOR@: use_selected_vsn/b-1.0/src/b.erl + erlc $(EFLAGS) -ouse_selected_vsn/b-1.0/ebin use_selected_vsn/b-1.0/src/b.erl +use_selected_vsn/b-3.0/ebin/b.@EMULATOR@: use_selected_vsn/b-3.0/src/b.erl + erlc $(EFLAGS) -ouse_selected_vsn/b-3.0/ebin use_selected_vsn/b-3.0/src/b.erl +use_selected_vsn/lib2/b-2.0/ebin/b.@EMULATOR@: use_selected_vsn/lib2/b-2.0/src/b.erl + erlc $(EFLAGS) -ouse_selected_vsn/lib2/b-2.0/ebin use_selected_vsn/lib2/b-2.0/src/b.erl diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app new file mode 100644 index 0000000000..c511dcc8f1 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/ebin/b.app @@ -0,0 +1,6 @@ +%% -*- erlang -*- +{application, b, + [{description, "Reltool test app for using selected version of app"}, + {vsn, "1.0"}, + {modules, [b]}, + {applications, [kernel, stdlib]}]}. diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/rel/.gitignore diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl new file mode 100644 index 0000000000..a6b4ff1c05 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-1.0/src/b.erl @@ -0,0 +1,4 @@ +-module(b). +-compile(export_all). + +foo() -> ok. diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app new file mode 100644 index 0000000000..9ed7695a40 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/ebin/b.app @@ -0,0 +1,6 @@ +%% -*- erlang -*- +{application, b, + [{description, "Reltool test app for using selected version of app"}, + {vsn, "3.0"}, + {modules, [b]}, + {applications, [kernel, stdlib]}]}. diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl new file mode 100644 index 0000000000..a6b4ff1c05 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/b-3.0/src/b.erl @@ -0,0 +1,4 @@ +-module(b). +-compile(export_all). + +foo() -> ok. diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app new file mode 100644 index 0000000000..33c633d635 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/ebin/b.app @@ -0,0 +1,6 @@ +%% -*- erlang -*- +{application, b, + [{description, "Reltool test app for using selected version of app"}, + {vsn, "2.0"}, + {modules, [b]}, + {applications, [kernel, stdlib]}]}. diff --git a/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl new file mode 100644 index 0000000000..a6b4ff1c05 --- /dev/null +++ b/lib/reltool/test/reltool_server_SUITE_data/use_selected_vsn/lib2/b-2.0/src/b.erl @@ -0,0 +1,4 @@ +-module(b). +-compile(export_all). + +foo() -> ok. |