diff options
Diffstat (limited to 'lib/reltool')
-rw-r--r-- | lib/reltool/doc/src/reltool.xml | 2 | ||||
-rw-r--r-- | lib/reltool/doc/src/reltool_examples.xml | 13 | ||||
-rw-r--r-- | lib/reltool/src/reltool.hrl | 3 | ||||
-rw-r--r-- | lib/reltool/src/reltool_server.erl | 14 | ||||
-rw-r--r-- | lib/reltool/src/reltool_target.erl | 27 | ||||
-rw-r--r-- | lib/reltool/test/reltool_server_SUITE.erl | 55 |
6 files changed, 83 insertions, 31 deletions
diff --git a/lib/reltool/doc/src/reltool.xml b/lib/reltool/doc/src/reltool.xml index 5afbad0ba8..136ec2ed69 100644 --- a/lib/reltool/doc/src/reltool.xml +++ b/lib/reltool/doc/src/reltool.xml @@ -503,6 +503,7 @@ sys() = {root_dir, root_dir()} | {incl_cond, incl_cond()} | {boot_rel, boot_rel()} | {rel, rel_name(), rel_vsn(), [rel_app()]} + | {rel, rel_name(), rel_vsn(), [rel_app()], [rel_opt()]} | {relocatable, relocatable()} | {app_file, app_file()} | {debug_info, debug_info()} @@ -534,6 +535,7 @@ rel_app() = app_name() | {app_name(), app_type()} | {app_name(), [incl_app()]} | {app_name(), app_type(), [incl_app()]} +rel_opt() = {load_dot_erlang, boolean()} app_name() = atom() app_type() = permanent | transient | temporary | load | none app_vsn() = string() diff --git a/lib/reltool/doc/src/reltool_examples.xml b/lib/reltool/doc/src/reltool_examples.xml index 2a103119e6..3888b643a2 100644 --- a/lib/reltool/doc/src/reltool_examples.xml +++ b/lib/reltool/doc/src/reltool_examples.xml @@ -160,7 +160,7 @@ Eshell V9.0 (abort with ^G) {mod,erts_internal,[]}, {mod,erts_literal_area_collector,[]}, {mod,init,[]}, - {mod,otp_ring0,...}, + {mod,erl_init,...}, {mod,...}, {...}|...]}]}, {app,compiler, @@ -313,9 +313,12 @@ Erlang/OTP 20 [erts-10.0] [source-c13b302] [64-bit] [smp:4:4] [ds:4:4:10] [async [hipe] [kernel-poll:false] Eshell V10.0 (abort with ^G) 1> -1> {ok, Server} = reltool:start_server([{config, {sys, [{boot_rel, "NAME"}, - {rel, "NAME", "VSN", - [sasl]}]}}]). +1> {ok, Server} = reltool:start_server([{config, + {sys, + [{boot_rel, "NAME"}, + {rel, "NAME", "VSN", + [sasl], + [{load_dot_erlang, false}]}]}}]). {ok,<0.1288.0>} 2> 2> reltool:get_config(Server). @@ -331,7 +334,7 @@ Eshell V10.0 (abort with ^G) {ok,{script,{"NAME","VSN"}, [{preLoaded,[erl_prim_loader,erl_tracer,erlang, erts_code_purger,erts_dirty_process_signal_handler, - erts_internal,erts_literal_area_collector,init,otp_ring0, + erts_internal,erts_literal_area_collector,init,erl_init, prim_eval,prim_file,prim_inet,prim_zip,zlib]}, {progress,preloaded}, {path,["$ROOT/lib/kernel-5.2/ebin", diff --git a/lib/reltool/src/reltool.hrl b/lib/reltool/src/reltool.hrl index d133762818..892aaf8649 100644 --- a/lib/reltool/src/reltool.hrl +++ b/lib/reltool/src/reltool.hrl @@ -61,6 +61,7 @@ | {app_name(), app_type()} | {app_name(), [incl_app()]} | {app_name(), app_type(), [incl_app()]}. +-type rel_opt() :: {load_dot_erlang, boolean()}. -type mod() :: {incl_cond, incl_cond()} | {debug_info, debug_info()}. -type app() :: {vsn, app_vsn()} @@ -92,6 +93,8 @@ | {lib_dirs, [lib_dir()]} | {boot_rel, boot_rel()} | {rel, rel_name(), rel_vsn(), [rel_app()]} + | {rel, rel_name(), rel_vsn(), + [rel_app()], [rel_opt()]} | {relocatable, relocatable()} | {erts, app()} | {escript, escript_file(), [escript()]} diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl index af71b0cf2a..2de8000fd8 100644 --- a/lib/reltool/src/reltool_server.erl +++ b/lib/reltool/src/reltool_server.erl @@ -526,7 +526,7 @@ analyse(#state{sys=Sys} = S, Apps, Status) -> %% is included in a release (rel spec - see apps_in_rels above). %% Then initiate the same for each module, and check that there %% are no duplicated module names (in different applications) - %% where we can not decide which one to use. + %% where we cannot decide which one to use. %% Write all #app to app_tab and all #mod to mod_tab. Status2 = apps_init_is_included(S, Apps, RelApps, Status), @@ -1483,6 +1483,18 @@ decode(#sys{rels = Rels} = Sys, [{rel, Name, Vsn, RelApps} | SysKeyVals]) Rel = #rel{name = Name, vsn = Vsn, rel_apps = []}, Rel2 = decode(Rel, RelApps), decode(Sys#sys{rels = [Rel2 | Rels]}, SysKeyVals); +decode(#sys{rels = Rels} = Sys, [{rel, Name, Vsn, RelApps, Opts} | SysKeyVals]) + when is_list(Name), is_list(Vsn), is_list(RelApps), is_list(Opts) -> + Rel1 = lists:foldl(fun(Opt, Rel0) -> + case Opt of + {load_dot_erlang, Value} when is_boolean(Value) -> + Rel0#rel{load_dot_erlang = Value}; + _ -> + reltool_utils:throw_error("Illegal rel option: ~tp", [Opt]) + end + end, #rel{name = Name, vsn = Vsn, rel_apps = []}, Opts), + Rel2 = decode(Rel1, RelApps), + decode(Sys#sys{rels = [Rel2 | Rels]}, SysKeyVals); decode(#sys{} = Sys, [{Key, Val} | KeyVals]) -> Sys3 = case Key of diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl index 64834ecc1d..dfa62479a0 100644 --- a/lib/reltool/src/reltool_target.erl +++ b/lib/reltool/src/reltool_target.erl @@ -108,12 +108,8 @@ do_gen_config(#sys{root_dir = RootDir, emit(incl_cond, A#app.incl_cond, undefined, InclDefs)} || A <- Apps, A#app.is_escript], DefaultRels = reltool_utils:default_rels(), - RelsItems = - [{rel, R#rel.name, R#rel.vsn, do_gen_config(R, InclDefs)} || - R <- Rels], - DefaultRelsItems = - [{rel, R#rel.name, R#rel.vsn, do_gen_config(R, InclDefs)} || - R <- DefaultRels], + RelsItems = [do_gen_config(R, InclDefs) || R <- Rels], + DefaultRelsItems = [do_gen_config(R, InclDefs) || R <- DefaultRels], RelsItems2 = case InclDefs of true -> RelsItems; @@ -201,11 +197,20 @@ do_gen_config(#mod{name = Name, _ -> [] end; -do_gen_config(#rel{name = _Name, - vsn = _Vsn, - rel_apps = RelApps}, - InclDefs) -> - [do_gen_config(RA, InclDefs) || RA <- RelApps]; +do_gen_config(#rel{name = Name, + vsn = Vsn, + rel_apps = RelApps, + load_dot_erlang = LoadDotErlang}, + InclDefs) -> + RelAppsConfig = [do_gen_config(RA, InclDefs) || RA <- RelApps], + if + LoadDotErlang =:= false -> + {rel, Name, Vsn, RelAppsConfig, [{load_dot_erlang, false}]}; + InclDefs =:= true -> + {rel, Name, Vsn, RelAppsConfig, [{load_dot_erlang, true}]}; + LoadDotErlang =:= true -> + {rel, Name, Vsn, RelAppsConfig} + end; do_gen_config(#rel_app{name = Name, app_type = Type, incl_apps = InclApps}, diff --git a/lib/reltool/test/reltool_server_SUITE.erl b/lib/reltool/test/reltool_server_SUITE.erl index 9ee61b595d..f11aae61c6 100644 --- a/lib/reltool/test/reltool_server_SUITE.erl +++ b/lib/reltool/test/reltool_server_SUITE.erl @@ -102,6 +102,7 @@ all() -> create_release, create_release_sort, create_script, + create_script_without_dot_erlang, create_script_sort, create_target, create_target_unicode, @@ -248,9 +249,9 @@ get_config(_Config) -> {app,stdlib,[{incl_cond,include},{vsn,undefined}, {lib_dir,StdLibDir}]}, {boot_rel,"start_clean"}, - {rel,"no_dot_erlang","1.0",[]}, - {rel,"start_clean","1.0",[]}, - {rel,"start_sasl","1.0",[sasl]}, + {rel,"no_dot_erlang","1.0",[],[{load_dot_erlang,false}]}, + {rel,"start_clean","1.0",[],[{load_dot_erlang,true}]}, + {rel,"start_sasl","1.0",[sasl],[{load_dot_erlang,true}]}, {emu_name,"beam"}, {relocatable,true}, {profile,development}, @@ -279,9 +280,9 @@ get_config(_Config) -> {app,stdlib,[{incl_cond,include},{vsn,StdVsn}, {lib_dir,StdLibDir},{mod,_,[]}|_]}, {boot_rel,"start_clean"}, - {rel,"no_dot_erlang","1.0",[]}, - {rel,"start_clean","1.0",[]}, - {rel,"start_sasl","1.0",[sasl]}, + {rel,"no_dot_erlang","1.0",[],[{load_dot_erlang,false}]}, + {rel,"start_clean","1.0",[],[{load_dot_erlang,true}]}, + {rel,"start_sasl","1.0",[sasl],[{load_dot_erlang,true}]}, {emu_name,"beam"}, {relocatable,true}, {profile,development}, @@ -549,6 +550,32 @@ create_script(_Config) -> ?m(equal, diff_script(OrigScript, Script)), + %% A release defaults to load_dot_erlang == true + {script, {RelName, RelVsn}, ScriptInstructions} = Script, + ?m(true, lists:member({apply,{c,erlangrc,[]}}, ScriptInstructions)), + + %% Stop server + ?m(ok, reltool:stop(Pid)), + ok. + +create_script_without_dot_erlang(_Config) -> + %% Configure the server + RelName = "Just testing", + RelVsn = "1.0", + Config = + {sys, + [ + {lib_dirs, []}, + {boot_rel, RelName}, + {rel, RelName, RelVsn, [stdlib, kernel], [{load_dot_erlang, false}]} + ]}, + {ok, Pid} = ?msym({ok, _}, reltool:start_server([{config, Config}])), + + %% Confirm that load_dot_erlang == false was used + {ok, Script} = ?msym({ok, _}, reltool:get_script(Pid, RelName)), + {script, {RelName, RelVsn}, ScriptInstructions} = Script, + ?m(false, lists:member({apply,{c,erlangrc,[]}}, ScriptInstructions)), + %% Stop server ?m(ok, reltool:stop(Pid)), ok. @@ -1039,7 +1066,7 @@ create_standalone_app(Config) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Generate standalone system with inlined archived application -%% Check that the inlined app can not be explicitly configured +%% Check that the inlined app cannot be explicitly configured create_standalone_app_clash(Config) -> %% Create archive @@ -1659,7 +1686,7 @@ set_apps_inlined(Config) -> ?m(true, Someapp1#app.is_included), ?m(true, Someapp1#app.is_pre_included), - %% Check that inlined app can not be configured + %% Check that inlined app cannot be configured Someapp2 = Someapp1#app{incl_cond=exclude}, ?msym({error, "Application someapp is inlined in '*escript* someapp'. " @@ -2107,9 +2134,9 @@ save_config(Config) -> {app,stdlib,[{incl_cond,include},{vsn,undefined}, {lib_dir,undefined}]}, {boot_rel,"start_clean"}, - {rel,"no_dot_erlang","1.0",[]}, - {rel,"start_clean","1.0",[]}, - {rel,"start_sasl","1.0",[sasl]}, + {rel,"no_dot_erlang","1.0",[],[{load_dot_erlang,false}]}, + {rel,"start_clean","1.0",[],[{load_dot_erlang,true}]}, + {rel,"start_sasl","1.0",[sasl],[{load_dot_erlang,true}]}, {emu_name,"beam"}, {relocatable,true}, {profile,development}, @@ -2148,9 +2175,9 @@ save_config(Config) -> {app,stdlib,[{incl_cond,include},{vsn,StdVsn}, {lib_dir,StdLibDir},{mod,_,[]}|_]}, {boot_rel,"start_clean"}, - {rel,"no_dot_erlang","1.0",[]}, - {rel,"start_clean","1.0",[]}, - {rel,"start_sasl","1.0",[sasl]}, + {rel,"no_dot_erlang","1.0",[],[{load_dot_erlang,false}]}, + {rel,"start_clean","1.0",[],[{load_dot_erlang,true}]}, + {rel,"start_sasl","1.0",[sasl],[{load_dot_erlang,true}]}, {emu_name,"beam"}, {relocatable,true}, {profile,development}, |