#4 Fix build and tests for elixir 1.6.5
Merged 5 years ago by peter. Opened 5 years ago by fnux.
rpms/ fnux/elixir elixir-1.6.x-build  into  master

Fix build and tests for elixir 1.6.5
Timothée Floure • 5 years ago  
@@ -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

file modified
+20 -6
@@ -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 @@ 

  

  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 @@ 

  

  # 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 @@ 

  %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

  

Following discussion in PR#3.

There's a few other problems that I didn't mention over in PR#3:

First, something in the tests regarding git requires the network which is not available by default in mock. If you run mock with --enable-network, it passes. So we'll need to figure out what exactly is going on. I tried a while ago to run the tests inside of a docker container with the network disabled and the tests succeeded, so I'm not sure what the difference is between docker and mock (which uses systemd-nspawn). I've been putting this off but I need to revisit it.

Second, the tests are using the bundled rebar/rebar3. If you add rm -f rebar rebar3 at the end of the %prep section to make sure those aren't used, it will fail. If you export REBAR=/usr/bin/rebar and REBAR3=/usr/bin/rebar under %check it gets a bit further but still fails.

Pull-Request has been merged by peter

5 years ago