aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-03-12 17:21:33 +0100
committerSiri Hansen <[email protected]>2012-03-19 09:48:54 +0100
commit50bc03bf5cc4b55644d164819d8c58bef966e278 (patch)
treee4330cfa505268e2d380471b9a16c984f0664674 /lib/reltool
parent048c28bc6c75964c3ee7930f5a1aecae92843c88 (diff)
downloadotp-50bc03bf5cc4b55644d164819d8c58bef966e278.tar.gz
otp-50bc03bf5cc4b55644d164819d8c58bef966e278.tar.bz2
otp-50bc03bf5cc4b55644d164819d8c58bef966e278.zip
[reltool] Always return warnings as flat strings
OTP-9794
Diffstat (limited to 'lib/reltool')
-rw-r--r--lib/reltool/src/reltool_server.erl63
-rw-r--r--lib/reltool/src/reltool_utils.erl5
2 files changed, 32 insertions, 36 deletions
diff --git a/lib/reltool/src/reltool_server.erl b/lib/reltool/src/reltool_server.erl
index 90fc6a8c28..d43be82cbd 100644
--- a/lib/reltool/src/reltool_server.erl
+++ b/lib/reltool/src/reltool_server.erl
@@ -681,26 +681,21 @@ mod_init_is_included(ModTab, M, ModCond, AppCond, Default, Status) ->
[Existing] ->
case {Existing#mod.is_included,IsIncl} of
{false,_} ->
- Warning =
- lists:concat(
- ["Module ",M#mod.name,
- " exists in applications ", Existing#mod.app_name,
- " and ", M#mod.app_name,
- ". Using module from application ",
- M#mod.app_name, "."]),
ets:insert(ModTab, M2),
- reltool_utils:add_warning(Status,Warning);
+ reltool_utils:add_warning(
+ "Module ~p exists in applications ~p and ~p. "
+ "Using module from application ~p.",
+ [M#mod.name, Existing#mod.app_name,
+ M#mod.app_name, M#mod.app_name],
+ Status);
{_,false} ->
- Warning =
- lists:concat(
- ["Module ",M#mod.name,
- " exists in applications ", Existing#mod.app_name,
- " and ", M#mod.app_name,
- ". Using module from application ",
- Existing#mod.app_name, "."]),
-
%% Don't insert in ModTab - using Existing
- reltool_utils:add_warning(Status,Warning);
+ reltool_utils:add_warning(
+ "Module ~p exists in applications ~p and ~p. "
+ "Using module from application ~p.",
+ [M#mod.name, Existing#mod.app_name,
+ M#mod.app_name,Existing#mod.app_name],
+ Status);
{_,_} ->
reltool_utils:throw_error(
"Module ~p potentially included by two different "
@@ -1035,22 +1030,21 @@ read_app_info(AppFileOrBin, AppFile, AppName, DefaultVsn, Status) ->
AI = #app_info{vsn = DefaultVsn},
parse_app_info(AppFile, Info, AI, Status);
{ok, _BadApp} ->
- Text = lists:concat([AppName,
- ": Illegal contents in app file ", AppFile,
- ", application tuple with arity 3 expected."]),
{missing_app_info(DefaultVsn),
- reltool_utils:add_warning(Status, Text)};
+ reltool_utils:add_warning("~p: Illegal contents in app file ~p, "
+ "application tuple with arity 3 expected.",
+ [AppName,AppFile],
+ Status)};
{error, Text} when Text =:= EnoentText ->
- Text2 = lists:concat([AppName,
- ": Missing app file ", AppFile, "."]),
{missing_app_info(DefaultVsn),
- reltool_utils:add_warning(Status, Text2)};
+ reltool_utils:add_warning("~p: Missing app file ~p.",
+ [AppName,AppFile],
+ Status)};
{error, Text} ->
- Text2 = lists:concat([AppName,
- ": Cannot parse app file ",
- AppFile, " (", Text, ")."]),
{missing_app_info(DefaultVsn),
- reltool_utils:add_warning(Status, Text2)}
+ reltool_utils:add_warning("~p: Cannot parse app file ~p (~p).",
+ [AppName,AppFile,Text],
+ Status)}
end.
parse_app_info(File, [{Key, Val} | KeyVals], AI, Status) ->
@@ -1084,10 +1078,11 @@ parse_app_info(File, [{Key, Val} | KeyVals], AI, Status) ->
parse_app_info(File, KeyVals, AI#app_info{start_phases = Val},
Status);
_ ->
- String = lists:concat(["Unexpected item ",
- Key, "in app file ", File]),
- parse_app_info(File, KeyVals, AI,
- reltool_utils:add_warning(Status, String))
+ Status2 =
+ reltool_utils:add_warning("Unexpected item ~p in app file ~p.",
+ [Key,File],
+ Status),
+ parse_app_info(File, KeyVals, AI, Status2)
end;
parse_app_info(_, [], AI, Status) ->
{AI, Status}.
@@ -1581,8 +1576,8 @@ patch_erts_version(RootDir, Apps, Status) ->
Apps2 = lists:keystore(AppName, #app.name, Apps, Erts2),
{Apps2, Status};
Vsn =:= "" ->
- {Apps, reltool_utils:add_warning(Status,
- "erts has no version")};
+ {Apps, reltool_utils:add_warning("erts has no version",[],
+ Status)};
true ->
{Apps, Status}
end;
diff --git a/lib/reltool/src/reltool_utils.erl b/lib/reltool/src/reltool_utils.erl
index 2d766224d9..9cf9bd1418 100644
--- a/lib/reltool/src/reltool_utils.erl
+++ b/lib/reltool/src/reltool_utils.erl
@@ -30,7 +30,7 @@
get_item/1, get_items/1, get_selected_items/3,
select_items/3, select_item/2,
- safe_keysearch/5, print/4, add_warning/2,
+ safe_keysearch/5, print/4, add_warning/3,
create_dir/1, list_dir/1, read_file_info/1,
write_file_info/2, read_file/1, write_file/2,
@@ -402,7 +402,8 @@ print(X, X, Format, Args) ->
print(_, _, _, _) ->
ok.
-add_warning({ok,Warnings}, Warning) ->
+add_warning(Format, Args, {ok,Warnings}) ->
+ Warning = lists:flatten(io_lib:format(Format,Args)),
case lists:member(Warning,Warnings) of
true ->
{ok,Warnings};