From 6cfe28c954dc12f847a15a78b5fcf65154f0407a Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Sat, 6 Dec 2014 16:29:44 +0000 Subject: Partial fix to circular deps (#40) - Adding tests - fixing use of set fetching to find repeated deps and prevent infinite loops On a circular loop rebar3 now fails with `{error, no_sort}`, which is uncaught and should be handled to consider the issue fully fixed. --- src/rebar_prv_install_deps.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl index a3ffc66..461baa5 100644 --- a/src/rebar_prv_install_deps.erl +++ b/src/rebar_prv_install_deps.erl @@ -151,7 +151,7 @@ update_pkg_deps(Pkgs, Packages, Update, Seen, State) -> ,Packages ,Pkg), {SeenAcc1, StateAcc1} = maybe_lock(AppInfo, SeenAcc, StateAcc), - case maybe_fetch(StateAcc1, AppInfo, Update, SeenAcc) of + case maybe_fetch(StateAcc1, AppInfo, Update, SeenAcc1) of true -> {[AppInfo | Acc], SeenAcc1, StateAcc1}; false -> @@ -167,7 +167,7 @@ maybe_lock(AppInfo, Seen, State) -> {sets:add_element(Name, Seen), rebar_state:lock(State, AppInfo)}; true -> - {sets:add_element(Name, Seen), State} + {Seen, State} end. package_to_app(DepsDir, Packages, {Name, Vsn}) -> @@ -204,7 +204,7 @@ update_src_deps(Level, SrcDeps, PkgDeps, SrcApps, State, Update, Seen) -> ,Level ,StateAcc1); _ -> - maybe_fetch(StateAcc, AppInfo, false, SeenAcc), + maybe_fetch(StateAcc, AppInfo, false, SeenAcc1), handle_dep(AppInfo ,SrcDepsAcc ,PkgDepsAcc -- cgit v1.1