Skip to content

Commit

Permalink
Blacklist known bad Erlang releases, fixes #1857
Browse files Browse the repository at this point in the history
  • Loading branch information
wohali committed Jan 22, 2019
1 parent 00ce1c1 commit 133ebd9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .travis.yml
Expand Up @@ -3,8 +3,13 @@ os: linux
dist: trusty

otp_release:
- 21.2.3
- 21.2
- 21.1
- 20.3
- 21
- 20.3.8.11
- 20.3.8.10
- 20
- 19.3

addons:
Expand Down
35 changes: 35 additions & 0 deletions 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
Expand All @@ -10,6 +11,40 @@
% 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"),
io:fwrite("latest information on supported releases."),
halt().
end.

case VerList of
[20] -> NotSupported(Version);
[20, _] -> NotSupported(Version);
[20, _, _] -> NotSupported(Version);
[20, 3, 8, N] when N >= 11 -> ok;
[20, 3, 9 | _] -> ok;
[21, 2] -> NotSupported(Version);
[21, 2, N | _] when N < 3 -> NotSupported(Version);
_ -> ok
end.

% Set the path to the configuration environment generated
% by `./configure`.

Expand Down

0 comments on commit 133ebd9

Please sign in to comment.