diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-05-04 15:38:49 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-05-04 16:34:10 -0500 |
commit | ce74589a56e14150493540302ce61d498cee0b27 (patch) | |
tree | cf538b3ae0545158b0c6c0866452a17fbd3b7aa2 | |
parent | f91e4a570ca3aa992f79a8f28d0c2ac43c3e9a12 (diff) |
handle missing package in registry by skipping
-rw-r--r-- | rebar.lock | 6 | ||||
-rw-r--r-- | src/rebar_packages.erl | 11 | ||||
-rw-r--r-- | src/rebar_prv_install_deps.erl | 2 | ||||
-rw-r--r-- | src/rebar_prv_update.erl | 13 |
4 files changed, 18 insertions, 14 deletions
@@ -1,8 +1,4 @@ -[{<<"relx">>, - {git,"https://github.com/tsloughter/relx.git", - {ref,"6e0d048d3840464539deddd9d5b53e9f421edee4"}}, - 0}, - {<<"providers">>, +[{<<"providers">>, {git,"https://github.com/tsloughter/providers.git", {ref,"7563ba7e916d5a35972b25b3aa1945ffe0a8e7a5"}}, 0}, diff --git a/src/rebar_packages.erl b/src/rebar_packages.erl index 8982573..fb2d094 100644 --- a/src/rebar_packages.erl +++ b/src/rebar_packages.erl @@ -73,14 +73,14 @@ find_highest_matching(Dep, Constraint, T) -> [{Dep, [[Vsn]]}] -> case ec_semver:pes(Vsn, Constraint) of true -> - Vsn; + {ok, Vsn}; false -> ?WARN("Only existing version of ~s is ~s which does not match constraint ~~> ~s. " "Using anyway, but it is not guarenteed to work.", [Dep, Vsn, Constraint]), - Vsn + {ok, Vsn} end; [{Dep, [[HeadVsn | VsnTail]]}] -> - lists:foldl(fun(Version, Highest) -> + {ok, lists:foldl(fun(Version, Highest) -> case ec_semver:pes(Version, Constraint) andalso ec_semver:gt(Version, Highest) of true -> @@ -88,5 +88,8 @@ find_highest_matching(Dep, Constraint, T) -> false -> Highest end - end, HeadVsn, VsnTail) + end, HeadVsn, VsnTail)}; + [] -> + ?WARN("Missing registry entry for package ~s", [Dep]), + none end. diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index 17346f4..5aa34c3 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -626,7 +626,7 @@ not_needs_compile(App) -> get_package(Dep, State) -> case rebar_state:registry(State) of {ok, T} -> - HighestDepVsn = rebar_packages:find_highest_matching(Dep, "0", T), + {ok, HighestDepVsn} = rebar_packages:find_highest_matching(Dep, "0", T), {Dep, HighestDepVsn}; error -> throw(?PRV_ERROR({load_registry_fail, Dep})) diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl index d0ff889..973b275 100644 --- a/src/rebar_prv_update.erl +++ b/src/rebar_prv_update.erl @@ -52,7 +52,8 @@ do(State) -> write_registry(Dict, Graph, State), ok catch - _E:_C -> + _E:C -> + ?DEBUG("Error creating package index: ~p ~p", [C, erlang:get_stacktrace()]), throw(?PRV_ERROR(package_index_write)) end, @@ -94,9 +95,13 @@ update_graph(Pkg, PkgVsn, Deps, HexRegistry, Graph) -> lists:foldl(fun([Dep, DepVsn, false, _AppName | _], DepsListAcc) -> case DepVsn of <<"~> ", Vsn/binary>> -> - HighestDepVsn = rebar_packages:find_highest_matching(Dep, Vsn, HexRegistry), - digraph:add_edge(Graph, {Pkg, PkgVsn}, {Dep, HighestDepVsn}), - [{Dep, DepVsn} | DepsListAcc]; + case rebar_packages:find_highest_matching(Dep, Vsn, HexRegistry) of + {ok, HighestDepVsn} -> + digraph:add_edge(Graph, {Pkg, PkgVsn}, {Dep, HighestDepVsn}), + [{Dep, DepVsn} | DepsListAcc]; + none -> + DepsListAcc + end; Vsn -> digraph:add_edge(Graph, {Pkg, PkgVsn}, {Dep, Vsn}), [{Dep, Vsn} | DepsListAcc] |