aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rebar.config4
-rw-r--r--rebar.lock4
-rw-r--r--src/relx.erl8
-rw-r--r--src/rlx_prv_assembler.erl19
4 files changed, 24 insertions, 11 deletions
diff --git a/rebar.config b/rebar.config
index 747f415..8298de1 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,7 +1,7 @@
%% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*-
%% Dependencies ================================================================
-{deps, [{erlware_commons, "0.16.0"},
- {providers, "1.4.1"},
+{deps, [{erlware_commons, "0.18.0"},
+ {providers, "1.5.0"},
{getopt, "0.8.2"},
{bbmustache, "1.0.4"}
]}.
diff --git a/rebar.lock b/rebar.lock
index afb9a8f..c160fe7 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -1,4 +1,4 @@
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.0.4">>},0},
- {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.16.0">>},0},
+ {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.18.0">>},0},
{<<"getopt">>,{pkg,<<"getopt">>,<<"0.8.2">>},0},
- {<<"providers">>,{pkg,<<"providers">>,<<"1.4.1">>},0}].
+ {<<"providers">>,{pkg,<<"providers">>,<<"1.5.0">>},0}].
diff --git a/src/relx.erl b/src/relx.erl
index d2dd797..8027fd4 100644
--- a/src/relx.erl
+++ b/src/relx.erl
@@ -70,7 +70,7 @@ main(ApiOptions, Args) ->
end,
case Result of
{error, _} ->
- report_error(rlx_state:caller(rlx_state:new([], undefined),
+ report_error(rlx_state:caller(rlx_state:new([], [{caller, command_line}], undefined),
command_line),
Result);
_ ->
@@ -327,13 +327,13 @@ usage() ->
report_error(State, Error) ->
case Error of
{error, {relx, {opt_parse, _}}} ->
- io:format(standard_error, format_error(Error), []),
+ ec_cmd_log:error(rlx_state:log(State), format_error(Error), []),
usage();
{error, {rlx_cmd_args, _}} ->
- io:format(standard_error, format_error(Error), []),
+ ec_cmd_log:error(rlx_state:log(State), format_error(Error), []),
usage();
_ ->
- io:format(standard_error, format_error(Error), [])
+ ec_cmd_log:error(rlx_state:log(State), format_error(Error), [])
end,
case rlx_state:caller(State) of
command_line ->
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl
index 9a267e4..56b99bd 100644
--- a/src/rlx_prv_assembler.erl
+++ b/src/rlx_prv_assembler.erl
@@ -89,6 +89,9 @@ format_error({ec_file_error, AppDir, TargetDir, E}) ->
format_error({config_does_not_exist, Path}) ->
io_lib:format("The config file specified for this release (~s) does not exist!",
[Path]);
+format_error({sys_config_parse_error, ConfigPath, Reason}) ->
+ io_lib:format("The config file (~s) specified for this release could not be opened or parsed: ~s",
+ [ConfigPath, file:format_error(Reason)]);
format_error({specified_erts_does_not_exist, ErtsVersion}) ->
io_lib:format("Specified version of erts (~s) does not exist",
[ErtsVersion]);
@@ -379,8 +382,12 @@ write_bin_file(State, Release, OutputDir, RelDir) ->
ReleasesDir = filename:join(OutputDir, "releases"),
generate_start_erl_data_file(Release, ReleasesDir),
copy_or_generate_vmargs_file(State, Release, RelDir),
- copy_or_generate_sys_config_file(State, RelDir),
- include_erts(State, Release, OutputDir, RelDir).
+ case copy_or_generate_sys_config_file(State, RelDir) of
+ ok ->
+ include_erts(State, Release, OutputDir, RelDir);
+ E ->
+ E
+ end.
include_nodetool(BinDir) ->
NodeToolFile = nodetool_contents(),
@@ -431,7 +438,13 @@ copy_or_generate_sys_config_file(State, RelDir) ->
false ->
?RLX_ERROR({config_does_not_exist, ConfigPath});
true ->
- copy_or_symlink_config_file(State, ConfigPath, RelSysConfPath)
+ %% validate sys.config is valid Erlang terms
+ case file:consult(ConfigPath) of
+ {ok, _} ->
+ copy_or_symlink_config_file(State, ConfigPath, RelSysConfPath);
+ {error, Reason} ->
+ ?RLX_ERROR({sys_config_parse_error, ConfigPath, Reason})
+ end
end
end.