summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebar.lock6
-rw-r--r--src/rebar_packages.erl11
-rw-r--r--src/rebar_prv_install_deps.erl2
-rw-r--r--src/rebar_prv_update.erl13
4 files changed, 18 insertions, 14 deletions
diff --git a/rebar.lock b/rebar.lock
index 79be02c..f4afed9 100644
--- a/rebar.lock
+++ b/rebar.lock
@@ -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]