aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkan Mattsson <[email protected]>2010-04-01 10:37:29 +0200
committerHåkan Mattsson <[email protected]>2010-04-19 13:17:33 +0200
commit21db0d0e7e7112d7c257ed19fc8e3c0a90d4698b (patch)
tree602a79bd3db23d792a621e7c5d063c51788ca5bb
parentbc5807db3a4bb72395da7d32f4bee4a4678e8bfe (diff)
downloadotp-21db0d0e7e7112d7c257ed19fc8e3c0a90d4698b.tar.gz
otp-21db0d0e7e7112d7c257ed19fc8e3c0a90d4698b.tar.bz2
otp-21db0d0e7e7112d7c257ed19fc8e3c0a90d4698b.zip
Introduced a new embedded_app_type option
It is for embedded systems where all included applications must be loaded from the boot script. If embedded_app_type is set to something else than undefined all included applications will be included in both the "rel" as well as in the "script".
-rw-r--r--lib/reltool/src/reltool.hrl11
-rw-r--r--lib/reltool/src/reltool_mod_win.erl4
-rw-r--r--lib/reltool/src/reltool_server.erl44
-rw-r--r--lib/reltool/src/reltool_sys_win.erl2
-rw-r--r--lib/reltool/src/reltool_target.erl73
5 files changed, 81 insertions, 53 deletions
diff --git a/lib/reltool/src/reltool.hrl b/lib/reltool/src/reltool.hrl
index b3f06e8753..7c9f519878 100644
--- a/lib/reltool/src/reltool.hrl
+++ b/lib/reltool/src/reltool.hrl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
-define(APPLICATION, reltool).
--define(MISSING_APP, '*MISSING*').
+-define(MISSING_APP_NAME, '*MISSING*').
-define(MISSING_APP_TEXT, "*MISSING*").
-type file() :: string().
@@ -187,7 +187,7 @@
%% Static target cond
debug_info :: debug_info() | undefined,
app_file :: app_file() | undefined,
- app_type :: app_type(),
+ app_type :: app_type() | undefined,
incl_app_filters :: incl_app_filters(),
excl_app_filters :: excl_app_filters(),
incl_archive_filters :: incl_archive_filters(),
@@ -242,7 +242,8 @@
excl_archive_filters :: excl_archive_filters(),
archive_opts :: [archive_opt()],
relocatable :: boolean(),
- app_type :: app_type(),
+ rel_app_type :: app_type(),
+ embedded_app_type :: app_type() | undefined,
app_file :: app_file(),
debug_info :: debug_info()
}).
@@ -267,7 +268,8 @@
-define(DEFAULT_EMU_NAME, "beam").
-define(DEFAULT_PROFILE, development).
-define(DEFAULT_RELOCATABLE, true).
--define(DEFAULT_APP_TYPE, permanent).
+-define(DEFAULT_REL_APP_TYPE, permanent).
+-define(DEFAULT_EMBEDDED_APP_TYPE, undefined).
-define(DEFAULT_APP_FILE, keep).
-define(DEFAULT_DEBUG_INFO, keep).
@@ -292,6 +294,7 @@
"^priv",
"^include"]).
-define(EMBEDDED_EXCL_APP_FILTERS, []).
+-define(EMBEDDED_APP_TYPE, load).
-define(STANDALONE_INCL_SYS_FILTERS, ["^bin/(erl|epmd)(|\\.exe|\\.ini)\$",
"^bin/start(|_clean).boot\$",
diff --git a/lib/reltool/src/reltool_mod_win.erl b/lib/reltool/src/reltool_mod_win.erl
index c2544cc2d8..f68c61fd6f 100644
--- a/lib/reltool/src/reltool_mod_win.erl
+++ b/lib/reltool/src/reltool_mod_win.erl
@@ -514,7 +514,7 @@ select_image(Xref, ModName) ->
{ok, M} = reltool_server:get_mod(Xref, ModName),
Image =
case M#mod.is_included of
- _ when M#mod.app_name =:= ?MISSING_APP -> ?ERR_IMAGE;
+ _ when M#mod.app_name =:= ?MISSING_APP_NAME -> ?ERR_IMAGE;
true -> ?TICK_IMAGE;
false -> ?WARN_IMAGE;
undefined -> ?ERR_IMAGE
@@ -674,7 +674,7 @@ do_goto_function(#state{active_page = P} = S, [FunName]) ->
find_regexp_forward(S, "^" ++ FunName ++ "(");
do_goto_function(S, [ModStr, FunStr]) ->
case reltool_server:get_mod(S#state.xref_pid, list_to_atom(ModStr)) of
- {ok, Mod} when Mod#mod.app_name =/= ?MISSING_APP ->
+ {ok, Mod} when Mod#mod.app_name =/= ?MISSING_APP_NAME ->
S2 = create_code_page(S#state{mod = Mod}, ModStr),
find_regexp_forward(S2, "^" ++ FunStr ++ "(");
{ok, _} ->
diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl
index a1e9c0193b..01a7d93823 100644
--- a/lib/reltool/src/reltool_server.erl
+++ b/lib/reltool/src/reltool_server.erl
@@ -175,7 +175,8 @@ parse_options(Opts) ->
?DEFAULT_EXCL_APP_FILTERS,
[]),
relocatable = ?DEFAULT_RELOCATABLE,
- app_type = ?DEFAULT_APP_TYPE,
+ rel_app_type = ?DEFAULT_REL_APP_TYPE,
+ embedded_app_type = ?DEFAULT_EMBEDDED_APP_TYPE,
app_file = ?DEFAULT_APP_FILE,
incl_archive_filters = dec_re(incl_archive_filters,
?DEFAULT_INCL_ARCHIVE_FILTERS,
@@ -301,7 +302,7 @@ loop(#state{common = C, sys = Sys} = S) ->
[M] ->
{ok, M};
[] ->
- {ok, missing_mod(ModName, ?MISSING_APP)}
+ {ok, missing_mod(ModName, ?MISSING_APP_NAME)}
end,
reltool_utils:reply(ReplyTo, Ref, Reply),
?MODULE:loop(S);
@@ -435,11 +436,11 @@ do_set_app(#state{sys = Sys} = S, App, Status) ->
analyse(#state{common = C,
sys = #sys{apps = Apps0, rels = Rels} = Sys} = S,
Status) ->
- Apps = lists:keydelete(?MISSING_APP, #app.name, Apps0),
+ Apps = lists:keydelete(?MISSING_APP_NAME, #app.name, Apps0),
ets:delete_all_objects(C#common.app_tab),
ets:delete_all_objects(C#common.mod_tab),
ets:delete_all_objects(C#common.mod_used_by_tab),
- MissingApp = default_app(?MISSING_APP, "missing"),
+ MissingApp = default_app(?MISSING_APP_NAME, "missing"),
ets:insert(C#common.app_tab, MissingApp),
{RevRelApps, Status2} = apps_in_rels(Rels, Apps, Status),
@@ -466,7 +467,7 @@ analyse(#state{common = C,
app_propagate_is_used_by(C, Apps3),
Apps4 = read_apps(C, Sys, Apps3, []),
%% io:format("Missing app: ~p\n",
- %% [lists:keysearch(?MISSING_APP, #app.name, Apps4)]),
+ %% [lists:keysearch(?MISSING_APP_NAME, #app.name, Apps4)]),
Sys2 = Sys#sys{apps = Apps4},
case verify_config(RelApps2, Sys2, Status3) of
@@ -704,7 +705,7 @@ mod_mark_is_included(C, Sys, UsedByName, [ModName | ModNames], Acc) ->
Acc2)
end;
[] ->
- M = missing_mod(ModName, ?MISSING_APP),
+ M = missing_mod(ModName, ?MISSING_APP_NAME),
M2 = M#mod{is_included = true},
ets:insert(C#common.mod_tab, M2),
ets:insert(C#common.mod_used_by_tab, {UsedByName, ModName}),
@@ -715,7 +716,7 @@ mod_mark_is_included(_C, _Sys, _UsedByName, [], Acc) ->
Acc.
app_propagate_is_used_by(C, [#app{mods = Mods, name = Name} | Apps]) ->
- case Name =:= ?MISSING_APP of
+ case Name =:= ?MISSING_APP_NAME of
true -> ok;
false -> ok
end,
@@ -1286,7 +1287,8 @@ decode(#sys{} = Sys, [{Key, Val} | KeyVals], Status) ->
excl_app_filters =
dec_re(excl_app_filters,
?EMBEDDED_EXCL_APP_FILTERS,
- Sys#sys.excl_app_filters)},
+ Sys#sys.excl_app_filters),
+ embedded_app_type = ?EMBEDDED_APP_TYPE},
Status};
profile when Val =:= standalone ->
{Sys#sys{profile = Val,
@@ -1347,12 +1349,19 @@ decode(#sys{} = Sys, [{Key, Val} | KeyVals], Status) ->
{Sys#sys{archive_opts = Val}, Status};
relocatable when Val =:= true; Val =:= false ->
{Sys#sys{relocatable = Val}, Status};
- app_type when Val =:= permanent;
- Val =:= transient;
- Val =:= temporary;
- Val =:= load;
- Val =:= none ->
- {Sys#sys{app_type = Val}, Status};
+ rel_app_type when Val =:= permanent;
+ Val =:= transient;
+ Val =:= temporary;
+ Val =:= load;
+ Val =:= none ->
+ {Sys#sys{rel_app_type = Val}, Status};
+ embedded_app_type when Val =:= permanent;
+ Val =:= transient;
+ Val =:= temporary;
+ Val =:= load;
+ Val =:= none;
+ Val =:= undefined ->
+ {Sys#sys{embedded_app_type = Val}, Status};
app_file when Val =:= keep; Val =:= strip, Val =:= all ->
{Sys#sys{app_file = Val}, Status};
debug_info when Val =:= keep; Val =:= strip ->
@@ -1389,7 +1398,8 @@ decode(#app{} = App, [{Key, Val} | KeyVals], Status) ->
Val =:= transient;
Val =:= temporary;
Val =:= load;
- Val =:= none ->
+ Val =:= none;
+ Val =:= undefined ->
{App#app{app_type = Val}, Status};
incl_app_filters ->
{App#app{incl_app_filters =
@@ -1921,7 +1931,7 @@ refresh_apps([Old | OldApps], [New | NewApps], Acc, Force, Status)
when New#app.name > Old#app.name ->
%% No new version. Remove the old.
Status2 =
- case Old#app.name =:= ?MISSING_APP of
+ case Old#app.name =:= ?MISSING_APP_NAME of
true ->
Status;
false ->
@@ -1939,7 +1949,7 @@ refresh_apps([], [New | NewApps], Acc, Force, Status) ->
refresh_apps([Old | OldApps], [], Acc, Force, Status) ->
%% No new version. Remove the old.
Status2 =
- case Old#app.name =:= ?MISSING_APP of
+ case Old#app.name =:= ?MISSING_APP_NAME of
true ->
Status;
false ->
diff --git a/lib/reltool/src/reltool_sys_win.erl b/lib/reltool/src/reltool_sys_win.erl
index 2e226d9147..dbb8e32aa2 100644
--- a/lib/reltool/src/reltool_sys_win.erl
+++ b/lib/reltool/src/reltool_sys_win.erl
@@ -1227,7 +1227,7 @@ create_fgraph_window(S, Title, Nodes, Links) ->
Panel = wxPanel:new(Frame, []),
Options = [{size, {lists:max([100, ?WIN_WIDTH - 100]), ?WIN_HEIGHT}}],
{Server, Fgraph} = reltool_fgraph_win:new(Panel, Options),
- Choose = fun(?MISSING_APP) -> alternate;
+ Choose = fun(?MISSING_APP_NAME) -> alternate;
(_) -> default
end,
[reltool_fgraph_win:add_node(Server, N, Choose(N)) || N <- Nodes],
diff --git a/lib/reltool/src/reltool_target.erl b/lib/reltool/src/reltool_target.erl
index aaf9d99d2f..bd06cda773 100644
--- a/lib/reltool/src/reltool_target.erl
+++ b/lib/reltool/src/reltool_target.erl
@@ -84,7 +84,8 @@ do_gen_config(#sys{root_dir = RootDir,
excl_archive_filters = ExclArchiveDirs,
archive_opts = ArchiveOpts,
relocatable = Relocatable,
- app_type = AppType,
+ rel_app_type = RelAppType,
+ embedded_app_type = InclAppType,
app_file = AppFile,
debug_info = DebugInfo},
InclDefs) ->
@@ -98,7 +99,7 @@ do_gen_config(#sys{root_dir = RootDir,
AppsItems =
[do_gen_config(A, InclDefs)
|| A <- Apps,
- A#app.name =/= ?MISSING_APP,
+ A#app.name =/= ?MISSING_APP_NAME,
A#app.name =/= erts,
not A#app.is_escript],
EscriptItems = [{escript,
@@ -138,7 +139,8 @@ do_gen_config(#sys{root_dir = RootDir,
emit(incl_archive_filters, X(InclArchiveDirs), ?DEFAULT_INCL_ARCHIVE_FILTERS, InclDefs) ++
emit(excl_archive_filters, X(ExclArchiveDirs), ?DEFAULT_EXCL_ARCHIVE_FILTERS, InclDefs) ++
emit(archive_opts, ArchiveOpts, ?DEFAULT_ARCHIVE_OPTS, InclDefs) ++
- emit(app_type, AppType, ?DEFAULT_APP_TYPE, InclDefs) ++
+ emit(rel_app_type, RelAppType, ?DEFAULT_REL_APP_TYPE, InclDefs) ++
+ emit(embedded_app_type, InclAppType, ?DEFAULT_EMBEDDED_APP_TYPE, InclDefs) ++
emit(app_file, AppFile, ?DEFAULT_APP_FILE, InclDefs) ++
emit(debug_info, DebugInfo, ?DEFAULT_DEBUG_INFO, InclDefs)};
do_gen_config(#app{name = Name,
@@ -294,41 +296,54 @@ do_gen_rel(#rel{name = RelName, vsn = RelVsn},
strip_rel_info(#app{name = Name,
vsn = Vsn,
app_type = Type,
- info = #app_info{incl_apps = InclApps}}) ->
+ info = #app_info{incl_apps = InclApps}})
+ when Type =/= undefined ->
case {Type, InclApps} of
- {undefined, []} -> {Name, Vsn};
- {undefined, _} -> {Name, Vsn, InclApps};
+ {permanent, []} -> {Name, Vsn};
+ {permanent, _} -> {Name, Vsn, InclApps};
{_, []} -> {Name, Vsn, Type};
{_, _} -> {Name, Vsn, Type, InclApps}
end.
-merge_apps(#rel{name = RelName, rel_apps = RelApps},
- #sys{apps = Apps, app_type = DefType}) ->
+merge_apps(#rel{name = RelName,
+ rel_apps = RelApps},
+ #sys{apps = Apps,
+ rel_app_type = RelAppType,
+ embedded_app_type = EmbAppType}) ->
Mandatory = [kernel, stdlib],
MergedApps = do_merge_apps(RelName, Mandatory, Apps, permanent, []),
- MergedApps2 = do_merge_apps(RelName, RelApps, Apps, DefType, MergedApps),
- sort_apps(MergedApps2).
-
-do_merge_apps(RelName, [#rel_app{name = Name} = RA | RelApps], Apps, DefType, Acc) ->
+ MergedApps2 = do_merge_apps(RelName, RelApps, Apps, RelAppType, MergedApps),
+ Embedded =
+ [A#app.name || A <- Apps,
+ EmbAppType =/= undefined,
+ A#app.is_included,
+ A#app.name =/= erts,
+ A#app.name =/= ?MISSING_APP_NAME,
+ not lists:keymember(A#app.name, #app.name, MergedApps2)],
+ io:format("Embedded: ~p\n", [Embedded]),
+ MergedApps3 = do_merge_apps(RelName, Embedded, Apps, EmbAppType, MergedApps2),
+ sort_apps(MergedApps3).
+
+do_merge_apps(RelName, [#rel_app{name = Name} = RA | RelApps], Apps, RelAppType, Acc) ->
case is_already_merged(Name, RelApps, Acc) of
true ->
- do_merge_apps(RelName, RelApps, Apps, DefType, Acc);
+ do_merge_apps(RelName, RelApps, Apps, RelAppType, Acc);
false ->
{value, App} = lists:keysearch(Name, #app.name, Apps),
- MergedApp = merge_app(RelName, RA, DefType, App),
+ MergedApp = merge_app(RelName, RA, RelAppType, App),
MoreNames = (MergedApp#app.info)#app_info.applications,
Acc2 = [MergedApp | Acc],
- do_merge_apps(RelName, MoreNames ++ RelApps, Apps, DefType, Acc2)
+ do_merge_apps(RelName, MoreNames ++ RelApps, Apps, RelAppType, Acc2)
end;
-do_merge_apps(RelName, [Name | RelApps], Apps, DefType, Acc) ->
+do_merge_apps(RelName, [Name | RelApps], Apps, RelAppType, Acc) ->
case is_already_merged(Name, RelApps, Acc) of
true ->
- do_merge_apps(RelName, RelApps, Apps, DefType, Acc);
+ do_merge_apps(RelName, RelApps, Apps, RelAppType, Acc);
false ->
RelApp = init_rel_app(Name, Apps),
- do_merge_apps(RelName, [RelApp | RelApps], Apps, DefType, Acc)
+ do_merge_apps(RelName, [RelApp | RelApps], Apps, RelAppType, Acc)
end;
-do_merge_apps(_RelName, [], _Apps, _DefType, Acc) ->
+do_merge_apps(_RelName, [], _Apps, _RelAppType, Acc) ->
lists:reverse(Acc).
init_rel_app(Name, Apps) ->
@@ -340,20 +355,20 @@ init_rel_app(Name, Apps) ->
merge_app(RelName,
#rel_app{name = Name,
- app_type = RelAppType,
+ app_type = Type,
incl_apps = InclApps},
- DefType,
+ RelAppType,
App) ->
- Type =
- case {RelAppType, App#app.app_type} of
- {undefined, undefined} -> DefType;
- {undefined, AppType} -> AppType;
- {_, _} -> RelAppType
+ Type2 =
+ case {Type, App#app.app_type} of
+ {undefined, undefined} -> RelAppType;
+ {undefined, AppAppType} -> AppAppType;
+ {_, _} -> Type
end,
Info = App#app.info,
case InclApps -- Info#app_info.incl_apps of
[] ->
- App#app{app_type = Type, info = Info#app_info{incl_apps = InclApps}};
+ App#app{app_type = Type2, info = Info#app_info{incl_apps = InclApps}};
BadIncl ->
reltool_utils:throw_error("~p: These applications are "
"used by release ~s but are "
@@ -880,7 +895,7 @@ spec_escripts(#sys{apps = Apps}, ErtsBin, BinFiles) ->
name = Name,
active_dir = File}) ->
if
- Name =:= ?MISSING_APP ->
+ Name =:= ?MISSING_APP_NAME ->
false;
not IsEscript ->
false;
@@ -943,7 +958,7 @@ spec_lib_files(#sys{apps = Apps} = Sys) ->
Filter = fun(#app{is_escript = IsEscript, is_included = IsIncl,
is_pre_included = IsPre, name = Name}) ->
if
- Name =:= ?MISSING_APP ->
+ Name =:= ?MISSING_APP_NAME ->
false;
IsEscript ->
false;