From 1cacafa78c61834f07abdf5de9fbb7ab6d63a620 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 19 Jun 2020 04:37:09 +0000 Subject: user/elixir: Fix test suite (thanks @lstarnes) --- user/elixir/APKBUILD | 9 ++- user/elixir/tests1.patch | 87 ++++++++++++++++++++++++++ user/elixir/tests2.patch | 159 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 user/elixir/tests1.patch create mode 100644 user/elixir/tests2.patch (limited to 'user') diff --git a/user/elixir/APKBUILD b/user/elixir/APKBUILD index e23466f18..d37c550bf 100644 --- a/user/elixir/APKBUILD +++ b/user/elixir/APKBUILD @@ -11,7 +11,10 @@ license="Apache-2.0" depends="erlang" makedepends="erlang-dev" subpackages="$pkgname-doc" -source="$pkgname-$pkgver.tar.gz::https://github.com/elixir-lang/elixir/archive/v$pkgver.tar.gz" +source="$pkgname-$pkgver.tar.gz::https://github.com/elixir-lang/elixir/archive/v$pkgver.tar.gz + tests1.patch + tests2.patch + " build() { make @@ -25,4 +28,6 @@ package() { make DESTDIR="$pkgdir" PREFIX=/usr install } -sha512sums="66b18b983e5374afbd4d94c43a880c5e46a9aa150fa6f38be74ff7f58a19eaaee00248b202d9ae3f6b78e2495fc8d5cec755de644256a731be367766c3812855 elixir-1.10.3.tar.gz" +sha512sums="66b18b983e5374afbd4d94c43a880c5e46a9aa150fa6f38be74ff7f58a19eaaee00248b202d9ae3f6b78e2495fc8d5cec755de644256a731be367766c3812855 elixir-1.10.3.tar.gz +4b014bc616c729dba673693b8157e1923eff840d83798051aeb297056383c7b3490fb9d0749eb21ba6c09f6128b36510f1c943e2d8daf393d4c719d021693978 tests1.patch +fa2f24514e4859449ec260cb179a1e523580d8681a9ad55aff7e447ae4feee6f5a09a4f1857b481a973d4f8e759cb194ffdd9b2b230ec8a59bd33fd53ad47730 tests2.patch" diff --git a/user/elixir/tests1.patch b/user/elixir/tests1.patch new file mode 100644 index 000000000..7c74074a9 --- /dev/null +++ b/user/elixir/tests1.patch @@ -0,0 +1,87 @@ +From aaae97992d33ba11374a9140e2ad8aa9aca45e32 Mon Sep 17 00:00:00 2001 +From: Jonny Stoten +Date: Mon, 13 Jan 2020 08:37:20 +0000 +Subject: [PATCH] Don't GPG sign commits or tags in git tests (#9719) + +If the machine/user git config is set to sign all commits/tags, +these tests fail. +--- + lib/mix/test/mix/tasks/escript_test.exs | 2 +- + lib/mix/test/test_helper.exs | 16 ++++++++-------- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/lib/mix/test/mix/tasks/escript_test.exs b/lib/mix/test/mix/tasks/escript_test.exs +index 5d9eb8390a..f8f1baaf15 100644 +--- a/lib/mix/test/mix/tasks/escript_test.exs ++++ b/lib/mix/test/mix/tasks/escript_test.exs +@@ -351,7 +351,7 @@ defmodule Mix.Tasks.EscriptTest do + """) + + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m "ok"]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) + + send(self(), {:mix_shell_input, :yes?, true}) + Mix.Tasks.Escript.Install.run(["git", File.cwd!()]) +diff --git a/lib/mix/test/test_helper.exs b/lib/mix/test/test_helper.exs +index b652cd07b2..65e41aa1d1 100644 +--- a/lib/mix/test/test_helper.exs ++++ b/lib/mix/test/test_helper.exs +@@ -218,7 +218,7 @@ unless File.dir?(target) do + System.cmd("git", ~w[config user.email "mix@example.com"]) + System.cmd("git", ~w[config user.name "mix-repo"]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m "bad"]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m "bad"]) + end) + + File.write!(Path.join(target, "mix.exs"), """ +@@ -237,8 +237,8 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m "ok"]) +- System.cmd("git", ~w[tag without_module]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) ++ System.cmd("git", ~w[tag --no-sign without_module]) + end) + + File.write!(Path.join(target, "lib/git_repo.ex"), """ +@@ -279,8 +279,8 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m "lib"]) +- System.cmd("git", ~w[tag with_module]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m "lib"]) ++ System.cmd("git", ~w[tag --no-sign with_module]) + end) + end + +@@ -309,7 +309,7 @@ unless File.dir?(target) do + System.cmd("git", ~w[config user.email "mix@example.com"]) + System.cmd("git", ~w[config user.name "mix-repo"]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m without-dep]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m without-dep]) + end) + + File.write!(Path.join(target, "mix.exs"), """ +@@ -336,7 +336,7 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m with-dep]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m with-dep]) + end) + end + +@@ -364,7 +364,7 @@ unless File.dir?(target) do + System.cmd("git", ~w[config user.email "mix@example.com"]) + System.cmd("git", ~w[config user.name "mix-repo"]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit -m "ok"]) ++ System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) + end) + end + diff --git a/user/elixir/tests2.patch b/user/elixir/tests2.patch new file mode 100644 index 000000000..f44b028df --- /dev/null +++ b/user/elixir/tests2.patch @@ -0,0 +1,159 @@ +From 3d1c1b4e2396e9891d38d00185889bd4a421db1a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Valim?= +Date: Sat, 13 Jun 2020 10:01:10 +0200 +Subject: [PATCH] Use global gitconfig instead of individual options on + commands + +Closes #10098. +--- + lib/mix/lib/mix/scm/git.ex | 7 ++-- + lib/mix/test/mix/tasks/escript_test.exs | 2 +- + lib/mix/test/test_helper.exs | 45 +++++++++++++------------ + 3 files changed, 29 insertions(+), 25 deletions(-) + +diff --git a/lib/mix/lib/mix/scm/git.ex b/lib/mix/lib/mix/scm/git.ex +index 2c07b9515f..6f66202052 100644 +--- a/lib/mix/lib/mix/scm/git.ex ++++ b/lib/mix/lib/mix/scm/git.ex +@@ -251,8 +251,11 @@ defmodule Mix.SCM.Git do + opts = cmd_opts(into: into, stderr_to_stdout: true) + + case System.cmd("git", args, opts) do +- {response, 0} -> response +- {_, _} -> Mix.raise("Command \"git #{Enum.join(args, " ")}\" failed") ++ {response, 0} -> ++ response ++ ++ {response, _} -> ++ Mix.raise("Command \"git #{Enum.join(args, " ")}\" failed with reason: #{response}") + end + end + +diff --git a/lib/mix/test/mix/tasks/escript_test.exs b/lib/mix/test/mix/tasks/escript_test.exs +index f8f1baaf15..5d9eb8390a 100644 +--- a/lib/mix/test/mix/tasks/escript_test.exs ++++ b/lib/mix/test/mix/tasks/escript_test.exs +@@ -351,7 +351,7 @@ defmodule Mix.Tasks.EscriptTest do + """) + + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) ++ System.cmd("git", ~w[commit -m "ok"]) + + send(self(), {:mix_shell_input, :yes?, true}) + Mix.Tasks.Escript.Install.run(["git", File.cwd!()]) +diff --git a/lib/mix/test/test_helper.exs b/lib/mix/test/test_helper.exs +index 88c6434816..1dec2be0b0 100644 +--- a/lib/mix/test/test_helper.exs ++++ b/lib/mix/test/test_helper.exs +@@ -182,18 +182,23 @@ defmodule MixTest.Case do + end + end + +-## Set up Mix home with Rebar ++## Set up globals + +-home = MixTest.Case.tmp_path(".mix") ++home = MixTest.Case.tmp_path(".home") + File.mkdir_p!(home) +-System.put_env("MIX_HOME", home) ++System.put_env("HOME", home) ++ ++mix = MixTest.Case.tmp_path(".mix") ++File.mkdir_p!(mix) ++System.put_env("MIX_HOME", mix) ++ + System.delete_env("XDG_DATA_HOME") + System.delete_env("XDG_CONFIG_HOME") + + rebar = System.get_env("REBAR") || Path.expand("fixtures/rebar", __DIR__) +-File.cp!(rebar, Path.join(home, "rebar")) ++File.cp!(rebar, Path.join(mix, "rebar")) + rebar = System.get_env("REBAR3") || Path.expand("fixtures/rebar3", __DIR__) +-File.cp!(rebar, Path.join(home, "rebar3")) ++File.cp!(rebar, Path.join(mix, "rebar3")) + + ## Copy fixtures to tmp + +@@ -207,6 +212,8 @@ Enum.each(fixtures, fn fixture -> + end) + + ## Generate Git repo fixtures ++System.cmd("git", ~w[config --global user.email "mix@example.com"]) ++System.cmd("git", ~w[config --global user.name "mix-repo"]) + + # Git repo + target = Path.expand("fixtures/git_repo", __DIR__) +@@ -220,11 +227,9 @@ unless File.dir?(target) do + """) + + File.cd!(target, fn -> +- System.cmd("git", ~w[-c core.hooksPath='' init]) +- System.cmd("git", ~w[config user.email "mix@example.com"]) +- System.cmd("git", ~w[config user.name "mix-repo"]) ++ System.cmd("git", ~w[init]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m "bad"]) ++ System.cmd("git", ~w[commit -m "bad"]) + end) + + File.write!(Path.join(target, "mix.exs"), """ +@@ -243,8 +248,8 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) +- System.cmd("git", ~w[tag --no-sign without_module]) ++ System.cmd("git", ~w[commit -m "ok"]) ++ System.cmd("git", ~w[tag without_module]) + end) + + File.write!(Path.join(target, "lib/git_repo.ex"), """ +@@ -285,8 +290,8 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m "lib"]) +- System.cmd("git", ~w[tag --no-sign with_module]) ++ System.cmd("git", ~w[commit -m "lib"]) ++ System.cmd("git", ~w[tag with_module]) + end) + end + +@@ -311,11 +316,9 @@ unless File.dir?(target) do + """) + + File.cd!(target, fn -> +- System.cmd("git", ~w[-c core.hooksPath='' init]) +- System.cmd("git", ~w[config user.email "mix@example.com"]) +- System.cmd("git", ~w[config user.name "mix-repo"]) ++ System.cmd("git", ~w[init]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m without-dep]) ++ System.cmd("git", ~w[commit -m without-dep]) + end) + + File.write!(Path.join(target, "mix.exs"), """ +@@ -342,7 +345,7 @@ unless File.dir?(target) do + + File.cd!(target, fn -> + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m with-dep]) ++ System.cmd("git", ~w[commit -m with-dep]) + end) + end + +@@ -366,11 +369,9 @@ unless File.dir?(target) do + """) + + File.cd!(target, fn -> +- System.cmd("git", ~w[-c core.hooksPath='' init]) +- System.cmd("git", ~w[config user.email "mix@example.com"]) +- System.cmd("git", ~w[config user.name "mix-repo"]) ++ System.cmd("git", ~w[init]) + System.cmd("git", ~w[add .]) +- System.cmd("git", ~w[commit --no-gpg-sign -m "ok"]) ++ System.cmd("git", ~w[commit -m "ok"]) + end) + end + -- cgit v1.2.3-60-g2f50