WIP: AE_DISABLE_CUCKOO env var support #36
16
rebar.config.script
Normal file
16
rebar.config.script
Normal file
@ -0,0 +1,16 @@
|
||||
%% -*- mode:erlang; erlang-indent-level:4; indent-tabs-mode:nil -*-
|
||||
case os:getenv("AE_DISABLE_CUCKOO") =/= false of
|
||||
true ->
|
||||
RemoveApps = [aecuckoo, aecuckooprebuilt],
|
||||
RemovePlugins = [rebar_aecuckooprebuilt_dep],
|
||||
{_, Deps} = lists:keyfind(deps, 1, CONFIG),
|
||||
NewDeps = [D || D <- Deps,
|
||||
not lists:member(element(1,D), RemoveApps)],
|
||||
Plugins = proplists:get_value(plugins, CONFIG, []),
|
||||
CONFIG1 = lists:keyreplace(deps, 1, CONFIG, {deps, NewDeps}),
|
||||
Plugins1 = [P || P <- Plugins,
|
||||
not lists:member(element(1,P), RemovePlugins)],
|
||||
lists:keystore(plugins, 1, CONFIG1, {plugins, Plugins1});
|
||||
false ->
|
||||
CONFIG
|
||||
end.
|
29
rebar.lock.script
Normal file
29
rebar.lock.script
Normal file
@ -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.
|
18
src/aeminer.app.src.script
Normal file
18
src/aeminer.app.src.script
Normal file
@ -0,0 +1,18 @@
|
||||
%% -*- mode:erlang; erlang-indent-level:4; indent-tabs-mode:nil -*-
|
||||
|
||||
RemoveApps = [aecuckoo, aecuckooprebuilt].
|
||||
Base = filename:basename(SCRIPT, ".script").
|
||||
Dir = filename:dirname(SCRIPT).
|
||||
{ok, [{application,_,Opts} = App]} = file:consult(filename:join(Dir, Base)).
|
||||
case os:getenv("AE_DISABLE_CUCKOO") =/= false of
|
||||
true ->
|
||||
{_, Apps} = lists:keyfind(applications, 1, Opts),
|
||||
Env = proplists:get_value(env, Opts, []),
|
||||
Env1 = lists:keystore(use_cuckoo, 1, Env, {use_cuckoo, false}),
|
||||
Apps1 = Apps -- RemoveApps,
|
||||
Opts1 = lists:keyreplace(applications, 1, Opts, {applications, Apps1}),
|
||||
Opts2 = lists:keystore(env, 1, Opts1, {env, Env1}),
|
||||
setelement(3, App, Opts2);
|
||||
false ->
|
||||
App
|
||||
end.
|
Loading…
x
Reference in New Issue
Block a user