From fcd5116e7ae5bc40d6542b080f2b0f66707faf54 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 16 Feb 2014 15:33:57 -0600 Subject: fix double include_erts call with vm.args and sys.config config vars --- src/rlx_prv_assembler.erl | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl index 4ef0a1a..a21dd3d 100644 --- a/src/rlx_prv_assembler.erl +++ b/src/rlx_prv_assembler.erl @@ -334,14 +334,15 @@ write_bin_file(State, Release, OutputDir, RelDir) -> ok = file:write_file(BareRel, StartFile), ok = file:change_mode(BareRel, 8#777) end, - copy_or_generate_vmargs_file(State, Release, OutputDir, RelDir), - copy_or_generate_sys_config_file(State, Release, OutputDir, RelDir). + copy_or_generate_vmargs_file(State, Release, RelDir), + copy_or_generate_sys_config_file(State, RelDir), + include_erts(State, Release, OutputDir, RelDir). %% @doc copy vm.args or generate one to releases/VSN/vm.args --spec copy_or_generate_vmargs_file(rlx_state:t(), rlx_release:t(), file:name(), file:name()) -> +-spec copy_or_generate_vmargs_file(rlx_state:t(), rlx_release:t(), file:name()) -> {ok, rlx_state:t()} | relx:error(). -copy_or_generate_vmargs_file(State, Release, OutputDir, RelDir) -> +copy_or_generate_vmargs_file(State, Release, RelDir) -> RelVmargsPath = filename:join([RelDir, "vm.args"]), case rlx_state:vm_args(State) of undefined -> @@ -352,46 +353,38 @@ copy_or_generate_vmargs_file(State, Release, OutputDir, RelDir) -> false -> ?RLX_ERROR({vmargs_does_not_exist, ArgsPath}); true -> - copy_or_symlink_config_file(State, Release, OutputDir, RelDir, - ArgsPath, RelVmargsPath) + copy_or_symlink_config_file(State, ArgsPath, RelVmargsPath) end end. %% @doc copy config/sys.config or generate one to releases/VSN/sys.config --spec copy_or_generate_sys_config_file(rlx_state:t(), rlx_release:t(), - file:name(), file:name()) -> +-spec copy_or_generate_sys_config_file(rlx_state:t(), file:name()) -> {ok, rlx_state:t()} | relx:error(). -copy_or_generate_sys_config_file(State, Release, OutputDir, RelDir) -> +copy_or_generate_sys_config_file(State, RelDir) -> RelSysConfPath = filename:join([RelDir, "sys.config"]), case rlx_state:sys_config(State) of undefined -> - unless_exists_write_default(RelSysConfPath, sys_config_file()), - include_erts(State, Release, OutputDir, RelDir); + unless_exists_write_default(RelSysConfPath, sys_config_file()); ConfigPath -> case filelib:is_regular(ConfigPath) of false -> ?RLX_ERROR({config_does_not_exist, ConfigPath}); true -> - copy_or_symlink_config_file(State, Release, OutputDir, RelDir, - ConfigPath, RelSysConfPath) + copy_or_symlink_config_file(State, ConfigPath, RelSysConfPath) end end. %% @doc copy config/sys.config or generate one to releases/VSN/sys.config --spec copy_or_symlink_config_file(rlx_state:t(), rlx_release:t(), - file:name(), file:name(), - file:name(), file:name()) -> +-spec copy_or_symlink_config_file(rlx_state:t(), file:name(), file:name()) -> {ok, rlx_state:t()} | relx:error(). -copy_or_symlink_config_file(State, Release, OutputDir, RelDir, - ConfigPath, RelConfPath) -> +copy_or_symlink_config_file(State, ConfigPath, RelConfPath) -> ensure_not_exist(RelConfPath), case rlx_state:dev_mode(State) of true -> ok = file:make_symlink(ConfigPath, RelConfPath); _ -> ok = ec_file:copy(ConfigPath, RelConfPath) - end, - include_erts(State, Release, OutputDir, RelDir). + end. %% @doc Optionally add erts directory to release, if defined. -spec include_erts(rlx_state:t(), rlx_release:t(), file:name(), file:name()) -> -- cgit v1.2.3 From 9168632da88fe32af46e1ed8dd6e6b22b4094593 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 16 Feb 2014 18:58:46 -0600 Subject: by default do not do app and release discovery under output dir --- src/rlx_dscv_util.erl | 29 +++++++++++++++++------------ src/rlx_prv_assembler.erl | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/rlx_dscv_util.erl b/src/rlx_dscv_util.erl index 6cfea81..a4a265c 100644 --- a/src/rlx_dscv_util.erl +++ b/src/rlx_dscv_util.erl @@ -115,19 +115,24 @@ discover_real_symlink_dir(ProcessDir, File) -> ok = file:set_cwd(File), {ok, ActualRealDir} = file:get_cwd(), ok = file:set_cwd(CurCwd), - lists:prefix(iolist_to_list(filename:absname(ActualRealDir)), - iolist_to_list(filename:absname(File))), - case ProcessDir(File, directory) of - {ok, Result, true} -> - [{ok, Result} | recurse(ProcessDir, File)]; - {noresult, true} -> - recurse(ProcessDir, File); - {ok, Result, _} -> - [{ok, Result}]; - {noresult, _} -> + case lists:prefix(iolist_to_list(filename:absname(ActualRealDir)), + iolist_to_list(filename:absname(File))) of + true -> + %% Ignore cycles []; - Err = {error, _} -> - [Err] + false -> + case ProcessDir(File, directory) of + {ok, Result, true} -> + [{ok, Result} | recurse(ProcessDir, File)]; + {noresult, true} -> + recurse(ProcessDir, File); + {ok, Result, _} -> + [{ok, Result}]; + {noresult, _} -> + []; + Err = {error, _} -> + [Err] + end end. recurse(ProcessDir, File) -> diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl index a21dd3d..d3ab2f6 100644 --- a/src/rlx_prv_assembler.erl +++ b/src/rlx_prv_assembler.erl @@ -376,7 +376,7 @@ copy_or_generate_sys_config_file(State, RelDir) -> %% @doc copy config/sys.config or generate one to releases/VSN/sys.config -spec copy_or_symlink_config_file(rlx_state:t(), file:name(), file:name()) -> - {ok, rlx_state:t()} | relx:error(). + ok. copy_or_symlink_config_file(State, ConfigPath, RelConfPath) -> ensure_not_exist(RelConfPath), case rlx_state:dev_mode(State) of -- cgit v1.2.3