summaryrefslogtreecommitdiff
path: root/src/rebar_reltool.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_reltool.erl')
-rw-r--r--src/rebar_reltool.erl30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl
index 51fcb0e..3c9b728 100644
--- a/src/rebar_reltool.erl
+++ b/src/rebar_reltool.erl
@@ -67,7 +67,7 @@ generate(Config0, ReltoolFile) ->
overlay(Config, ReltoolFile) ->
%% Load the reltool configuration from the file
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
- {Config1, process_overlay(Config, ReltoolConfig)}.
+ {process_overlay(Config, ReltoolConfig), Config1}.
clean(Config, ReltoolFile) ->
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
@@ -109,7 +109,8 @@ process_overlay(Config, ReltoolConfig) ->
OverlayVars0 =
dict:from_list([{erts_vsn, "erts-" ++ erlang:system_info(version)},
{rel_vsn, BootRelVsn},
- {target_dir, TargetDir}]),
+ {target_dir, TargetDir},
+ {hostname, net_adm:localhost()}]),
%% Load up any variables specified by overlay_vars
OverlayVars1 = overlay_vars(Config, OverlayVars0, ReltoolConfig),
@@ -149,15 +150,13 @@ overlay_vars(Config, Vars0, ReltoolConfig) ->
load_vars_file(undefined) ->
dict:new();
load_vars_file(File) ->
- case file:consult(File) of
+ case rebar_config:consult_file(File) of
{ok, Terms} ->
dict:from_list(Terms);
{error, Reason} ->
?ABORT("Unable to load overlay_vars from ~p: ~p\n", [File, Reason])
end.
-
-
validate_rel_apps(ReltoolServer, {sys, ReltoolConfig}) ->
case lists:keyfind(rel, 1, ReltoolConfig) of
false ->
@@ -190,7 +189,6 @@ app_exists(App, Server) when is_atom(App) ->
app_exists(AppTuple, Server) when is_tuple(AppTuple) ->
app_exists(element(1, AppTuple), Server).
-
run_reltool(Server, Config, ReltoolConfig) ->
case reltool:get_target_spec(Server) of
{ok, Spec} ->
@@ -224,7 +222,6 @@ run_reltool(Server, Config, ReltoolConfig) ->
?ABORT("Unable to generate spec: ~s\n", [Reason])
end.
-
mk_target_dir(Config, TargetDir) ->
case filelib:ensure_dir(filename:join(TargetDir, "dummy")) of
ok ->
@@ -246,7 +243,6 @@ mk_target_dir(Config, TargetDir) ->
?FAIL
end.
-
dump_spec(Config, Spec) ->
case rebar_config:get_global(Config, dump_spec, "0") of
"1" ->
@@ -349,10 +345,22 @@ apply_file_info(InFile, OutFile) ->
create_RELEASES(TargetDir, RelName, RelVsn) ->
ReleasesDir = filename:join(TargetDir, "releases"),
+ RelFile = filename:join([ReleasesDir, RelVsn, RelName ++ ".rel"]),
+ Apps = rebar_rel_utils:get_rel_apps(RelFile),
+ TargetLib = filename:join(TargetDir,"lib"),
+
+ AppDirs =
+ [ {App, Vsn, TargetLib}
+ || {App, Vsn} <- Apps,
+ filelib:is_dir(
+ filename:join(TargetLib,
+ lists:concat([App, "-", Vsn]))) ],
+
case release_handler:create_RELEASES(
- ".", ReleasesDir,
- filename:join([ReleasesDir, RelVsn, RelName ++ ".rel"]),
- filename:join(TargetDir, "lib")) of
+ code:root_dir(),
+ ReleasesDir,
+ RelFile,
+ AppDirs) of
ok ->
ok;
{error, Reason} ->