diff options
author | Jordan Wilberding <[email protected]> | 2014-10-11 10:03:34 -0500 |
---|---|---|
committer | Jordan Wilberding <[email protected]> | 2014-10-11 10:03:34 -0500 |
commit | 5096c28c17ea256f48ce049a43d11b172532e03e (patch) | |
tree | 73433a94c520d141a83acdb2d7109e0fa997344a | |
parent | 40d6b895f9d1ce6b359502d39663b6fef2b55f1a (diff) | |
parent | e3842aba1afdbfbca19f5bf455976924441ff484 (diff) | |
download | relx-5096c28c17ea256f48ce049a43d11b172532e03e.tar.gz relx-5096c28c17ea256f48ce049a43d11b172532e03e.tar.bz2 relx-5096c28c17ea256f48ce049a43d11b172532e03e.zip |
Merge pull request #223 from tsloughter/tar
include overlay files in tar
-rw-r--r-- | src/rlx_prv_archive.erl | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/rlx_prv_archive.erl b/src/rlx_prv_archive.erl index 3ad06b4..ab640ed 100644 --- a/src/rlx_prv_archive.erl +++ b/src/rlx_prv_archive.erl @@ -38,11 +38,11 @@ init(State) -> {ok, State}. -spec do(rlx_state:t()) -> {ok, rlx_state:t()} | relx:error(). -do(State) -> +do(State) -> {RelName, RelVsn} = rlx_state:default_configured_release(State), Release = rlx_state:get_realized_release(State, RelName, RelVsn), - OutputDir = rlx_state:output_dir(State), - make_tar(State, Release, OutputDir). + OutputDir = rlx_state:output_dir(State), + make_tar(State, Release, OutputDir). format_error({tar_unknown_generation_error, Module, Vsn}) -> io_lib:format("Tarball generation error of ~s ~s", @@ -94,6 +94,7 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> TarFile = filename:join(OutputDir, Name++"-"++Vsn++".tar.gz"), file:rename(filename:join(OutputDir, Name++".tar.gz"), TarFile), erl_tar:extract(TarFile, [{cwd, TempDir}, compressed]), + OverlayFiles = overlay_files(rlx_state:get(State, overlay, undefined), OutputDir), ok = erl_tar:create(TarFile, [{"lib", filename:join(TempDir, "lib")}, @@ -108,9 +109,29 @@ update_tar(State, TempDir, OutputDir, Name, Vsn, ErtsVersion) -> []; _ -> [{"erts-"++ErtsVersion, filename:join(OutputDir, "erts-"++ErtsVersion)}] - end], [compressed]), + end]++OverlayFiles, [compressed]), ec_cmd_log:info(rlx_state:log(State), "tarball ~s successfully created!~n", [TarFile]), ec_file:remove(TempDir, [recursive]), {ok, State}. +overlay_files(undefined, _) -> + []; +overlay_files(Overlay, OutputDir) -> + [{to(O), filename:join(OutputDir, to(O))} || O <- Overlay, filter(O)]. + +to({copy, _, To}) -> + To; +to({mkdir, To}) -> + To; +to({template, _, To}) -> + To. + +filter({copy, _, _}) -> + true; +filter({mkdir, _}) -> + true; +filter({template, _, _}) -> + true; +filter(_) -> + false. |