Browse Source

handle missing package in registry by skipping

pull/387/head
Tristan Sloughter 10 years ago
parent
commit
ce74589a56
4 changed files with 18 additions and 14 deletions
  1. +1
    -5
      rebar.lock
  2. +7
    -4
      src/rebar_packages.erl
  3. +1
    -1
      src/rebar_prv_install_deps.erl
  4. +9
    -4
      src/rebar_prv_update.erl

+ 1
- 5
rebar.lock View File

@ -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},

+ 7
- 4
src/rebar_packages.erl View File

@ -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.

+ 1
- 1
src/rebar_prv_install_deps.erl View File

@ -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}))

+ 9
- 4
src/rebar_prv_update.erl View File

@ -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]

Loading…
Cancel
Save