gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / elixir.scm
index 553c5fa..b873378 100644 (file)
@@ -3,6 +3,9 @@
 ;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 nee <nee.git@cock.li>
+;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Nikita <nikita@n0.is>
+;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,7 +25,7 @@
 (define-module (gnu packages elixir)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
-  #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (gnu packages)
   #:use-module (gnu packages erlang)
 (define-public elixir
   (package
     (name "elixir")
-    (version "1.5.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/elixir-lang/elixir"
-                                  "/archive/v" version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0v7z0avs3gir7qdfgysfw88l3z9p5f7p7pjnrnsz5gmmsflvf5vk"))
-              ;; FIXME: 27 tests (out of 4K) had to be disabled as
-              ;; they fail in the build environment.  Common failures
-              ;; are:
-              ;; - Mix.Shell.cmd() fails with error 130
-              ;; - The git_repo fixture cannot be found
-              ;; - Communication with spawned processes fails with EPIPE
-              ;; - Failure to copy files
-              (patches (search-patches "elixir-disable-failing-tests.patch"))))
+    (version "1.11.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/elixir-lang/elixir")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1y8fbhli29agf84ja0fwz6gf22a46738b50nwy26yvcl2n2zl9d8"))
+       (patches (search-patches "elixir-path-length.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
+       #:parallel-tests? #f ;see <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32171#23>
        #:make-flags (list (string-append "PREFIX="
                                          (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'replace-paths
+         (add-after 'unpack 'make-git-checkout-writable
+           (lambda _
+             (for-each make-file-writable (find-files "."))
+             #t))
+         (add-after 'make-git-checkout-writable 'replace-paths
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                (substitute* '("lib/elixir/lib/system.ex"
                               "lib/mix/lib/mix/scm/git.ex")
                  (("(cmd\\(['\"])git" _ prefix)
                   (string-append prefix (which "git"))))
+               (substitute* '("lib/mix/lib/mix/release.ex"
+                              "lib/mix/lib/mix/tasks/release.init.ex")
+                 (("#!/bin/sh")
+                  (string-append "#!" (which "sh"))))
                (substitute* "bin/elixir"
-                 (("ERL_EXEC=\"erl\"")
-                  (string-append "ERL_EXEC=" (which "erl"))))
+                 (("ERTS_BIN=")
+                  (string-append
+                    "ERTS_BIN="
+                    ;; Elixir Releases will prepend to ERTS_BIN the path of a copy of erl.
+                    ;; We detect if a release is being generated by checking the initial ERTS_BIN
+                    ;; value: if it's empty, we are not in release mode and can point to the actual
+                    ;; erl binary in Guix store.
+                    "\nif [ -z \"$ERTS_BIN\" ]; then ERTS_BIN="
+                    (string-drop-right (which "erl") 3)
+                    "; fi")))
                (substitute* "bin/mix"
                  (("#!/usr/bin/env elixir")
                   (string-append "#!" out "/bin/elixir"))))
              #t))
-         (add-after 'unpack 'fix-or-disable-tests
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Some tests require access to a home directory.
-             (setenv "HOME" "/tmp")
-
-             ;; FIXME: These tests fail because the "git_repo" fixture does
-             ;; not exist or cannot be found.
-             (delete-file "lib/mix/test/mix/tasks/deps.git_test.exs")
-
-             ;; FIXME: Mix.Shell.cmd() always fails with error code 130.
-             (delete-file "lib/mix/test/mix/shell_test.exs")
-
-             ;; FIXME:
-             ;; disabled failing impure tests to make it build again.
-             ;; related discussion: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28034#14
-             (delete-file "lib/elixir/test/elixir/kernel/cli_test.exs")
-             (delete-file "lib/elixir/test/elixir/kernel/dialyzer_test.exs")
-             (delete-file "lib/iex/test/iex/helpers_test.exs")
-             (delete-file "lib/ex_unit/test/ex_unit/capture_io_test.exs")
-
-             #t))
          (add-before 'build 'make-current
            ;; The Elixir compiler checks whether or not to compile files by
            ;; inspecting their timestamps.  When the timestamp is equal to the
                            (utime file recent recent 0 0)))
                        (find-files "." ".*"))
              #t))
+         (add-before 'check 'set-home
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Some tests require access to a home directory.
+             (setenv "HOME" "/tmp")
+             #t))
          (delete 'configure))))
     (inputs
      `(("erlang" ,erlang)
        ("git" ,git)))
-    (home-page "http://elixir-lang.org/")
+    (home-page "https://elixir-lang.org/")
     (synopsis "Elixir programming language")
     (description "Elixir is a dynamic, functional language used to build
 scalable and maintainable applications.  Elixir leverages the Erlang VM, known