diff options
author | Jan Lehnardt <jan@apache.org> | 2021-03-15 11:21:05 +0100 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2021-03-17 15:32:49 +0100 |
commit | 7e0661bf8af7a37b183aef225d68fce2c50fa815 (patch) | |
tree | 8a553c91117bcfbd52e0f9c64c8ca293cb0a9d2c | |
parent | 145597568c901f52c1d06f71ff6fbb0a56498fb8 (diff) | |
download | couchdb-7e0661bf8af7a37b183aef225d68fce2c50fa815.tar.gz |
chore: simplify version detection h/t @vatamane
-rw-r--r-- | rebar.config.script | 5 | ||||
-rw-r--r-- | src/couch/include/couch_db.hrl | 9 | ||||
-rw-r--r-- | src/couch/rebar.config.script | 3 | ||||
-rw-r--r-- | src/mango/rebar.config.script | 3 |
4 files changed, 6 insertions, 14 deletions
diff --git a/rebar.config.script b/rebar.config.script index c4dc7e739..e37a43257 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -92,9 +92,6 @@ case VerList of _ -> ok end. -[OptMajorVersion|_] = VerList. -OtpMajorVersion20 = case OptMajorVersion of 20 -> "true"; _ -> "false" end. -os:putenv("COUCHDB_OTP_MAJOR_VERSION_20", OtpMajorVersion20). % Set the path to the configuration environment generated % by `./configure`. @@ -203,7 +200,7 @@ AddConfig = [ {deps, lists:map(MakeDep, DepDescs ++ OptionalDeps)}, {sub_dirs, SubDirs}, {lib_dirs, ["src"]}, - {erl_opts, [{i, "../"}, {d, 'OTP_MAJOR_VSN_20', os:getenv("COUCHDB_OTP_MAJOR_VERSION_20")}, verbose] ++ ErlOpts}, + {erl_opts, [{i, "../"}] ++ ErlOpts}, {eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}, {plugins, [eunit_plugin]}, {dialyzer, [ diff --git a/src/couch/include/couch_db.hrl b/src/couch/include/couch_db.hrl index 26e715761..282832213 100644 --- a/src/couch/include/couch_db.hrl +++ b/src/couch/include/couch_db.hrl @@ -231,13 +231,10 @@ % % ... % end, -% for features specific to Erlang/OTP version 20.x (and later versions) --ifdef(OTP_MAJOR_VSN_20). --else. --define(ERLANG_OTP_VERSION_21_FEATURES, true). --endif. % Get the stacktrace in a way that is backwards compatible --ifdef(ERLANG_OTP_VERSION_21_FEATURES). +% OTP_VERSION is only available in OTP 21 and later, so we don’t need +% to do any other version magic here. +-ifdef(OTP_VERSION). -define(STACKTRACE(ErrorType, Error, Stack), ErrorType:Error:Stack ->). -else. diff --git a/src/couch/rebar.config.script b/src/couch/rebar.config.script index 0125615d7..5c9e6335f 100644 --- a/src/couch/rebar.config.script +++ b/src/couch/rebar.config.script @@ -215,8 +215,7 @@ AddConfig = [ {erl_opts, PlatformDefines ++ [ {d, 'COUCHDB_VERSION', Version}, {d, 'COUCHDB_GIT_SHA', GitSha}, - {i, "../"}, - {d, 'OTP_MAJOR_VSN_20', os:getenv("COUCHDB_OTP_MAJOR_VERSION_20")} + {i, "../"} ] ++ MD5Config ++ ProperConfig}, {port_env, PortEnvOverrides}, {eunit_compile_opts, PlatformDefines} diff --git a/src/mango/rebar.config.script b/src/mango/rebar.config.script index a9da9b18b..be92bf114 100644 --- a/src/mango/rebar.config.script +++ b/src/mango/rebar.config.script @@ -19,8 +19,7 @@ if not HaveDreyfus -> CONFIG; true -> false -> [] end, NewOpts = [ - {d, 'HAVE_DREYFUS'}, - {d, 'OTP_MAJOR_VSN_20', os:getenv("COUCHDB_OTP_MAJOR_VERSION_20")} + {d, 'HAVE_DREYFUS'} ] ++ CurrOpts, lists:keystore(erl_opts, 1, CONFIG, {erl_opts, NewOpts}) end. |