summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <wohali@users.noreply.github.com>2019-01-22 19:49:29 -0500
committerJan Lehnardt <jan@apache.org>2019-02-17 18:33:19 +0100
commit3f3523f58c010ad8615d4df387532499d270f96a (patch)
tree9cc03ed99f6ef48062123ed4cf5f1fcd18ee9883
parent83f46da9bf3b36f2d5d306cc1f70e9587adbb0e9 (diff)
downloadcouchdb-3f3523f58c010ad8615d4df387532499d270f96a.tar.gz
Blacklist known bad Erlang releases, fixes #1857 (#1871)
-rw-r--r--.travis.yml3
-rw-r--r--rebar.config.script37
2 files changed, 39 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index b9c75c0ac..2a757d070 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,7 @@ dist: trusty
otp_release:
- 21.2.3
- - 20.3
+ - 20.3.8.5
- 19.3
- 18.3
- 17.5
@@ -49,6 +49,7 @@ env:
# Then comment this section out
before_script:
+ - kerl list installations
- rm -rf /tmp/couchjslogs
- mkdir -p /tmp/couchjslogs
- ./configure -c --disable-docs --disable-fauxton
diff --git a/rebar.config.script b/rebar.config.script
index a582c04cf..b603a121b 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -1,3 +1,4 @@
+%% -*- erlang -*-
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
@@ -10,6 +11,42 @@
% License for the specific language governing permissions and limitations under
% the License.
+%
+% Blacklist some bad releases.
+%
+{ok, Version} = file:read_file(filename:join(
+ [code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"]
+)).
+
+% Version may be binary if file has /n at end :(
+% there is no string:trim/1 in Erlang 19 :(
+VerString = case Version of
+ V when is_binary(V) -> string:strip(binary_to_list(V), right, $\n);
+ _ -> string:strip(Version, right, $\n)
+end.
+VerList = lists:map(fun(X) -> {Int, _} = string:to_integer(X), Int end,
+ string:tokens(VerString, ".")).
+
+NotSupported = fun(Ver) ->
+ io:fwrite("CouchDB does not support this version of Erlang (~p).~n", [Ver]),
+ io:fwrite("Check https://docs.couchdb.org/en/latest/whatsnew/index.html for the~n"),
+ io:fwrite("latest information on supported releases.~n"),
+ case os:getenv("TRAVIS") of
+ "true" ->
+ io:fwrite("Travis run, ignoring bad release. You have been warned!~n"),
+ ok;
+ _ -> halt(1)
+ end
+end.
+
+case VerList of
+ [20 | _] = V20 when V20 < [20, 3, 8, 11] -> NotSupported(VerString);
+ [20 | _] = V20 when V20 >= [20, 3, 8, 11] -> ok;
+ [21, 2] -> NotSupported(VerString);
+ [21, 2, N | _] when N < 3 -> NotSupported(VerString);
+ _ -> ok
+end.
+
% Set the path to the configuration environment generated
% by `./configure`.