Skip to content

Commit

Permalink
dev-lang/elixir: revision bump of 1.11.4 to r1
Browse files Browse the repository at this point in the history
Add patches for compatibility with OPT-24.
Update 1.11.4 DEPEND - block >=OTP-24 because of incompatibility.

Signed-off-by: Jan Smutný <[email protected]>
Signed-off-by: Joonas Niilola <[email protected]>
  • Loading branch information
jendis authored and juippis committed Nov 22, 2021
1 parent 4671498 commit 0d99596
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dev-lang/elixir/elixir-1.11.4-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

DESCRIPTION="Elixir programming language"
HOMEPAGE="https://elixir-lang.org"
SRC_URI="https://github.com/elixir-lang/elixir/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="Apache-2.0 ErlPL-1.1"
SLOT="0"
KEYWORDS="amd64 ~arm ~arm64 ~ia64 ppc ~sparc x86"
IUSE="test"

RESTRICT="!test? ( test )"

DEPEND="
>=dev-lang/erlang-21:0=[ssl]
"
# 'mix' tool collides with sci-biology/phylip, bug #537514
RDEPEND="${DEPEND}
!!sci-biology/phylip
"
DEPEND+="
test? ( dev-vcs/git )
"

PATCHES=(
"${FILESDIR}"/${PN}-1.9.1-disable-network-tests.patch
"${FILESDIR}"/${PN}-1.10.3-no-Q.patch
"${FILESDIR}"/${PN}-1.10.3-epmd-daemon.patch
"${FILESDIR}"/${PN}-1.11.2-mksh.patch
"${FILESDIR}"/${P}-fix-elixir-test.patch
"${FILESDIR}"/${P}-update-warnings-for-OTP-master-10807.patch
"${FILESDIR}"/${P}-fix-logger-translator-with-otp-24-11222.patch
)

src_install() {
emake DESTDIR="${D}" LIBDIR="$(get_libdir)" PREFIX="${EPREFIX}/usr" install
dodoc README.md CHANGELOG.md CODE_OF_CONDUCT.md
}
1 change: 1 addition & 0 deletions dev-lang/elixir/elixir-1.11.4.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RESTRICT="!test? ( test )"

DEPEND="
>=dev-lang/erlang-21:0=[ssl]
<dev-lang/erlang-24
"
# 'mix' tool collides with sci-biology/phylip, bug #537514
RDEPEND="${DEPEND}
Expand Down
33 changes: 33 additions & 0 deletions dev-lang/elixir/files/elixir-1.11.4-fix-elixir-test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 3e88b1f336f843378790802bd486f6793b7ef872 Mon Sep 17 00:00:00 2001
From: Jan Smutny <[email protected]>
Date: Thu, 14 Oct 2021 16:14:55 +0200
Subject: [PATCH] Fix elixir test assertion for erlang >=OTP-24.1

---
lib/elixir/test/elixir/exception_test.exs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/elixir/test/elixir/exception_test.exs b/lib/elixir/test/elixir/exception_test.exs
index df9d46bbc..ae08d5185 100644
--- a/lib/elixir/test/elixir/exception_test.exs
+++ b/lib/elixir/test/elixir/exception_test.exs
@@ -446,11 +446,12 @@ test "annotates undefined function error with suggestions" do
* min/1
"""

- assert blame_message(:erlang, & &1.gt_cookie()) == """
- function :erlang.gt_cookie/0 is undefined or private. Did you mean one of:
+ assert blame_message(:erlang, & &1.hal()) == """
+ function :erlang.hal/0 is undefined or private. Did you mean one of:

- * get_cookie/0
- * set_cookie/2
+ * halt/0
+ * halt/1
+ * halt/2
"""
end

