From a22f31ebf0f97025d6534bfce448e85a421af1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 5 Mar 2018 13:22:24 +0100 Subject: Fetch the version from rebar.lock if not specified in rebar.config This fixes hackney. --- core/deps.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/deps.mk b/core/deps.mk index 3fdb735..f694708 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -269,11 +269,33 @@ define dep_autopatch_rebar.erl end, Write("\n") end(), + GetHexVsn = fun(N) -> + case file:consult("$(call core_native_path,$(DEPS_DIR)/$1/rebar.lock)") of + {ok, Lock} -> + io:format("~p~n", [Lock]), + case lists:keyfind("1.1.0", 1, Lock) of + {_, LockPkgs} -> + io:format("~p~n", [LockPkgs]), + case lists:keyfind(atom_to_binary(N, latin1), 1, LockPkgs) of + {_, {pkg, _, Vsn}, _} -> + io:format("~p~n", [Vsn]), + {N, {hex, binary_to_list(Vsn)}}; + _ -> + false + end; + _ -> + false + end; + _ -> + false + end + end, fun() -> File = case lists:keyfind(deps, 1, Conf) of false -> []; {_, Deps} -> [begin case case Dep of + N when is_atom(N) -> GetHexVsn(N); {N, S} when is_atom(N), is_list(S) -> {N, {hex, S}}; {N, S} when is_tuple(S) -> {N, S}; {N, _, S} -> {N, S}; -- cgit v1.2.3