From a7b1a70e422a93f3e43fa492e1bed80e21abb83c Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 31 Oct 2019 15:26:25 +0100 Subject: [PATCH] Filter rebar.lock if disabling cuckoo --- rebar.lock.script | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 rebar.lock.script diff --git a/rebar.lock.script b/rebar.lock.script new file mode 100644 index 0000000..534e836 --- /dev/null +++ b/rebar.lock.script @@ -0,0 +1,29 @@ +%% -*- erlang -*- + +FilterCheck = (os:getenv("AE_DISABLE_CUCKOO") =/= false), +RemoveApps = [<<"aecuckoo">>, <<"aecuckooprebuilt">>], + +Filter = fun(Apps) -> + case FilterCheck of + false -> + Apps; + true -> + lists:foldl( + fun(App, Acc) -> + lists:keydelete(App, 1, Acc) + end, + Apps, + RemoveApps + ) + end + end, + +case CONFIG of + [] -> + %% no lock file present, usually during unlock/upgrade + CONFIG; + [{Version, Deps}, [{pkg_hash, Pkgs}]] -> + Deps1 = Filter(Deps), + Pkgs1 = Filter(Pkgs), + [{Version, Deps1}, [{pkg_hash, Pkgs1}]] +end.