--
2.31.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From b1492cb0cfa689c4c098761a375d5cb728d3c175 Mon Sep 17 00:00:00 2001
From: Matteo <[email protected]>
Date: Tue, 31 Aug 2021 23:46:27 +0200
Subject: [PATCH 3/3] Fix logger translator with otp-24 (#11222)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Handle new significant key in sasl reports

* Add OTP-24.0 to CI matrix

Co-authored-by: José Valim <[email protected]>
---
.github/workflows/ci.yml | 2 +-
lib/logger/lib/logger/translator.ex | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f43a9ff62..a4bc8dbeb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- otp_release: ['OTP-23.0', 'OTP-22.3', 'OTP-22.0', 'OTP-21.3.8', 'OTP-21.0']
+ otp_release: ['OTP-24.0', 'OTP-23.0', 'OTP-22.3', 'OTP-22.0', 'OTP-21.3.8', 'OTP-21.0']
development: [false]
include:
- otp_release: master
diff --git a/lib/logger/lib/logger/translator.ex b/lib/logger/lib/logger/translator.ex
index d1d7e62f1..8afd79436 100644
--- a/lib/logger/lib/logger/translator.ex
+++ b/lib/logger/lib/logger/translator.ex
@@ -357,15 +357,22 @@ defp child_info(_min_level, _child) do
[]
end

- defp child_debug(:debug, restart_type: restart, shutdown: shutdown, child_type: type) do
- ["\nRestart: ", inspect(restart), "\nShutdown: ", inspect(shutdown)] ++
- ["\nType: ", inspect(type)]
+ defp child_debug(:debug, opts) do
+ for {key, value} <- opts do
+ child_debug_key(key, value)
+ end
end

defp child_debug(_min_level, _child) do
[]
end

+ defp child_debug_key(:restart_type, value), do: ["\nRestart: " | inspect(value)]
+ defp child_debug_key(:shutdown, value), do: ["\nShutdown: " | inspect(value)]
+ defp child_debug_key(:child_type, value), do: ["\nType: " | inspect(value)]
+ defp child_debug_key(:significant, value), do: if(value, do: "\nSignificant: true", else: [])
+ defp child_debug_key(_, _), do: []
+
defp report_crash(min_level, [[{:initial_call, initial_call} | crashed], linked]) do
mfa = initial_call_to_mfa(initial_call)
report_crash(min_level, crashed, [{:initial_call, mfa}], linked)
--
2.31.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
From 237a71311c5ae4fc5dd3c7a590a7b6dab97a664a Mon Sep 17 00:00:00 2001
From: Wojtek Mach <[email protected]>
Date: Tue, 23 Mar 2021 17:40:04 +0100
Subject: [PATCH 2/3] Update warnings for OTP master (#10807)

---
lib/elixir/src/elixir_erl_compiler.erl | 34 ++++++++++++-------
.../test/elixir/kernel/warning_test.exs | 25 --------------
2 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/lib/elixir/src/elixir_erl_compiler.erl b/lib/elixir/src/elixir_erl_compiler.erl
index 7010b59fd..e0aa05114 100644
--- a/lib/elixir/src/elixir_erl_compiler.erl
+++ b/lib/elixir/src/elixir_erl_compiler.erl
@@ -94,6 +94,8 @@ handle_file_warning(true, _File, {_Line, sys_core_fold, {nomatch_shadow, _}}) ->

%% Those we implement ourselves
handle_file_warning(_, _File, {_Line, v3_core, {map_key_repeated, _}}) -> ok;
+handle_file_warning(_, _File, {_Line, sys_core_fold, {ignored, useless_building}}) -> ok;
+%% TODO: remove when we require Erlang/OTP 24
handle_file_warning(_, _File, {_Line, sys_core_fold, useless_building}) -> ok;

%% Ignore all linting errors (only come up on parse transforms)
@@ -112,11 +114,11 @@ handle_file_error(File, {Line, Module, Desc}) ->
elixir_errors:compile_error([{line, Line}], File, Message).

%% Mention the capture operator in make_fun
-custom_format(sys_core_fold, {no_effect, {erlang, make_fun, 3}}) ->
+custom_format(sys_core_fold, {ignored, {no_effect, {erlang, make_fun, 3}}}) ->
"the result of the capture operator & (:erlang.make_fun/3) is never used";

%% Make no_effect clauses pretty
-custom_format(sys_core_fold, {no_effect, {erlang, F, A}}) ->
+custom_format(sys_core_fold, {ignored, {no_effect, {erlang, F, A}}}) ->
{Fmt, Args} = case erl_internal:comp_op(F, A) of
true -> {"use of operator ~ts has no effect", [elixir_utils:erlang_comparison_op_to_elixir(F)]};
false ->
@@ -127,12 +129,20 @@ custom_format(sys_core_fold, {no_effect, {erlang, F, A}}) ->
end,
io_lib:format(Fmt, Args);

-%% Rewrite nomatch_guard to be more generic it can happen inside if, unless, and the like
-custom_format(sys_core_fold, nomatch_guard) ->
+%% Rewrite nomatch to be more generic, it can happen inside if, unless, and the like
+custom_format(sys_core_fold, {nomatch, X}) when X == guard; X == no_clause ->
"this check/guard will always yield the same result";

+custom_format(sys_core_fold, {nomatch, {shadow, Line, {ErlName, ErlArity}}}) ->
+ {Name, Arity} = elixir_utils:erl_fa_to_elixir_fa(ErlName, ErlArity),
+
+ io_lib:format(
+ "this clause for ~ts/~B cannot match because a previous clause at line ~B always matches",
+ [Name, Arity, Line]
+ );
+
%% Handle literal eval failures
-custom_format(sys_core_fold, {eval_failure, {Mod, Name, Arity}, Error}) ->
+custom_format(sys_core_fold, {failed, {eval_failure, {Mod, Name, Arity}, Error}}) ->
#{'__struct__' := Struct} = 'Elixir.Exception':normalize(error, Error),
{ExMod, ExName, ExArgs} = elixir_rewrite:erl_to_ex(Mod, Name, lists:duplicate(Arity, nil)),
Call = 'Elixir.Exception':format_mfa(ExMod, ExName, length(ExArgs)),
@@ -143,18 +153,16 @@ custom_format(sys_core_fold, {eval_failure, {Mod, Name, Arity}, Error}) ->
["the call to ", Trimmed, " will fail with ", elixir_aliases:inspect(Struct)];

%% TODO: remove when we require OTP 24
+custom_format(sys_core_fold, {nomatch_shadow, Line, FA}) ->
+ custom_format(sys_core_fold, {nomatch, {shadow, Line, FA}});
+custom_format(sys_core_fold, nomatch_guard) ->
+ custom_format(sys_core_fold, {nomatch, guard});
+custom_format(sys_core_fold, {no_effect, X}) ->
+ custom_format(sys_core_fold, {ignored, {no_effect, X}});
custom_format(sys_core_fold, {eval_failure, Error}) ->
#{'__struct__' := Struct} = 'Elixir.Exception':normalize(error, Error),
["this expression will fail with ", elixir_aliases:inspect(Struct)];

-custom_format(sys_core_fold, {nomatch_shadow,Line,{ErlName,ErlArity}}) ->
- {Name, Arity} = elixir_utils:erl_fa_to_elixir_fa(ErlName, ErlArity),
-
- io_lib:format(
- "this clause for ~ts/~B cannot match because a previous clause at line ~B always matches",
- [Name, Arity, Line]
- );
-
custom_format([], Desc) ->
io_lib:format("~p", [Desc]);

diff --git a/lib/elixir/test/elixir/kernel/warning_test.exs b/lib/elixir/test/elixir/kernel/warning_test.exs
index 15a984a54..37334ff65 100644
--- a/lib/elixir/test/elixir/kernel/warning_test.exs
+++ b/lib/elixir/test/elixir/kernel/warning_test.exs
@@ -1154,31 +1154,6 @@ def foo(x), do: :ok
purge(Sample)
end

- test "with and do clauses emit errors, else clauses do not" do
- assert capture_err(fn ->
- Code.compile_string("""
- with {:first, int} when is_integer(int) <- {:second, Integer.gcd(2, 4)} do
- int
- end
- """)
- end) =~ "this clause cannot match"
-
- assert capture_err(fn ->
- Code.compile_string("""
- with {:first, int1} when is_integer(int1) <- {:first, Integer.gcd(2, 4)},
- {:second, int2} when is_integer(int2) <- {:second, Integer.gcd(2, 4)} do
- {:ok, int1 + int2}
- else
- {:first, nil} -> {:error, "first number is not integer"}
- {:second, nil} -> {:error, "second number is not integer"}
- end
- """)
- end) == ""
- after
- purge(Sample1)
- purge(Sample2)
- end
-
test "warning on code point escape" do
assert capture_err(fn ->
Code.eval_string("? ")
--
2.31.1

0 comments on commit 0d99596

Please sign in to comment.