mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fixed issue 1 "priv/mibs/ is not automatically created"
This commit is contained in:
parent
ec4e805898
commit
4ac1f3efe9
2 changed files with 22 additions and 2 deletions
|
@ -149,7 +149,8 @@ internal_erl_compile(Source, Config, Outdir) ->
|
|||
skipped
|
||||
end.
|
||||
|
||||
compile_mib(Source, _Target, Config) ->
|
||||
compile_mib(Source, Target, Config) ->
|
||||
ok = rebar_utils:ensure_dir(Target),
|
||||
Opts = [{outdir, "priv/mibs"}, {i, ["priv/mibs"]}] ++
|
||||
rebar_config:get(Config, mib_opts, []),
|
||||
case snmpc:compile(Source, Opts) of
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
sh/2, sh/3,
|
||||
sh_failfast/2,
|
||||
find_files/2,
|
||||
now_str/0]).
|
||||
now_str/0,
|
||||
ensure_dir/1]).
|
||||
|
||||
-include("rebar.hrl").
|
||||
|
||||
|
@ -89,6 +90,24 @@ now_str() ->
|
|||
lists:flatten(io_lib:format("~4b/~2..0b/~2..0b ~2..0b:~2..0b:~2..0b",
|
||||
[Year, Month, Day, Hour, Minute, Second])).
|
||||
|
||||
%% TODO: Review why filelib:ensure_dir/1 sometimes returns {error, eexist}.
|
||||
%% There appears to be a race condition when calling ensure_dir from
|
||||
%% multiple processes simultaneously.
|
||||
%% This does not happen with -j1 but with anything higher than that.
|
||||
%% So -j2 or default jobs setting will reveal the issue.
|
||||
%% To reproduce make sure that the priv/mibs directory does not exist
|
||||
%% $ rm -r priv
|
||||
%% $ ./rebar -v compile
|
||||
ensure_dir(Path) ->
|
||||
case filelib:ensure_dir(Path) of
|
||||
ok ->
|
||||
ok;
|
||||
{error,eexist} ->
|
||||
ok;
|
||||
Error ->
|
||||
Error
|
||||
end.
|
||||
|
||||
%% ====================================================================
|
||||
%% Internal functions
|
||||
%% ====================================================================
|
||||
|
|
Loading…
Reference in a new issue