diff options
author | Jason L. Shiffer <[email protected]> | 2014-04-07 09:49:03 -0400 |
---|---|---|
committer | Jason L. Shiffer <[email protected]> | 2014-04-07 10:09:06 -0400 |
commit | 15d535756f5ed3fef1a433da926d11cb36b10d21 (patch) | |
tree | 5b17d551c90d7a98e4e33c2d633da76ef4353a21 /src/rlx_prv_assembler.erl | |
parent | 5561818c5620066899a6bf74ae59a873d94d8aef (diff) | |
download | relx-15d535756f5ed3fef1a433da926d11cb36b10d21.tar.gz relx-15d535756f5ed3fef1a433da926d11cb36b10d21.tar.bz2 relx-15d535756f5ed3fef1a433da926d11cb36b10d21.zip |
Add support for explicit erts path
Add support for 'include_erts' to be defined as a path to an external erlang
release. This will allow for relx to include cross-compiled erts builds.
include_erts can now be one of three values: true (default), false, or
"/path/to/erlang".
The symantics do not change unless it is set to a string in which case
it only overrides the default lookup "code:root_dir()" with the given
path.
Diffstat (limited to 'src/rlx_prv_assembler.erl')
-rw-r--r-- | src/rlx_prv_assembler.erl | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/rlx_prv_assembler.erl b/src/rlx_prv_assembler.erl index 3772611..d7bf3f1 100644 --- a/src/rlx_prv_assembler.erl +++ b/src/rlx_prv_assembler.erl @@ -410,9 +410,21 @@ copy_or_symlink_config_file(State, ConfigPath, RelConfPath) -> -spec include_erts(rlx_state:t(), rlx_release:t(), file:name(), file:name()) -> {ok, rlx_state:t()} | relx:error(). include_erts(State, Release, OutputDir, RelDir) -> - case rlx_state:get(State, include_erts, true) of - true -> - Prefix = code:root_dir(), + Prefix = case rlx_state:get(State, include_erts, true) of + false -> + false; + true -> + code:root_dir(); + P -> + filename:absname(P) + end, + + case Prefix of + false -> + make_boot_script(State, Release, OutputDir, RelDir); + _ -> + ec_cmd_log:info(rlx_state:log(State), + "Including Erts from ~s~n", [Prefix]), ErtsVersion = rlx_release:erts(Release), ErtsDir = filename:join([Prefix, "erts-" ++ ErtsVersion]), LocalErts = filename:join([OutputDir, "erts-" ++ ErtsVersion]), @@ -450,12 +462,9 @@ include_erts(State, Release, OutputDir, RelDir) -> ok end, make_boot_script(State, Release, OutputDir, RelDir) - end; - _ -> - make_boot_script(State, Release, OutputDir, RelDir) + end end. - -spec make_boot_script(rlx_state:t(), rlx_release:t(), file:name(), file:name()) -> {ok, rlx_state:t()} | relx:error(). make_boot_script(State, Release, OutputDir, RelDir) -> @@ -518,16 +527,19 @@ make_relup(State, Release) -> make_tar(State, Release, OutputDir) -> Name = atom_to_list(rlx_release:name(Release)), Vsn = rlx_release:vsn(Release), - Prefix = code:root_dir(), ErtsVersion = rlx_release:erts(Release), - ErtsDir = filename:join([Prefix]), Opts = [{path, [filename:join([OutputDir, "lib", "*", "ebin"])]}, {outdir, OutputDir} | case rlx_state:get(State, include_erts, true) of true -> + Prefix = code:root_dir(), + ErtsDir = filename:join([Prefix]), [{erts, ErtsDir}]; false -> - [] + []; + Prefix -> + ErtsDir = filename:join([Prefix]), + [{erts, ErtsDir}] end], case systools:make_tar(filename:join([OutputDir, "releases", Vsn, Name]), Opts) of @@ -562,10 +574,10 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> filename:join([OutputDir, "releases", Vsn, "vm.args"])}, {"bin", filename:join([OutputDir, "bin"])} | case rlx_state:get(State, include_erts, true) of - true -> - [{"erts-"++ErtsVersion, filename:join(OutputDir, "erts-"++ErtsVersion)}]; false -> - [] + []; + _ -> + [{"erts-"++ErtsVersion, filename:join(OutputDir, "erts-"++ErtsVersion)}] end], [compressed]), ec_cmd_log:info(rlx_state:log(State), "tarball ~s successfully created!~n", [TarFile]), |