diff options
author | Eric <[email protected]> | 2013-05-09 17:13:06 -0700 |
---|---|---|
committer | Eric <[email protected]> | 2013-05-10 11:09:49 -0700 |
commit | c5f0a8c9175b2d152c69f72da15e7ceff411f86b (patch) | |
tree | 1ae9a327feeb420983f9a85fdb6c800900369480 /src/rlx_depsolver_culprit.erl | |
parent | efbdfbe117939cd50d0252a210b9b7634de42bb4 (diff) | |
download | relx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.tar.gz relx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.tar.bz2 relx-c5f0a8c9175b2d152c69f72da15e7ceff411f86b.zip |
internal rename completion of all relcool to relx calls
Diffstat (limited to 'src/rlx_depsolver_culprit.erl')
-rw-r--r-- | src/rlx_depsolver_culprit.erl | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/rlx_depsolver_culprit.erl b/src/rlx_depsolver_culprit.erl index f2115c7..cf6dcb2 100644 --- a/src/rlx_depsolver_culprit.erl +++ b/src/rlx_depsolver_culprit.erl @@ -28,7 +28,7 @@ %%% goal, and the good apps (those not immediately constrained from %%% the goals). %%% @end --module(rcl_depsolver_culprit). +-module(rlx_depsolver_culprit). -export([search/3, format_error/1, @@ -46,10 +46,10 @@ %%============================================================================ %% @doc start running the solver, with each run reduce the number of constraints %% set as goals. At some point the solver should succeed. --spec search(rcl_depsolver:dep_graph(), [rcl_depsolver:constraint()], [rcl_depsolver:constraint()]) +-spec search(rlx_depsolver:dep_graph(), [rlx_depsolver:constraint()], [rlx_depsolver:constraint()]) -> term(). search(State, ActiveCons, []) -> - case rcl_depsolver:primitive_solve(State, ActiveCons, keep_paths) of + case rlx_depsolver:primitive_solve(State, ActiveCons, keep_paths) of {fail, FailPaths} -> extract_culprit_information0(ActiveCons, lists:flatten(FailPaths)); _Success -> @@ -59,7 +59,7 @@ search(State, ActiveCons, []) -> inconsistant_graph_state end; search(State, ActiveCons, [NewCon | Constraints]) -> - case rcl_depsolver:primitive_solve(State, ActiveCons, keep_paths) of + case rlx_depsolver:primitive_solve(State, ActiveCons, keep_paths) of {fail, FailPaths} -> extract_culprit_information0(ActiveCons, lists:flatten(FailPaths)); _Success -> @@ -84,7 +84,7 @@ format_error(Details) when erlang:is_list(Details) -> ["Unable to solve constraints, the following solutions were attempted \n\n", [[format_error_path(" ", Detail)] || Detail <- Details]]. --spec format_roots([rcl_depsolver:constraints()]) -> iolist(). +-spec format_roots([rlx_depsolver:constraints()]) -> iolist(). format_roots(Roots) -> lists:foldl(fun(Root, Acc0) -> lists:foldl( @@ -95,9 +95,9 @@ format_roots(Roots) -> end, Acc0, Root) end, [], Roots). --spec format_culprits([{[rcl_depsolver:constraint()], [rcl_depsolver:constraint()]}]) -> iolist(). +-spec format_culprits([{[rlx_depsolver:constraint()], [rlx_depsolver:constraint()]}]) -> iolist(). format_culprits(FailingDeps) -> - Deps = sets:to_list(sets:from_list(lists:flatten([[rcl_depsolver:dep_pkg(Con) || Con <- Cons] + Deps = sets:to_list(sets:from_list(lists:flatten([[rlx_depsolver:dep_pkg(Con) || Con <- Cons] || {_, Cons} <- FailingDeps]))), lists:foldl(fun(Con, "") -> [format_constraint(Con)]; @@ -106,11 +106,11 @@ format_culprits(FailingDeps) -> ", " | Acc1] end, [], Deps). --spec format_version(rcl_depsolver:vsn()) -> iolist(). +-spec format_version(rlx_depsolver:vsn()) -> iolist(). format_version(Vsn) -> ec_semver:format(Vsn). --spec format_constraint(rcl_depsolver:constraint()) -> list(). +-spec format_constraint(rlx_depsolver:constraint()) -> list(). format_constraint(Pkg) when is_atom(Pkg) -> erlang:atom_to_list(Pkg); format_constraint(Pkg) when is_binary(Pkg) -> @@ -170,8 +170,8 @@ append_value(Key, Value, PropList) -> proplists:delete(Key, PropList)] end. --spec strip_goal([[rcl_depsolver:pkg()] | rcl_depsolver:pkg()]) -> - [[rcl_depsolver:pkg()] | rcl_depsolver:pkg()]. +-spec strip_goal([[rlx_depsolver:pkg()] | rlx_depsolver:pkg()]) -> + [[rlx_depsolver:pkg()] | rlx_depsolver:pkg()]. strip_goal([{'_GOAL_', 'NO_VSN'}, Children]) -> Children; strip_goal(All = [Val | _]) @@ -180,25 +180,25 @@ strip_goal(All = [Val | _]) strip_goal(Else) -> Else. --spec extract_culprit_information0(rcl_depsolver:constraints(), - [rcl_depsolver:fail_info()]) -> +-spec extract_culprit_information0(rlx_depsolver:constraints(), + [rlx_depsolver:fail_info()]) -> [term()]. extract_culprit_information0(ActiveCons, FailInfo) when is_list(FailInfo) -> [extract_culprit_information1(ActiveCons, FI) || FI <- FailInfo]. --spec extract_root(rcl_depsolver:constraints(), [rcl_depsolver:pkg()]) -> - {[rcl_depsolver:constraint()], [rcl_depsolver:pkg()]}. +-spec extract_root(rlx_depsolver:constraints(), [rlx_depsolver:pkg()]) -> + {[rlx_depsolver:constraint()], [rlx_depsolver:pkg()]}. extract_root(ActiveCons, TPath = [PRoot | _]) -> - RootName = rcl_depsolver:dep_pkg(PRoot), + RootName = rlx_depsolver:dep_pkg(PRoot), Roots = lists:filter(fun(El) -> - RootName =:= rcl_depsolver:dep_pkg(El) + RootName =:= rlx_depsolver:dep_pkg(El) end, ActiveCons), {Roots, TPath}. --spec extract_culprit_information1(rcl_depsolver:constraints(), - rcl_depsolver:fail_info()) -> +-spec extract_culprit_information1(rlx_depsolver:constraints(), + rlx_depsolver:fail_info()) -> term(). extract_culprit_information1(_ActiveCons, {[], RawConstraints}) -> %% In this case where there was no realized versions, the GOAL @@ -226,9 +226,9 @@ extract_culprit_information1(ActiveCons, {Path, RawConstraints}) -> RunListItems = [extract_root(ActiveCons, TPath) || TPath <- TreedPath], {RunListItems, FailCons}. --spec follow_chain(rcl_depsolver:pkg_name(), rcl_depsolver:vsn(), - {rcl_depsolver:constraint(), rcl_depsolver:pkg()}) -> - false | {ok, rcl_depsolver:constraint()}. +-spec follow_chain(rlx_depsolver:pkg_name(), rlx_depsolver:vsn(), + {rlx_depsolver:constraint(), rlx_depsolver:pkg()}) -> + false | {ok, rlx_depsolver:constraint()}. follow_chain(Pkg, Vsn, {{Pkg, Vsn}, {Pkg, Vsn}}) -> %% When the package version is the same as the source we dont want to try to follow it at all false; @@ -237,9 +237,9 @@ follow_chain(Pkg, Vsn, {Con, {Pkg, Vsn}}) -> follow_chain(_Pkg, _Vsn, _) -> false. --spec find_chain(rcl_depsolver:pkg_name(), rcl_depsolver:vsn(), - [{rcl_depsolver:constraint(), rcl_depsolver:pkg()}]) -> - rcl_depsolver:constraints(). +-spec find_chain(rlx_depsolver:pkg_name(), rlx_depsolver:vsn(), + [{rlx_depsolver:constraint(), rlx_depsolver:pkg()}]) -> + rlx_depsolver:constraints(). find_chain(Pkg, Vsn, Constraints) -> lists:foldl(fun(NCon, Acc) -> case follow_chain(Pkg, Vsn, NCon) of @@ -250,46 +250,46 @@ find_chain(Pkg, Vsn, Constraints) -> end end, [], Constraints). --spec get_constraints(rcl_depsolver:pkg_name(), rcl_depsolver:vsn(), [rcl_depsolver:pkg()], - [{rcl_depsolver:constraint(), rcl_depsolver:pkg()}]) -> - rcl_depsolver:constraints(). +-spec get_constraints(rlx_depsolver:pkg_name(), rlx_depsolver:vsn(), [rlx_depsolver:pkg()], + [{rlx_depsolver:constraint(), rlx_depsolver:pkg()}]) -> + rlx_depsolver:constraints(). get_constraints(FailedPkg, FailedVsn, Path, Constraints) -> Chain = find_chain(FailedPkg, FailedVsn, Constraints), lists:filter(fun(Con) -> - PkgName = rcl_depsolver:dep_pkg(Con), + PkgName = rlx_depsolver:dep_pkg(Con), (lists:any(fun(PathEl) -> - not rcl_depsolver:filter_package(PathEl, Con) + not rlx_depsolver:filter_package(PathEl, Con) end, Path) orelse not lists:keymember(PkgName, 1, Path)) end, Chain). --spec pkg_vsn(rcl_depsolver:constraint(), [{rcl_depsolver:constraint(), - rcl_depsolver:pkg()}]) -> - [rcl_depsolver:pkg()]. +-spec pkg_vsn(rlx_depsolver:constraint(), [{rlx_depsolver:constraint(), + rlx_depsolver:pkg()}]) -> + [rlx_depsolver:pkg()]. pkg_vsn(PkgCon, Constraints) -> - PkgName = rcl_depsolver:dep_pkg(PkgCon), + PkgName = rlx_depsolver:dep_pkg(PkgCon), [DepPkg || Con = {DepPkg, _} <- Constraints, case Con of {Pkg = {PkgName, PkgVsn}, {PkgName, PkgVsn}} -> - rcl_depsolver:filter_package(Pkg, PkgCon); + rlx_depsolver:filter_package(Pkg, PkgCon); _ -> false end]. --spec depends(rcl_depsolver:pkg(), [{rcl_depsolver:constraint(), - rcl_depsolver:pkg()}], - [rcl_depsolver:pkg()]) -> - [rcl_depsolver:pkg()]. +-spec depends(rlx_depsolver:pkg(), [{rlx_depsolver:constraint(), + rlx_depsolver:pkg()}], + [rlx_depsolver:pkg()]) -> + [rlx_depsolver:pkg()]. depends(SrcPkg, Constraints, Seen) -> lists:flatten([pkg_vsn(Pkg, Constraints) || {Pkg, Source} <- Constraints, Source =:= SrcPkg andalso Pkg =/= SrcPkg andalso not lists:member(Pkg, Seen)]). --spec treeize_path(rcl_depsolver:pkg(), [{rcl_depsolver:constraint(), - rcl_depsolver:pkg()}], - [rcl_depsolver:pkg()]) -> - [rcl_depsolver:pkg() | [rcl_depsolver:pkg()]]. +-spec treeize_path(rlx_depsolver:pkg(), [{rlx_depsolver:constraint(), + rlx_depsolver:pkg()}], + [rlx_depsolver:pkg()]) -> + [rlx_depsolver:pkg() | [rlx_depsolver:pkg()]]. treeize_path(Pkg, Constraints, Seen0) -> Seen1 = [Pkg | Seen0], case depends(Pkg, Constraints, Seen1) of @@ -310,7 +310,7 @@ add_s(Roots) -> "" end. --spec format_path(string(), [rcl_depsolver:pkg()]) -> iolist(). +-spec format_path(string(), [rlx_depsolver:pkg()]) -> iolist(). format_path(CurrentIdent, Path) -> [CurrentIdent, " ", lists:foldl(fun(Con, "") -> @@ -320,8 +320,8 @@ format_path(CurrentIdent, Path) -> end, "", Path), "\n"]. --spec format_dependency_paths(string(), [[rcl_depsolver:pkg()] | rcl_depsolver:pkg()], - [{rcl_depsolver:pkg(), [rcl_depsolver:constraint()]}], [rcl_depsolver:pkg()]) -> iolist(). +-spec format_dependency_paths(string(), [[rlx_depsolver:pkg()] | rlx_depsolver:pkg()], + [{rlx_depsolver:pkg(), [rlx_depsolver:constraint()]}], [rlx_depsolver:pkg()]) -> iolist(). format_dependency_paths(CurrentIndent, [SubPath | Rest], FailingDeps, Acc) when erlang:is_list(SubPath) -> [format_dependency_paths(CurrentIndent, lists:sort(SubPath), FailingDeps, Acc), @@ -348,8 +348,8 @@ format_dependency_paths(CurrentIndent, [Con | Rest], FailingDeps, Acc) -> format_dependency_paths(_CurrentIndent, [], _FailingDeps, _Acc) -> []. --spec format_error_path(string(), {[{[rcl_depsolver:constraint()], [rcl_depsolver:pkg()]}], - [rcl_depsolver:constraint()]}) -> iolist(). +-spec format_error_path(string(), {[{[rlx_depsolver:constraint()], [rlx_depsolver:pkg()]}], + [rlx_depsolver:constraint()]}) -> iolist(). format_error_path(CurrentIndent, {RawPaths, FailingDeps}) -> Roots = [RootSet || {RootSet, _} <- RawPaths], Paths = [Path || {_, Path} <- RawPaths], |