diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-01-26 10:05:13 -0500 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-01-26 10:05:13 -0500 |
commit | 3bb1f3720eee65c3f21f0f1081435a8756b4f3e5 (patch) | |
tree | bcea281769d1ae8f887157c3212e197745237153 | |
parent | ea8aafc73dfe3dfa549c135011eccfbcc2b4d2b5 (diff) | |
parent | ebb713449e377f88c8c04e91a8a8257fdc0c21bd (diff) |
Merge pull request #114 from tsloughter/lock_dups
check locks before locking a dep to not have duplicates
-rw-r--r-- | src/rebar_prv_install_deps.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index d3eb306..701ee2a 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -205,8 +205,15 @@ maybe_lock(Profile, AppInfo, Seen, State, Level) -> default -> case sets:is_element(Name, Seen) of false -> - {sets:add_element(Name, Seen), - rebar_state:lock(State, rebar_app_info:dep_level(AppInfo, Level))}; + AppName = rebar_app_info:name(AppInfo), + Locks = rebar_state:lock(State), + case lists:any(fun(App) -> rebar_app_info:name(App) =:= AppName end, Locks) of + true -> + {sets:add_element(Name, Seen), State}; + false -> + {sets:add_element(Name, Seen), + rebar_state:lock(State, rebar_app_info:dep_level(AppInfo, Level))} + end; true -> {Seen, State} end; |