Fix build and tests for elixir 1.6.5

This commit is contained in:
Timothée Floure 2018-06-07 10:51:53 +02:00
parent 91740a0028
commit d5df537116
2 changed files with 85 additions and 6 deletions

View File

@ -0,0 +1,65 @@
--- lib/iex/test/iex/helpers_test.exs.orig 2018-05-07 12:36:01.000000000 +0200
+++ lib/iex/test/iex/helpers_test.exs 2018-06-07 10:20:27.196176134 +0200
@@ -195,30 +195,38 @@
~r/#{@elixir_erl}:\d+$/
end
- test "opens OTP lists module" do
- assert capture_iex("open(:lists)") |> maybe_trim_quotes() =~ ~r/#{@lists_erl}:\d+$/
- end
-
- test "opens OTP lists module.function" do
- assert capture_iex("open(:lists.reverse)") |> maybe_trim_quotes() =~ ~r/#{@lists_erl}:\d+$/
- end
-
- test "opens OTP lists module.function/arity" do
- assert capture_iex("open(:lists.reverse/1)") |> maybe_trim_quotes() =~
- ~r/#{@lists_erl}:\d+$/
- end
-
- test "opens OTP httpc module" do
- assert capture_iex("open(:httpc)") |> maybe_trim_quotes() =~ ~r/#{@httpc_erl}:\d+$/
- end
-
- test "opens OTP httpc module.function" do
- assert capture_iex("open(:httpc.request)") |> maybe_trim_quotes() =~ ~r/#{@httpc_erl}:\d+$/
- end
-
- test "opens OTP httpc module.function/arity" do
- assert capture_iex("open(:httpc.request/1)") |> maybe_trim_quotes() =~
- ~r/#{@httpc_erl}:\d+$/
+ # Some installations remove the source file once Erlang is compiled. See #7348.
+ if File.regular?(@lists_erl) do
+ test "opens OTP lists module" do
+ assert capture_iex("open(:lists)") |> maybe_trim_quotes() =~ ~r/#{@lists_erl}:\d+$/
+ end
+
+ test "opens OTP lists module.function" do
+ assert capture_iex("open(:lists.reverse)") |> maybe_trim_quotes() =~
+ ~r/#{@lists_erl}:\d+$/
+ end
+
+ test "opens OTP lists module.function/arity" do
+ assert capture_iex("open(:lists.reverse/1)") |> maybe_trim_quotes() =~
+ ~r/#{@lists_erl}:\d+$/
+ end
+ end
+
+ # Some installations remove the source file once Erlang is compiled. See #7348.
+ if File.regular?(@httpc_erl) do
+ test "opens OTP httpc module" do
+ assert capture_iex("open(:httpc)") |> maybe_trim_quotes() =~ ~r/#{@httpc_erl}:\d+$/
+ end
+
+ test "opens OTP httpc module.function" do
+ assert capture_iex("open(:httpc.request)") |> maybe_trim_quotes() =~
+ ~r/#{@httpc_erl}:\d+$/
+ end
+
+ test "opens OTP httpc module.function/arity" do
+ assert capture_iex("open(:httpc.request/1)") |> maybe_trim_quotes() =~
+ ~r/#{@httpc_erl}:\d+$/
+ end
end
test "errors OTP preloaded module" do

View File

@ -2,7 +2,7 @@
Name: elixir
Version: 1.6.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A modern approach to programming for the Erlang VM
Group: Development/Languages
@ -11,6 +11,9 @@ URL: http://elixir-lang.org/
Source0: https://github.com/elixir-lang/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/elixir-lang/%{name}/releases/download/v%{version}/Docs.zip#/%{name}-%{version}-doc.zip
# Backported from upstream:
# https://github.com/elixir-lang/elixir/pull/7711
Patch0: elixir-1.6.5-disable_tests_on_erlang_sources_if_unavailable.patch
#BuildArch: noarch
BuildRequires: erlang-rebar
BuildRequires: git
@ -38,23 +41,29 @@ find -name ".build" -exec rm \{\} \;
# Unpack elixir itself (Source0)
%setup -q -D
sed -i -e "s/time //g" Makefile
%patch0
# Remove windows-specific scripts
find -name '*.bat' -exec rm \{\} \;
# This contains a failing test. We want `make test` for most tests, but
# this deals with ANSI codes which rpmbuild strips.
rm lib/elixir/test/elixir/io/ansi_test.exs
# Let the Makefile speak!
sed -i 's/$(Q)//g' Makefile
%build
export LANG="en_US.UTF-8"
%{rebar_compile}
# This target requires `sed`.
export REBAR=/usr/bin/rebar
export ERL_LIBS=/usr/share/erlang/lib/
export REBAR_DEPS_PREFER_LIBS=TRUE
make compile
make build_man
%check
export LANG="en_US.UTF-8"
%{rebar_eunit}
make test
%install
mkdir -p %{buildroot}/%{_datadir}/%{name}/%{version}
@ -91,6 +100,11 @@ HTML documentation for eex, elixir, iex, logger and mix.
%doc docs/doc/eex docs/doc/elixir docs/doc/iex docs/doc/logger docs/doc/mix
%changelog
* Thu Jun 07 2018 Timothée Floure <fnux@fedoraproject.org> - 1.6.5-2
- Switch from the rebar_* macros to upstream's makefile (without forgetting to
properly set the environment) and fix the build section.
- Backport patch0 from upstream to fix some failing tests.
* Wed May 23 2018 Peter Lemenkov <lemenkov@gmail.com> - 1.6.5-1
- New upstream release