aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2021-03-26 15:12:38 +0100
committerJean-Sébastien Pédron <[email protected]>2021-03-26 15:14:14 +0100
commitd80984c1036ea81eb1f44b8d7cde85fc09b5e3c0 (patch)
treea9f994f92075714faf62b03d4500e136590b3436
parente5c0d04cb2e208f37e089ef3ff8d74aca5abed28 (diff)
downloaderlang.mk-d80984c1036ea81eb1f44b8d7cde85fc09b5e3c0.tar.gz
erlang.mk-d80984c1036ea81eb1f44b8d7cde85fc09b5e3c0.tar.bz2
erlang.mk-d80984c1036ea81eb1f44b8d7cde85fc09b5e3c0.zip
core/deps.mk: Support Rebar lock files with version "1.2.0"
This is the case in erlang-systemd [1]. As far as I can tell, the format is the same for the bits Erlang.mk is interested in. The testsuite is expanded to use version 0.6.0 of erlang-systemd. [1] https://github.com/rabbitmq/erlang-systemd
-rw-r--r--core/deps.mk17
-rw-r--r--test/core_deps.mk8
2 files changed, 20 insertions, 5 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 6d6623b..afe3f52 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -382,8 +382,19 @@ define dep_autopatch_rebar.erl
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} ->
+ LockPkgs = case lists:keyfind("1.2.0", 1, Lock) of
+ {_, LP} ->
+ LP;
+ _ ->
+ case lists:keyfind("1.1.0", 1, Lock) of
+ {_, LP} ->
+ LP;
+ _ ->
+ false
+ end
+ end,
+ if
+ is_list(LockPkgs) ->
io:format("~p~n", [LockPkgs]),
case lists:keyfind(atom_to_binary(N, latin1), 1, LockPkgs) of
{_, {pkg, _, Vsn}, _} ->
@@ -392,7 +403,7 @@ define dep_autopatch_rebar.erl
_ ->
false
end;
- _ ->
+ true ->
false
end;
_ ->
diff --git a/test/core_deps.mk b/test/core_deps.mk
index 973ff5d..5b46000 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -600,7 +600,7 @@ core-deps-fetch-hex: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy systemd\ndep_cowboy = hex 1.0.0\ndep_systemd = hex 0.6.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
@@ -614,13 +614,17 @@ endif
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
+ $t test -d $(APP)/deps/systemd
+ $t test -d $(APP)/deps/enough
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
- [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
+ [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch, systemd, enough]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
+ true = lists:member(systemd, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
+ {ok, \"0.6.0\"} = application:get_key(systemd, vsn), \
halt()"
# @todo Enable this test again when a host provides Mercurial again.