From 31a24ad4ffb6a121819087da2cb9b58db5bd287d Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 19 Aug 2015 22:41:33 -0500 Subject: this patch treats pkg and src deps as equals, so level decides winner Instead fetching and resolving src deps (which could depend on pkg deps) and then pkg deps this patch combines the two into a single set of iterations by level. The only difference between src and pkg deps in this new install_deps is how their deps list is found -- from the config or lock file for src deps and from the neighbors of the vertex for pkg. --- test/mock_pkg_resource.erl | 4 +++- test/rebar_deps_SUITE.erl | 2 +- test/rebar_install_deps_SUITE.erl | 28 ++++------------------------ 3 files changed, 8 insertions(+), 26 deletions(-) (limited to 'test') diff --git a/test/mock_pkg_resource.erl b/test/mock_pkg_resource.erl index e5c5645..9258f72 100644 --- a/test/mock_pkg_resource.erl +++ b/test/mock_pkg_resource.erl @@ -119,7 +119,9 @@ mock_pkg_index(Opts) -> meck:expect(rebar_state, registry, fun(_State) -> {ok, to_registry(Deps)} end), meck:expect(rebar_state, packages, - fun(_State) -> {Dict, Digraph} end). + fun(_State) -> Dict end), + meck:expect(rebar_state, packages_graph, + fun(_State) -> Digraph end). %%%%%%%%%%%%%%% %%% Helpers %%% diff --git a/test/rebar_deps_SUITE.erl b/test/rebar_deps_SUITE.erl index 04018fc..fd86226 100644 --- a/test/rebar_deps_SUITE.erl +++ b/test/rebar_deps_SUITE.erl @@ -297,5 +297,5 @@ in_warnings(git, Warns, NameRaw, VsnRaw) -> in_warnings(pkg, Warns, NameRaw, VsnRaw) -> Name = iolist_to_binary(NameRaw), Vsn = iolist_to_binary(VsnRaw), - 1 =< length([1 || {_, [AppName, AppVsn]} <- Warns, + 1 =< length([1 || {_, [AppName, {pkg, _, AppVsn}]} <- Warns, AppName =:= Name, AppVsn =:= Vsn]). diff --git a/test/rebar_install_deps_SUITE.erl b/test/rebar_install_deps_SUITE.erl index 66c762e..9d536d1 100644 --- a/test/rebar_install_deps_SUITE.erl +++ b/test/rebar_install_deps_SUITE.erl @@ -15,9 +15,9 @@ groups() -> {git, [], [{group, unique}]}, {pkg, [], [{group, unique}]}, {mixed, [], [ - m_flat1, m_flat2, m_circular1, m_circular2, m_circular3, + 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_source_to_pkg, m_pkg_level1, m_pkg_level2, m_pkg_level3, m_pkg_level3_alpha_order ]} ]. @@ -199,39 +199,22 @@ mdeps(m_circular2) -> {[{"B", [{"c", [{"b", []}]}]}], [], {error, {rebar_prv_install_deps, {cycles, [[<<"B">>,<<"C">>]]}}}}; -mdeps(m_circular3) -> - %% Spot the circular dep due to being to low in the deps tree - %% but as a source dep, taking precedence over packages - {[{"B", [{"C", "2", [{"B", []}]}]}, - {"c", "1", [{"d",[]}]}], - [], - {error, {rebar_prv_install_deps, {cycles, [[<<"B">>,<<"C">>]]}}}}; mdeps(m_pick_source1) -> {[{"B", [{"D", []}]}, {"c", [{"d", []}]}], ["d"], {ok, ["B", "c", "D"]}}; mdeps(m_pick_source2) -> - {[{"b", [{"d", []}]}, - {"C", [{"D", []}]}], - ["d"], - {ok, ["b", "C", "D"]}}; -mdeps(m_pick_source3) -> %% The order of declaration is important. {[{"b", []}, {"B", []}], [], {ok, ["b"]}}; -mdeps(m_pick_source4) -> +mdeps(m_pick_source3) -> {[{"B", []}, {"b", []}], [], {ok, ["B"]}}; -mdeps(m_pick_source5) -> - {[{"B", [{"d", []}]}, - {"C", [{"D", []}]}], - ["d"], - {ok, ["B", "C", "D"]}}; mdeps(m_source_to_pkg) -> {[{"B", [{"c",[{"d", []}]}]}], [], @@ -438,12 +421,9 @@ m_flat1(Config) -> run(Config). m_flat2(Config) -> run(Config). m_circular1(Config) -> run(Config). m_circular2(Config) -> run(Config). -m_circular3(Config) -> run(Config). m_pick_source1(Config) -> run(Config). 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_source_to_pkg(Config) -> run(Config). m_pkg_level1(Config) -> run(Config). m_pkg_level2(Config) -> run(Config). @@ -483,5 +463,5 @@ in_warnings(git, Warns, NameRaw, VsnRaw) -> in_warnings(pkg, Warns, NameRaw, VsnRaw) -> Name = iolist_to_binary(NameRaw), Vsn = iolist_to_binary(VsnRaw), - 1 =< length([1 || {_, [AppName, AppVsn]} <- Warns, + 1 =< length([1 || {_, [AppName, {pkg, _, AppVsn}]} <- Warns, AppName =:= Name, AppVsn =:= Vsn]). -- cgit v1.1