Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/elixir/, dev-lang/elixir/files/
Date: Mon, 22 Nov 2021 14:03:51
Message-Id: 1637589818.0d99596c0a071d08e4415e21d2111aae62f6b1e5.juippis@gentoo
1 commit: 0d99596c0a071d08e4415e21d2111aae62f6b1e5
2 Author: Jan Smutny <js <AT> excello <DOT> cz>
3 AuthorDate: Sat Oct 30 19:08:55 2021 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 22 14:03:38 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d99596c
7
8 dev-lang/elixir: revision bump of 1.11.4 to r1
9
10 Add patches for compatibility with OPT-24.
11 Update 1.11.4 DEPEND - block >=OTP-24 because of incompatibility.
12
13 Signed-off-by: Jan Smutný <smutnja3 <AT> gmail.com>
14 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
15
16 ...lixir-1.11.4.ebuild => elixir-1.11.4-r1.ebuild} | 3 +
17 dev-lang/elixir/elixir-1.11.4.ebuild | 1 +
18 .../files/elixir-1.11.4-fix-elixir-test.patch | 33 ++++++
19 ...4-fix-logger-translator-with-otp-24-11222.patch | 64 +++++++++++
20 ...11.4-update-warnings-for-OTP-master-10807.patch | 125 +++++++++++++++++++++
21 5 files changed, 226 insertions(+)
22
23 diff --git a/dev-lang/elixir/elixir-1.11.4.ebuild b/dev-lang/elixir/elixir-1.11.4-r1.ebuild
24 similarity index 84%
25 copy from dev-lang/elixir/elixir-1.11.4.ebuild
26 copy to dev-lang/elixir/elixir-1.11.4-r1.ebuild
27 index cdae3d8bbe4b..f9c33ae96695 100644
28 --- a/dev-lang/elixir/elixir-1.11.4.ebuild
29 +++ b/dev-lang/elixir/elixir-1.11.4-r1.ebuild
30 @@ -30,6 +30,9 @@ PATCHES=(
31 "${FILESDIR}"/${PN}-1.10.3-no-Q.patch
32 "${FILESDIR}"/${PN}-1.10.3-epmd-daemon.patch
33 "${FILESDIR}"/${PN}-1.11.2-mksh.patch
34 + "${FILESDIR}"/${P}-fix-elixir-test.patch
35 + "${FILESDIR}"/${P}-update-warnings-for-OTP-master-10807.patch
36 + "${FILESDIR}"/${P}-fix-logger-translator-with-otp-24-11222.patch
37 )
38
39 src_install() {
40
41 diff --git a/dev-lang/elixir/elixir-1.11.4.ebuild b/dev-lang/elixir/elixir-1.11.4.ebuild
42 index cdae3d8bbe4b..f5439a725a0a 100644
43 --- a/dev-lang/elixir/elixir-1.11.4.ebuild
44 +++ b/dev-lang/elixir/elixir-1.11.4.ebuild
45 @@ -16,6 +16,7 @@ RESTRICT="!test? ( test )"
46
47 DEPEND="
48 >=dev-lang/erlang-21:0=[ssl]
49 + <dev-lang/erlang-24
50 "
51 # 'mix' tool collides with sci-biology/phylip, bug #537514
52 RDEPEND="${DEPEND}
53
54 diff --git a/dev-lang/elixir/files/elixir-1.11.4-fix-elixir-test.patch b/dev-lang/elixir/files/elixir-1.11.4-fix-elixir-test.patch
55 new file mode 100644
56 index 000000000000..6b4dd0c3939b
57 --- /dev/null
58 +++ b/dev-lang/elixir/files/elixir-1.11.4-fix-elixir-test.patch
59 @@ -0,0 +1,33 @@
60 +From 3e88b1f336f843378790802bd486f6793b7ef872 Mon Sep 17 00:00:00 2001
61 +From: Jan Smutny <js@×××××××.cz>
62 +Date: Thu, 14 Oct 2021 16:14:55 +0200
63 +Subject: [PATCH] Fix elixir test assertion for erlang >=OTP-24.1
64 +
65 +---
66 + lib/elixir/test/elixir/exception_test.exs | 9 +++++----
67 + 1 file changed, 5 insertions(+), 4 deletions(-)
68 +
69 +diff --git a/lib/elixir/test/elixir/exception_test.exs b/lib/elixir/test/elixir/exception_test.exs
70 +index df9d46bbc..ae08d5185 100644
71 +--- a/lib/elixir/test/elixir/exception_test.exs
72 ++++ b/lib/elixir/test/elixir/exception_test.exs
73 +@@ -446,11 +446,12 @@ test "annotates undefined function error with suggestions" do
74 + * min/1
75 + """
76 +
77 +- assert blame_message(:erlang, & &1.gt_cookie()) == """
78 +- function :erlang.gt_cookie/0 is undefined or private. Did you mean one of:
79 ++ assert blame_message(:erlang, & &1.hal()) == """
80 ++ function :erlang.hal/0 is undefined or private. Did you mean one of:
81 +
82 +- * get_cookie/0
83 +- * set_cookie/2
84 ++ * halt/0
85 ++ * halt/1
86 ++ * halt/2
87 + """
88 + end
89 +
90 +--
91 +2.31.1
92 +
93
94 diff --git a/dev-lang/elixir/files/elixir-1.11.4-fix-logger-translator-with-otp-24-11222.patch b/dev-lang/elixir/files/elixir-1.11.4-fix-logger-translator-with-otp-24-11222.patch
95 new file mode 100644
96 index 000000000000..428e7ceb3ab4
97 --- /dev/null
98 +++ b/dev-lang/elixir/files/elixir-1.11.4-fix-logger-translator-with-otp-24-11222.patch
99 @@ -0,0 +1,64 @@
100 +From b1492cb0cfa689c4c098761a375d5cb728d3c175 Mon Sep 17 00:00:00 2001
101 +From: Matteo <mbrancaleoni@×××××.com>
102 +Date: Tue, 31 Aug 2021 23:46:27 +0200
103 +Subject: [PATCH 3/3] Fix logger translator with otp-24 (#11222)
104 +MIME-Version: 1.0
105 +Content-Type: text/plain; charset=UTF-8
106 +Content-Transfer-Encoding: 8bit
107 +
108 +* Handle new significant key in sasl reports
109 +
110 +* Add OTP-24.0 to CI matrix
111 +
112 +Co-authored-by: José Valim <jose.valim@×××××××.co>
113 +---
114 + .github/workflows/ci.yml | 2 +-
115 + lib/logger/lib/logger/translator.ex | 13 ++++++++++---
116 + 2 files changed, 11 insertions(+), 4 deletions(-)
117 +
118 +diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
119 +index f43a9ff62..a4bc8dbeb 100644
120 +--- a/.github/workflows/ci.yml
121 ++++ b/.github/workflows/ci.yml
122 +@@ -15,7 +15,7 @@ jobs:
123 + strategy:
124 + fail-fast: false
125 + matrix:
126 +- otp_release: ['OTP-23.0', 'OTP-22.3', 'OTP-22.0', 'OTP-21.3.8', 'OTP-21.0']
127 ++ otp_release: ['OTP-24.0', 'OTP-23.0', 'OTP-22.3', 'OTP-22.0', 'OTP-21.3.8', 'OTP-21.0']
128 + development: [false]
129 + include:
130 + - otp_release: master
131 +diff --git a/lib/logger/lib/logger/translator.ex b/lib/logger/lib/logger/translator.ex
132 +index d1d7e62f1..8afd79436 100644
133 +--- a/lib/logger/lib/logger/translator.ex
134 ++++ b/lib/logger/lib/logger/translator.ex
135 +@@ -357,15 +357,22 @@ defp child_info(_min_level, _child) do
136 + []
137 + end
138 +
139 +- defp child_debug(:debug, restart_type: restart, shutdown: shutdown, child_type: type) do
140 +- ["\nRestart: ", inspect(restart), "\nShutdown: ", inspect(shutdown)] ++
141 +- ["\nType: ", inspect(type)]
142 ++ defp child_debug(:debug, opts) do
143 ++ for {key, value} <- opts do
144 ++ child_debug_key(key, value)
145 ++ end
146 + end
147 +
148 + defp child_debug(_min_level, _child) do
149 + []
150 + end
151 +
152 ++ defp child_debug_key(:restart_type, value), do: ["\nRestart: " | inspect(value)]
153 ++ defp child_debug_key(:shutdown, value), do: ["\nShutdown: " | inspect(value)]
154 ++ defp child_debug_key(:child_type, value), do: ["\nType: " | inspect(value)]
155 ++ defp child_debug_key(:significant, value), do: if(value, do: "\nSignificant: true", else: [])
156 ++ defp child_debug_key(_, _), do: []
157 ++
158 + defp report_crash(min_level, [[{:initial_call, initial_call} | crashed], linked]) do
159 + mfa = initial_call_to_mfa(initial_call)
160 + report_crash(min_level, crashed, [{:initial_call, mfa}], linked)
161 +--
162 +2.31.1
163 +
164
165 diff --git a/dev-lang/elixir/files/elixir-1.11.4-update-warnings-for-OTP-master-10807.patch b/dev-lang/elixir/files/elixir-1.11.4-update-warnings-for-OTP-master-10807.patch
166 new file mode 100644
167 index 000000000000..2cc0b217cbb1
168 --- /dev/null
169 +++ b/dev-lang/elixir/files/elixir-1.11.4-update-warnings-for-OTP-master-10807.patch
170 @@ -0,0 +1,125 @@
171 +From 237a71311c5ae4fc5dd3c7a590a7b6dab97a664a Mon Sep 17 00:00:00 2001
172 +From: Wojtek Mach <wojtekmach@××××××××××××××××××××.com>
173 +Date: Tue, 23 Mar 2021 17:40:04 +0100
174 +Subject: [PATCH 2/3] Update warnings for OTP master (#10807)
175 +
176 +---
177 + lib/elixir/src/elixir_erl_compiler.erl | 34 ++++++++++++-------
178 + .../test/elixir/kernel/warning_test.exs | 25 --------------
179 + 2 files changed, 21 insertions(+), 38 deletions(-)
180 +
181 +diff --git a/lib/elixir/src/elixir_erl_compiler.erl b/lib/elixir/src/elixir_erl_compiler.erl
182 +index 7010b59fd..e0aa05114 100644
183 +--- a/lib/elixir/src/elixir_erl_compiler.erl
184 ++++ b/lib/elixir/src/elixir_erl_compiler.erl
185 +@@ -94,6 +94,8 @@ handle_file_warning(true, _File, {_Line, sys_core_fold, {nomatch_shadow, _}}) ->
186 +
187 + %% Those we implement ourselves
188 + handle_file_warning(_, _File, {_Line, v3_core, {map_key_repeated, _}}) -> ok;
189 ++handle_file_warning(_, _File, {_Line, sys_core_fold, {ignored, useless_building}}) -> ok;
190 ++%% TODO: remove when we require Erlang/OTP 24
191 + handle_file_warning(_, _File, {_Line, sys_core_fold, useless_building}) -> ok;
192 +
193 + %% Ignore all linting errors (only come up on parse transforms)
194 +@@ -112,11 +114,11 @@ handle_file_error(File, {Line, Module, Desc}) ->
195 + elixir_errors:compile_error([{line, Line}], File, Message).
196 +
197 + %% Mention the capture operator in make_fun
198 +-custom_format(sys_core_fold, {no_effect, {erlang, make_fun, 3}}) ->
199 ++custom_format(sys_core_fold, {ignored, {no_effect, {erlang, make_fun, 3}}}) ->
200 + "the result of the capture operator & (:erlang.make_fun/3) is never used";
201 +
202 + %% Make no_effect clauses pretty
203 +-custom_format(sys_core_fold, {no_effect, {erlang, F, A}}) ->
204 ++custom_format(sys_core_fold, {ignored, {no_effect, {erlang, F, A}}}) ->
205 + {Fmt, Args} = case erl_internal:comp_op(F, A) of
206 + true -> {"use of operator ~ts has no effect", [elixir_utils:erlang_comparison_op_to_elixir(F)]};
207 + false ->
208 +@@ -127,12 +129,20 @@ custom_format(sys_core_fold, {no_effect, {erlang, F, A}}) ->
209 + end,
210 + io_lib:format(Fmt, Args);
211 +
212 +-%% Rewrite nomatch_guard to be more generic it can happen inside if, unless, and the like
213 +-custom_format(sys_core_fold, nomatch_guard) ->
214 ++%% Rewrite nomatch to be more generic, it can happen inside if, unless, and the like
215 ++custom_format(sys_core_fold, {nomatch, X}) when X == guard; X == no_clause ->
216 + "this check/guard will always yield the same result";
217 +
218 ++custom_format(sys_core_fold, {nomatch, {shadow, Line, {ErlName, ErlArity}}}) ->
219 ++ {Name, Arity} = elixir_utils:erl_fa_to_elixir_fa(ErlName, ErlArity),
220 ++
221 ++ io_lib:format(
222 ++ "this clause for ~ts/~B cannot match because a previous clause at line ~B always matches",
223 ++ [Name, Arity, Line]
224 ++ );
225 ++
226 + %% Handle literal eval failures
227 +-custom_format(sys_core_fold, {eval_failure, {Mod, Name, Arity}, Error}) ->
228 ++custom_format(sys_core_fold, {failed, {eval_failure, {Mod, Name, Arity}, Error}}) ->
229 + #{'__struct__' := Struct} = 'Elixir.Exception':normalize(error, Error),
230 + {ExMod, ExName, ExArgs} = elixir_rewrite:erl_to_ex(Mod, Name, lists:duplicate(Arity, nil)),
231 + Call = 'Elixir.Exception':format_mfa(ExMod, ExName, length(ExArgs)),
232 +@@ -143,18 +153,16 @@ custom_format(sys_core_fold, {eval_failure, {Mod, Name, Arity}, Error}) ->
233 + ["the call to ", Trimmed, " will fail with ", elixir_aliases:inspect(Struct)];
234 +
235 + %% TODO: remove when we require OTP 24
236 ++custom_format(sys_core_fold, {nomatch_shadow, Line, FA}) ->
237 ++ custom_format(sys_core_fold, {nomatch, {shadow, Line, FA}});
238 ++custom_format(sys_core_fold, nomatch_guard) ->
239 ++ custom_format(sys_core_fold, {nomatch, guard});
240 ++custom_format(sys_core_fold, {no_effect, X}) ->
241 ++ custom_format(sys_core_fold, {ignored, {no_effect, X}});
242 + custom_format(sys_core_fold, {eval_failure, Error}) ->
243 + #{'__struct__' := Struct} = 'Elixir.Exception':normalize(error, Error),
244 + ["this expression will fail with ", elixir_aliases:inspect(Struct)];
245 +
246 +-custom_format(sys_core_fold, {nomatch_shadow,Line,{ErlName,ErlArity}}) ->
247 +- {Name, Arity} = elixir_utils:erl_fa_to_elixir_fa(ErlName, ErlArity),
248 +-
249 +- io_lib:format(
250 +- "this clause for ~ts/~B cannot match because a previous clause at line ~B always matches",
251 +- [Name, Arity, Line]
252 +- );
253 +-
254 + custom_format([], Desc) ->
255 + io_lib:format("~p", [Desc]);
256 +
257 +diff --git a/lib/elixir/test/elixir/kernel/warning_test.exs b/lib/elixir/test/elixir/kernel/warning_test.exs
258 +index 15a984a54..37334ff65 100644
259 +--- a/lib/elixir/test/elixir/kernel/warning_test.exs
260 ++++ b/lib/elixir/test/elixir/kernel/warning_test.exs
261 +@@ -1154,31 +1154,6 @@ def foo(x), do: :ok
262 + purge(Sample)
263 + end
264 +
265 +- test "with and do clauses emit errors, else clauses do not" do
266 +- assert capture_err(fn ->
267 +- Code.compile_string("""
268 +- with {:first, int} when is_integer(int) <- {:second, Integer.gcd(2, 4)} do
269 +- int
270 +- end
271 +- """)
272 +- end) =~ "this clause cannot match"
273 +-
274 +- assert capture_err(fn ->
275 +- Code.compile_string("""
276 +- with {:first, int1} when is_integer(int1) <- {:first, Integer.gcd(2, 4)},
277 +- {:second, int2} when is_integer(int2) <- {:second, Integer.gcd(2, 4)} do
278 +- {:ok, int1 + int2}
279 +- else
280 +- {:first, nil} -> {:error, "first number is not integer"}
281 +- {:second, nil} -> {:error, "second number is not integer"}
282 +- end
283 +- """)
284 +- end) == ""
285 +- after
286 +- purge(Sample1)
287 +- purge(Sample2)
288 +- end
289 +-
290 + test "warning on code point escape" do
291 + assert capture_err(fn ->
292 + Code.eval_string("? ")
293 +--
294 +2.31.1
295 +