diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-11-01 13:17:52 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-11-01 13:17:52 -0500 |
commit | 35d1afd2f69aa604ec1a44ac511092dc5a40e12c (patch) | |
tree | 25e261845a06234fd59db8df0e262872182f0422 /src/rebar_prv_install_deps.erl | |
parent | 6c1201f1ace6870adb5547a8e4f2fb1f22106cc2 (diff) |
verify checked out dep is the same as specified in the config and update if not
Diffstat (limited to 'src/rebar_prv_install_deps.erl')
-rw-r--r-- | src/rebar_prv_install_deps.erl | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index a4be809..6ae3042 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -86,7 +86,7 @@ do(State) -> end catch _:Reason -> - Reason + {error, Reason} end. -spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}. @@ -267,15 +267,30 @@ maybe_fetch(AppInfo, Update, Seen) -> ?INFO("Fetching ~s~n", [rebar_app_info:name(AppInfo)]), Source = rebar_app_info:source(AppInfo), case rebar_fetch:download_source(AppDir, Source) of - {error, _}=Error -> - throw(Error); + {error, Reason} -> + throw(Reason); Result -> Result end; _ -> - io:format("Was ~p seen: ~p~n", [rebar_app_info:name(AppInfo) - ,sets:is_element(rebar_app_info:name(AppInfo), Seen)]), - false + case sets:is_element(rebar_app_info:name(AppInfo), Seen) of + true -> + false; + false -> + Source = rebar_app_info:source(AppInfo), + case rebar_fetch:needs_update(AppDir, Source) of + true -> + ?INFO("Updating ~s~n", [rebar_app_info:name(AppInfo)]), + case rebar_fetch:download_source(AppDir, Source) of + {error, Reason} -> + throw(Reason); + Result -> + Result + end; + false -> + false + end + end end end. |