summaryrefslogtreecommitdiff
path: root/src/rebar_prv_install_deps.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_install_deps.erl')
-rw-r--r--src/rebar_prv_install_deps.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 245dcb2..09032d7 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -165,7 +165,6 @@ handle_src_deps(Deps, Found, Goals) ->
C = rebar_config:consult(rebar_app_info:dir(X)),
S = rebar_state:new(rebar_state:new(), C, rebar_app_info:dir(X)),
{ParsedDeps, NewGoals} = parse_deps(rebar_state:get(S, deps, [])),
- %lists:keymerge(2, DepsAcc, ParsedDeps)
{ParsedDeps++DepsAcc, NewGoals++GoalsAcc}
end, {Deps, Goals}, Found).
@@ -198,7 +197,8 @@ download_missing_deps(State, DepsDir, Found, Unbuilt, Deps) ->
parse_deps(Deps) ->
lists:foldl(fun({Name, Vsn}, {SrcDepsAcc, GoalsAcc}) ->
- {SrcDepsAcc, [{ec_cnv:to_binary(Name), ec_cnv:to_binary(Vsn)} | GoalsAcc]};
+ {SrcDepsAcc, [parse_goal(ec_cnv:to_binary(Name)
+ ,ec_cnv:to_binary(Vsn)) | GoalsAcc]};
(Name, {SrcDepsAcc, GoalsAcc}) when is_atom(Name) ->
{SrcDepsAcc, [ec_cnv:to_binary(Name) | GoalsAcc]};
(SrcDep, {SrcDepsAcc, GoalsAcc}) ->
@@ -206,6 +206,16 @@ parse_deps(Deps) ->
{[Dep | SrcDepsAcc], GoalsAcc}
end, {[], []}, Deps).
+parse_goal(Name, Constraint) ->
+ case re:run(Constraint, "([^\\d]*)(\\d.*)", [{capture, [1,2], binary}]) of
+ {match, [<<>>, Vsn]} ->
+ {Name, Vsn};
+ {match, [Op, Vsn]} ->
+ {Name, Vsn, binary_to_atom(Op, utf8)};
+ nomatch ->
+ fail
+ end.
+
info(Description) ->
io_lib:format("~s.~n"
"~n"