diff options
author | Eric <[email protected]> | 2012-09-19 18:50:56 -0700 |
---|---|---|
committer | Eric <[email protected]> | 2012-09-19 18:50:56 -0700 |
commit | 13b65ac87e281e846820bbef8df1a94b81fcb5ef (patch) | |
tree | 2ac4836c41daf501bf2c156d49e61a67aaba3e29 | |
parent | 6ee94839094b00163e5f0a29a41dedb9ae67ca85 (diff) | |
download | relx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.tar.gz relx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.tar.bz2 relx-13b65ac87e281e846820bbef8df1a94b81fcb5ef.zip |
discover should not discover files in the output dir
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | src/rcl_prv_assembler.erl | 5 | ||||
-rw-r--r-- | src/rcl_prv_discover.erl | 18 | ||||
-rw-r--r-- | src/rcl_state.erl | 2 |
4 files changed, 17 insertions, 11 deletions
@@ -7,4 +7,5 @@ relcool # This is a generated file that should be ignored src/rcl_goal.erl logs -test/*_data
\ No newline at end of file +test/*_data +relcool_output/*
\ No newline at end of file diff --git a/src/rcl_prv_assembler.erl b/src/rcl_prv_assembler.erl index 8143c97..d3fe4ad 100644 --- a/src/rcl_prv_assembler.erl +++ b/src/rcl_prv_assembler.erl @@ -119,11 +119,10 @@ copy_dir(AppDir, TargetDir, SubDir) -> true -> case filelib:is_dir(SubTarget) of true -> - ec_file:remove(SubTarget, [recursive]); + ok = ec_file:remove(SubTarget, [recursive]); false -> ok end, - ok = ec_file:mkdir_p(SubTarget), case ec_file:copy(SubSource, SubTarget, [recursive]) of {error, E} -> ?RCL_ERROR({ec_file_error, AppDir, TargetDir, E}); @@ -134,8 +133,6 @@ copy_dir(AppDir, TargetDir, SubDir) -> ok end. - - create_release_info(State, Release, OutputDir) -> RelName = erlang:atom_to_list(rcl_release:name(Release)), ReleaseDir = filename:join([OutputDir, diff --git a/src/rcl_prv_discover.erl b/src/rcl_prv_discover.erl index a7d7e1e..ab4011c 100644 --- a/src/rcl_prv_discover.erl +++ b/src/rcl_prv_discover.erl @@ -42,6 +42,7 @@ init(State) -> %% looking for OTP Applications -spec do(rcl_state:t()) -> {ok, rcl_state:t()} | relcool:error(). do(State) -> + OutputDir = rcl_state:output_dir(State), LibDirs = get_lib_dirs(State), rcl_log:info(rcl_state:log(State), fun() -> @@ -49,7 +50,10 @@ do(State) -> [[rcl_util:indent(1), LibDir, "\n"] || LibDir <- LibDirs]] end), - AppMeta0 = lists:flatten(ec_plists:map(fun discover_dir/1, LibDirs)), + AppMeta0 = lists:flatten(ec_plists:map(fun(LibDir) -> + discover_dir([OutputDir], + LibDir) + end, LibDirs)), Errors = [case El of {error, Ret} -> Ret; _ -> El @@ -148,17 +152,21 @@ format_detail({unversioned_app, AppDir, _AppName}) -> format_detail({app_info_error, Detail}) -> rcl_app_info:format_error(Detail). --spec discover_dir(file:name()) -> +-spec discover_dir([file:name()], + file:name()) -> [rcl_app_info:t() | {error, Reason::term()}] | rcl_app_info:t() | {error, Reason::term()}. -discover_dir(File) -> - case filelib:is_dir(File) of +discover_dir(IgnoreDirs, File) -> + case (not lists:member(File, IgnoreDirs)) + andalso filelib:is_dir(File) of true -> case file:list_dir(File) of {error, Reason} -> {error, {accessing, File, Reason}}; {ok, List} -> - ec_plists:map(fun discover_dir/1, [filename:join([File, Dir]) || Dir <- List]) + ec_plists:map(fun(LibDir) -> + discover_dir(IgnoreDirs, LibDir) + end, [filename:join([File, Dir]) || Dir <- List]) end; false -> is_valid_otp_app(File) diff --git a/src/rcl_state.erl b/src/rcl_state.erl index 2d27de2..23c7e74 100644 --- a/src/rcl_state.erl +++ b/src/rcl_state.erl @@ -89,7 +89,7 @@ new(PropList, Targets) when erlang:is_list(PropList) -> State0 = #state_t{log = proplists:get_value(log, PropList, rcl_log:new(error)), - output_dir=proplists:get_value(output_dir, PropList, ""), + output_dir=filename:absname(proplists:get_value(output_dir, PropList, "")), lib_dirs=get_lib_dirs(proplists:get_value(lib_dirs, PropList, [])), config_files=Targets, goals=proplists:get_value(goals, PropList, []), |