summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_install_deps.erl24
-rw-r--r--test/rebar_install_deps_SUITE.erl15
2 files changed, 31 insertions, 8 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index bad5af4..068c4c8 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -259,9 +259,21 @@ update_seen_dep(AppInfo, _Profile, _Level, Deps, Apps, State, Upgrade, Seen, Loc
%% If seen from lock file or user requested an upgrade
%% don't print warning about skipping
case lists:keymember(Name, 1, Locks) of
- false when Upgrade -> ok;
- false when not Upgrade -> warn_skip_deps(AppInfo, State);
- true -> ok
+ false when Upgrade ->
+ ok;
+ false when not Upgrade ->
+ {ok, SeenApp} = rebar_app_utils:find(Name, Apps),
+ Source = rebar_app_info:source(AppInfo),
+ case rebar_app_info:source(SeenApp) of
+ Source ->
+ %% dep is the same version and checksum as the one we already saw.
+ %% meaning there is no conflict, so don't warn about it.
+ skip;
+ _ ->
+ warn_skip_deps(Name, Source, State)
+ end;
+ true ->
+ ok
end,
{Deps, Apps, State, Seen}.
@@ -395,11 +407,11 @@ maybe_upgrade(AppInfo, _AppDir, Upgrade, State) ->
AppInfo
end.
-warn_skip_deps(AppInfo, State) ->
+warn_skip_deps(Name, Source, State) ->
Msg = "Skipping ~ts (from ~p) as an app of the same name "
"has already been fetched",
- Args = [rebar_app_info:name(AppInfo),
- rebar_resource_v2:format_source(rebar_app_info:source(AppInfo))],
+ Args = [Name,
+ rebar_resource_v2:format_source(Source)],
case rebar_state:get(State, deps_error_on_conflict, false) of
false ->
case rebar_state:get(State, deps_warning_on_conflict, true) of
diff --git a/test/rebar_install_deps_SUITE.erl b/test/rebar_install_deps_SUITE.erl
index 04cc441..96b9d38 100644
--- a/test/rebar_install_deps_SUITE.erl
+++ b/test/rebar_install_deps_SUITE.erl
@@ -17,7 +17,7 @@ groups() ->
{mixed, [], [
m_flat1, m_flat2, m_circular1, m_circular2,
m_pick_source1, m_pick_source2, m_pick_source3,
- m_pick_source4, m_pick_source5, m_source_to_pkg,
+ m_pick_source4, m_pick_source5, m_pick_source6, m_source_to_pkg,
m_pkg_level1, m_pkg_level2, m_pkg_level3, m_pkg_level3_alpha_order
]}
].
@@ -93,6 +93,8 @@ format_expected_mdeps(Deps) ->
[{dep, N}, {lock, src, N, "0.0.0"}]
end || Dep <- Deps]).
+format_expected_mixed_warnings(none) ->
+ none;
format_expected_mixed_warnings(Warnings) ->
[case W of
{N, Vsn} when hd(N) >= $a, hd(N) =< $z -> {pkg, rebar_string:uppercase(N), Vsn};
@@ -225,6 +227,11 @@ mdeps(m_pick_source5) ->
{"C", [{"D", "1.0.0", []}]}],
[{"D", "1.0.0"}],
{ok, ["B", "C", {"d", "1.0.0"}]}};
+mdeps(m_pick_source6) ->
+ {[{"B", [{"D", "1.0.0", []}]},
+ {"C", [{"D", "1.0.0", []}]}],
+ none,
+ {ok, ["B", "C", {"D", "1.0.0"}]}};
mdeps(m_source_to_pkg) ->
{[{"B", [{"c",[{"d", []}]}]}],
[],
@@ -436,6 +443,7 @@ m_pick_source2(Config) -> run(Config).
m_pick_source3(Config) -> run(Config).
m_pick_source4(Config) -> run(Config).
m_pick_source5(Config) -> run(Config).
+m_pick_source6(Config) -> run(Config).
m_source_to_pkg(Config) -> run(Config).
m_pkg_level1(Config) -> run(Config).
m_pkg_level2(Config) -> run(Config).
@@ -466,7 +474,10 @@ check_warnings(Warns, [{Type, Name, Vsn} | Rest], mixed) ->
check_warnings(Warns, [{Name, Vsn} | Rest], Type) ->
ct:pal("Checking for warning ~p in ~p", [{Name,Vsn},Warns]),
?assert(in_warnings(Type, Warns, Name, Vsn)),
- check_warnings(Warns, Rest, Type).
+ check_warnings(Warns, Rest, Type);
+check_warnings(Warns, none, _Type) ->
+ ct:pal("Checking that there were no warnings", []),
+ ?assert(Warns == []).
in_warnings(git, Warns, NameRaw, VsnRaw) ->
Name = iolist_to_binary(NameRaw),