* [bug#66801] [PATCH] mix-build-system: draft 1
@ 2023-10-28 20:19 Pierre-Henry Fröhring
2023-10-28 21:43 ` Liliana Marie Prikler
` (13 more replies)
0 siblings, 14 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-28 20:19 UTC (permalink / raw)
To: 66801
Cc: Pierre-Henry Fröhring, Andrew Tropin, Katherine Cox-Buday,
Liliana Marie Prikler
This commit introduces a mix-build-system. The provided code ensures that the
following code runs without errors:
./pre-inst-env guix build elixir-machete
A key challenge is the lack of bit reproducibility, in part due to rebar3's
lack of bit reproducibility. Future patches may address this, and I welcome
feedback.
Given the changes, splitting them into focused patches might be best. As a
first-time contributor, I seek advice on a suitable patch sequence.
I also request guidance from the Guix community for a seamless
integration. Please suggest next steps for the mix-build-system integration.
Thank you.
---
gnu/packages/elixir-xyz.scm | 327 ++++++++++
gnu/packages/elixir.scm | 164 +++--
gnu/packages/emacs-xyz.scm | 20 +
gnu/packages/erlang-xyz.scm | 650 +++++++++++++++++++
gnu/packages/erlang.scm | 996 +++++++++---------------------
guix/build-system/mix.scm | 185 ++++++
guix/build-system/rebar.scm | 320 +++++++---
guix/build/mix-build-system.scm | 373 +++++++++++
guix/build/rebar-build-system.scm | 302 +++++----
9 files changed, 2377 insertions(+), 960 deletions(-)
create mode 100644 gnu/packages/elixir-xyz.scm
create mode 100644 gnu/packages/erlang-xyz.scm
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
new file mode 100644
index 00000000..767f9db7
--- /dev/null
+++ b/gnu/packages/elixir-xyz.scm
@@ -0,0 +1,327 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages elixir-xyz)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages erlang-xyz)
+ #:use-module (gnu packages linux)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix build-system mix)
+ #:use-module (guix download))
+
+(define-public elixir-nimble-parsec
+ (package
+ (name "elixir-nimble-parsec")
+ (version "1.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0rxiw6jzz77v0j460wmzcprhdgn71g1hrz3mcc6djn7bnb0f70i6"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Text-based parser combinators")
+ (description
+ "This library provides primitives for efficient parser combinators, allowing
+for higher-level combinators through composition.")
+ (home-page "https://hexdocs.pm/nimble_parsec/")
+ (license license:asl2.0)))
+
+(define-public elixir-makeup
+ (package
+ (name "elixir-makeup")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19jpprryixi452jwhws3bbks6ki3wni9kgzah3srg22a3x8fsi8a"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-nimble-parsec))
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Syntax highlighter for source code")
+ (description
+ "Makeup is a generic syntax highlighter in the style of Pygments suitable for use in code hosting,
+forums, wikis or other applications that need to prettify source code.")
+ (home-page "https://hexdocs.pm/makeup/")
+ (license license:bsd-2)))
+
+(define-public elixir-telemetry-metrics
+ (package
+ (name "elixir-telemetry-metrics")
+ (version "0.6.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1iilk2n75kn9i95fdp8mpxvn3rcn3ghln7p77cijqws13j3y1sbv"))))
+ (build-system mix-build-system)
+ ;; There is no test/ in the source.
+ (arguments
+ (list
+ #:tests? #f))
+ (propagated-inputs (list erlang-telemetry))
+ (synopsis
+ "Provides a common interface for defining metrics based on Telemetry events")
+ (description
+ "Common interface for defining metrics based on :telemetry events. Metrics are
+aggregations of Telemetry events with specific name, providing a
+view of the system's behaviour over time.")
+ (home-page "https://hexdocs.pm/telemetry_metrics/")
+ (license license:asl2.0)))
+
+(define-public elixir-jason
+ (package
+ (name "elixir-jason")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v"))))
+ (build-system mix-build-system)
+ ;; There is no test/ in the source.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "JSON parser and generator")
+ (description
+ "Parser and generator are written in pure Elixir and optimized for speed. They
+are at least twice as fast as other Elixir/Erlang libraries (e.g.
+Poison). The performance is comparable to jiffy, which is implemented in C as
+a NIF.")
+ (home-page "https://hexdocs.pm/jason/")
+ (license license:asl2.0)))
+
+(define-public elixir-file-system
+ (package
+ (name "elixir-file-system")
+ (version "0.2.10")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))))
+ (build-system mix-build-system)
+ (inputs (list inotify-tools))
+ (arguments
+ (list
+ #:tests? #f ;There is no test/ in the source.
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'rm-priv
+ (lambda _
+ ;; This directory represents source code not needed on UNIX systems.
+ ;; Since we aim at UNIX systems, it is deleted.
+ (delete-file-recursively "priv"))))))
+ (synopsis "File system change watcher")
+ (description "Provides a file system change watcher wrapper based on
+[fs](https://github.com/synrc/fs).")
+ (home-page "https://hexdocs.pm/file_system/")
+ (license license:wtfpl2)))
+
+(define-public elixir-bunt
+ (package
+ (name "elixir-bunt")
+ (version "0.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19bp6xh052ql3ha0v3r8999cvja5d2p6cph02mxphfaj4jsbyc53"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "256 color ANSI coloring in the terminal")
+ (description "256 color ANSI coloring in the terminal.")
+ (home-page "https://hexdocs.pm/bunt/")
+ (license license:expat)))
+
+(define-public elixir-inch-ex
+ (package
+ (name "elixir-inch-ex")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1a4rjcy3hn5pc40si1d1y7qg0b0mnxx6pw825la67ky8r9gfrl4n"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (propagated-inputs (list elixir-bunt elixir-jason))
+ (synopsis
+ "Offers a Mix task for suggestions on enhancing your inline documentation")
+ (description
+ "This package provides a Mix task that gives you hints where to improve your
+inline docs.")
+ (home-page "https://hex.pm/packages/inch_ex")
+ (license license:expat)))
+
+(define-public elixir-castore
+ (package
+ (name "elixir-castore")
+ (version "1.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1y44amb8falsmrfzpkmf7qp6215g9kdl76g91dpna4af2jwc264l"))))
+ (build-system mix-build-system)
+ ;; There is no test/ in the source.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Up-to-date CA certificate store")
+ (description "Up-to-date CA certificate store.")
+ (home-page "https://hexdocs.pm/castore/")
+ (license license:asl2.0)))
+
+(define-public elixir-excoveralls
+ (package
+ (name "elixir-excoveralls")
+ (version "0.18.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02x69ll5scvraky0k5gacvnnmldv5k04kgk02x087d9w3y8vn28i"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-castore elixir-jason))
+ ;; No test/ folder.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Coverage report tool with coveralls.io integration")
+ (description
+ "Library that reports test coverage statistics, with the option to
+post to coveralls.io service. It uses Erlang's cover to generate coverage
+information, and posts the test coverage results to coveralls.io through the
+JSON API.")
+ (home-page "https://hexdocs.pm/excoveralls/")
+ (license license:expat)))
+
+(define-public elixir-credo
+ (package
+ (name "elixir-credo")
+ (version "1.7.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18jqi9s9r1587njzdxycvmmbma30cay9iamni4f3ih54jmh1r1z9"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-bunt elixir-file-system elixir-jason))
+ (native-inputs (list elixir-excoveralls elixir-inch-ex))
+ (synopsis "Static code analysis tool")
+ (description
+ "Credo is a static code analysis tool for the Elixir language with a focus on
+teaching and code consistency. Credo can show you refactoring opportunities in
+your code, complex code fragments, warn you about common mistakes, show
+inconsistencies in your naming scheme and - if needed - help you enforce a
+desired coding style.")
+ (home-page "https://hexdocs.pm/credo/")
+ (license license:expat)))
+
+(define-public elixir-erlex
+ (package
+ (name "elixir-erlex")
+ (version "0.2.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis
+ "Convert Erlang style structs and error messages to equivalent Elixir")
+ (description
+ "Converted structs and error messages are useful for pretty printing things
+like Dialyzer errors and Observer .state. NOTE: Because this code calls the
+Elixir formatter, it requires Elixir 1.6+.")
+ (home-page "https://hexdocs.pm/erlex/")
+ (license license:asl2.0)))
+
+(define-public elixir-dialyxir
+ (package
+ (name "elixir-dialyxir")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "00cqwhd1wabwds44jz94rvvr8z8cp12884d3lp69fqkrszb9bdw4"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (propagated-inputs (list elixir-erlex))
+ (synopsis "Mix tasks to simplify use of Dialyzer")
+ (description
+ "Mix Tasks are usable from the directory of the mix project you want to analyze.")
+ (home-page "https://hexdocs.pm/dialyxir/")
+ (license license:asl2.0)))
+
+(define-public elixir-machete
+ (package
+ (name "elixir-machete")
+ (version "0.2.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0952603bmqsf6v3ja99zpbnbx5d52i4xksjkfj3irl45ccq5pgq9"))))
+ (build-system mix-build-system)
+ (native-inputs (list elixir-credo elixir-dialyxir))
+ (synopsis "Literate test matchers for ExUnit")
+ (description
+ "Machete provides ergonomic match operators that act as building blocks to let
+you define test expectations that can match data against any combination of
+literals, variables, or parametrically defined matchers.")
+ (home-page "https://hexdocs.pm/machete/")
+ (license license:expat)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b4251..d1ac1d07 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2018 Nikita <nikita@n0.is>
;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,14 +25,21 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages elixir)
- #:use-module ((guix licenses) #:prefix license:)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages erlang)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
+ #:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix packages)
- #:use-module (gnu packages)
- #:use-module (gnu packages erlang)
- #:use-module (gnu packages version-control))
+ #:use-module (guix search-paths)
+ #:use-module (guix utils))
(define-public elixir
(package
@@ -52,57 +60,109 @@ (define-public elixir
(list
#:test-target "test"
#:parallel-tests? #f ;see <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32171#23>
- #:make-flags #~(list (string-append "PREFIX=" #$output))
- #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'make-git-checkout-writable
- (lambda _
- (for-each make-file-writable (find-files "."))))
- (add-after 'make-git-checkout-writable 'replace-paths
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Note: references end up obfuscated in binary BEAM files where
- ;; they may be invisible to the GC and graft code:
- ;; <https://issues.guix.gnu.org/54304#11>.
- (substitute* '("lib/mix/lib/mix/release.ex"
- "lib/mix/lib/mix/tasks/release.init.ex")
- (("#!/bin/sh")
- (string-append "#!" (search-input-file inputs "/bin/sh"))))
- (substitute* "bin/elixir"
- (("ERTS_BIN=\n")
- (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 (search-input-file inputs "/bin/erl") 3)
- "; fi\n")))
- (substitute* "bin/mix"
- (("#!/usr/bin/env elixir")
- (string-append "#!" #$output "/bin/elixir")))))
- (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
- ;; epoch no compilation will be performed. Some tests fail when
- ;; files are older than Jan 1, 2000.
- (lambda _
- (for-each (lambda (file)
- (let ((recent 1400000000))
- (utime file recent recent 0 0)))
- (find-files "." ".*"))))
- (add-before 'check 'set-home
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Some tests require access to a home directory.
- (setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ #:make-flags #~(list (string-append "PREFIX="
+ #$output))
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'make-git-checkout-writable
+ (lambda _
+ (for-each make-file-writable
+ (find-files "."))))
+ (add-after 'make-git-checkout-writable 'replace-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Note: references end up obfuscated in binary BEAM files where
+ ;; they may be invisible to the GC and graft code:
+ ;; <https://issues.guix.gnu.org/54304#11>.
+ (substitute* '("lib/mix/lib/mix/release.ex"
+ "lib/mix/lib/mix/tasks/release.init.ex")
+ (("#!/bin/sh")
+ (string-append "#!"
+ (search-input-file inputs "/bin/sh"))))
+ (substitute* "bin/elixir"
+ (("ERTS_BIN=\n")
+ (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 (search-input-file inputs
+ "/bin/erl") 3)
+ "; fi\n")))
+ (substitute* "bin/mix"
+ (("#!/usr/bin/env elixir")
+ (string-append "#!"
+ #$output "/bin/elixir")))))
+ (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
+ ;; epoch no compilation will be performed. Some tests fail when
+ ;; files are older than Jan 1, 2000.
+ (lambda _
+ (for-each (lambda (file)
+ (let ((recent 1400000000))
+ (utime file recent recent 0 0)))
+ (find-files "." ".*"))))
+ (add-before 'check 'set-home
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Some tests require access to a home directory.
+ (setenv "HOME" "/tmp")))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/"
+ program)
+ '("ERL_LIBS" prefix
+ ("${GUIX_ERL_LIBS}")))) programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ERL_LIBS")
+ (files (list "lib/erlang/lib"
+ (string-append "lib/elixir/"
+ (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
- (description "Elixir is a dynamic, functional language used to build
+ (description
+ "Elixir is a dynamic, functional language used to build
scalable and maintainable applications. Elixir leverages the Erlang VM, known
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public mix-hex
+ (package
+ (name "mix-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri "https://builds.hex.pm/installs/1.14.0/hex-2.0.5.ez")
+ (sha256
+ (base32 "0j4s17zsshq9hv3qxflcqrfwh4p27d2rv7xmgdmfdfxp086mfvry"))))
+ (build-system copy-build-system)
+ (native-inputs (list unzip))
+ (arguments
+ (list
+ #:phases #~(modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key source #:allow-other-keys)
+ ;; A *.ez file is a kind of *.zip file.
+ ;; See: https://www.erlang.org/doc/man/code#loading-of-code-from-archive-files
+ (invoke "unzip" source))))
+ #:install-plan #~'(("hex-2.0.5" "lib/"))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project currently provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 10c4b0a6..13f07f20 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -135,6 +135,7 @@
;;; Copyright © 2023 Sergiu Ivanov <sivanov@colimite.fr>
;;; Copyright © 2023 Camilo Q.S. (Distopico) <distopico@riseup.net>
;;; Copyright © 2023 Thanos Apollo <public@thanosapollo.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -7578,6 +7579,25 @@ (define-public emacs-org-fragtog
your cursor steps onto them, and re-enabled when the cursor leaves.")
(license license:gpl3+)))
+(define-public emacs-erlang
+ (package
+ (name "emacs-erlang")
+ (version (package-version erlang))
+ (source
+ (package-source erlang))
+ (build-system emacs-build-system)
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-before 'expand-load-path 'change-working-directory
+ (lambda _
+ (chdir "lib/tools/emacs") #t)))))
+ (home-page "https://www.erlang.org/")
+ (synopsis "Erlang major mode for Emacs")
+ (description
+ "This package provides an Emacs major mode for editing Erlang source
+files.")
+ (license license:asl2.0)))
+
(define-public emacs-ob-erlang
(let ((revision "1")
(commit "a029c23902b4ad73b84f262a7fc5b98d87b63dfd"))
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
new file mode 100644
index 00000000..e1f1a77e
--- /dev/null
+++ b/gnu/packages/erlang-xyz.scm
@@ -0,0 +1,650 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages erlang-xyz)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system rebar)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix hg-download)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages version-control)
+ #:use-module (srfi srfi-26))
+
+(define-public erlang-unicode-util-compat
+ (package
+ (name "erlang-unicode-util-compat")
+ (version "0.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "08952lw8cjdw8w171lv8wqbrxc4rcmb3jhkrdb7n06gngpbfdvi5"))))
+ (build-system rebar-build-system)
+ (synopsis "Unicode compatibility library for Erlang < 20")
+ (description "Unicode compatibility library for Erlang < 20.")
+ (home-page "https://hex.pm/packages/unicode_util_compat")
+ (license license:asl2.0)))
+
+(define-public erlang-idna
+ (package
+ (name "erlang-idna")
+ (version "6.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1sjcjibl34sprpf1dgdmzfww24xlyy34lpj7mhcys4j4i6vnwdwj"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-unicode-util-compat))
+ (synopsis
+ "Erlang Internationalized Domain Names in Applications (IDNA) protocol")
+ (description
+ "Library to register and look up IDNs in a way
+ that does not require changes to the DNS itself. IDNA is only meant for
+processing domain names, not free text. See: RFC 5891.")
+ (home-page "https://hexdocs.pm/idna/")
+ (license license:expat)))
+
+(define-public erlang-bear
+ (package
+ (name "erlang-bear")
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1nsri73b50n5v1a8252mm8car84j2b53bq7alq6zz16z3a86fyqm"))))
+ (build-system rebar-build-system)
+ (synopsis "Statistics functions for Erlang")
+ (description
+ "This package provides a set of statistics functions for erlang.")
+ (home-page "https://hex.pm/packages/bear")
+ (license license:asl2.0)))
+
+(define-public erlang-erlang-color
+ (package
+ (name "erlang-erlang-color")
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0f707vxihn3f9m3zxal38ajcihnfcwms77jcax0gbzn8i7jya5vb"))))
+ (build-system rebar-build-system)
+ (synopsis "ANSI colors for your Erlang")
+ (description "ANSI colors for your Erlang.")
+ (home-page "https://hex.pm/packages/erlang_color")
+ (license license:expat)))
+
+(define-public erlang-tdiff
+ (package
+ (name "erlang-tdiff")
+ (version "0.1.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0xbq7p9ii2kp49ms1kylj92ih2jiwvqwimb8jy4aalljz5lf3hp0"))))
+ (build-system rebar-build-system)
+ (synopsis "Library to compute the difference between two strings")
+ (description
+ "Erlang implementation of the O(ND) differnence algorithm by EUGENE W. MYERS.")
+ (home-page "https://hex.pm/packages/tdiff")
+ (license license:lgpl2.0)))
+
+(define-public erlang-rebar3-ex-doc
+ (package
+ (name "erlang-rebar3-ex-doc")
+ (version "0.2.21")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0c720shjf03y4slj56q5nxgyhqif0926cs3pvl3zbv1i64qh8wdm"))))
+ (build-system rebar-build-system)
+ (synopsis "rebar3 plugin for generating docs with ex_doc")
+ (description
+ "rebar3_ex_doc is a rebar3 plugin for creating documentation with ex_doc. It
+includes ex_doc as an escript, eliminating the need for Elixir installation or
+compiling ex_doc dependencies.")
+ (home-page "https://hexdocs.pm/rebar3_ex_doc/")
+ (license license:asl2.0)))
+
+(define-public erlang-samovar
+ (package
+ (name "erlang-samovar")
+ (version "1.0.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1nfw5vbzcvqzpsahwxz7zjlshg31pa9f306g3hzm1kfx5rsyvry4"))))
+ (build-system rebar-build-system)
+ (synopsis "SEMVER library for Erlang")
+ (description "SEMVER library for Erlang")
+ (home-page "https://hexdocs.pm/samovar/")
+ (license license:isc)))
+
+(define-public erlang-geas
+ (package
+ (name "erlang-geas")
+ (version "2.7.14")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1maxv5zg2ckrikr8xpxgg9kpfaxvahqilbkl9dl9ibchlgrbj6i4"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-samovar))
+ (synopsis
+ "Tool to detect the runnable official Erlang release window for your project")
+ (description
+ "Geas will tell you also what are the offending functions in the beam/source
+files that reduce the available window, if some beam files are compiled native
+and the installed patches and recommend patches that should be installed
+depending your code.")
+ (home-page "https://hexdocs.pm/geas/")
+ (license license:isc)))
+
+(define-public erlang-covertool
+ (package
+ (name "erlang-covertool")
+ (version "2.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/covertool/covertool")
+ (synopsis "Convert code-coverage data generated by @code{cover} into
+Cobertura XML reports")
+ (description
+ "This package provides a build tool and plugin to convert
+exported Erlang @code{cover} data sets into Cobertura XML reports, which can
+then be feed to the Jenkins Cobertura plug-in. On @emph{hex.pm}, this plugin
+was previously called @code{rebar_covertool}.")
+ (license license:bsd-2)))
+
+(define-public erlang-telemetry
+ (package
+ (name "erlang-telemetry")
+ (version "1.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1mgyx9zw92g6w8fp9pblm3b0bghwxwwcbslrixq23ipzisfwxnfs"))))
+ (build-system rebar-build-system)
+ (native-inputs (list erlang-covertool))
+ (synopsis "Dynamic dispatching library for metrics and instrumentations")
+ (description
+ "Telemetry is a lightweight library for dynamic dispatching of events, with a
+focus on metrics and instrumentation. Any Erlang or Elixir library can use
+telemetry to emit events. Application code and other libraries can then hook
+into those events and run custom handlers.")
+ (home-page "https://hexdocs.pm/telemetry/")
+ (license license:asl2.0)))
+
+(define-public erlang-rebar3-git-vsn
+ (package
+ (name "erlang-rebar3-git-vsn")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1dfz56034pa25axly9vqdzv3phkn8ll0qwrkws96pbgcprhky1hx"))))
+ (build-system rebar-build-system)
+ (inputs (list git-minimal/pinned))
+ (arguments
+ `(
+ ;; Running the tests require binary artifact (tar-file containing
+ ;; samples git repos) TODO: remove these from the source
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'patch-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((git (assoc-ref inputs "git-minimal")))
+ (substitute* "src/rebar3_git_vsn.erl"
+ (("rebar_utils:sh\\(\"git " _)
+ (string-append "rebar_utils:sh(\"" git "/bin/git ")))))))))
+ (home-page "https://github.com/soranoba/rebar3_git_vsn")
+ (synopsis "Rebar3 plugin for generating the version from git")
+ (description "This plugin adds support for generating the version from
+a git checkout.")
+ (license license:expat)))
+
+(define-public erlang-getopt
+ (package
+ (name "erlang-getopt")
+ (version "1.0.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "09pasi7ki1rivw9sl7xndj5qgjbdqvcscxk83yk85yr28gm9l0m0"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/jcomellas/getopt")
+ (synopsis "Command-line options parser for Erlang")
+ (description "This package provides an Erlang module to parse command line
+arguments using the GNU getopt syntax.")
+ (license license:bsd-3)))
+
+(define-public erlang-edown
+ (package
+ (name "erlang-edown")
+ (version "0.8.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0ij47gvgs6yfqphj0f54qjzj18crj8y1dsjjlzpp3dp8pscqzbqw"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/uwiger/edown")
+ (synopsis "Markdown extension for EDoc")
+ (description "This package provides an extension for EDoc for generating
+Markdown.")
+ (license license:asl2.0)))
+
+(define-public erlang-bbmustache
+ (package
+ (name "erlang-bbmustache")
+ (version "1.12.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0fvvaxdpziygxl30j59g98qkh2n47xlb7w5dfpsm2bfcsnj372v8"))))
+ (build-system rebar-build-system)
+ (inputs (list erlang-getopt erlang-rebar3-git-vsn erlang-edown)) ;for building the docs
+ (arguments
+ `(#:tests? #f ;requires mustache specification file
+ #:phases (modify-phases %standard-phases
+ (add-before 'build 'build-more
+ (lambda _
+ (invoke "rebar3" "as" "dev" "escriptize")))
+ (add-after 'install 'install-escript
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (install-file "_build/dev/bin/bbmustache"
+ (string-append out "/bin"))))))))
+ (home-page "https://github.com/soranoba/bbmustache/")
+ (synopsis "Binary pattern match Based Mustache template engine for Erlang")
+ (description "This Erlang library provides a Binary pattern match Based
+Mustache template engine")
+ (license license:expat)))
+
+(define-public erlang-certifi
+ (package
+ (name "erlang-certifi")
+ (version "2.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:tests? #f)) ;have not been updated for latest cert bundle
+ (home-page "https://github.com/certifi/erlang-certifi/")
+ (synopsis "Erlang CA certificate bundle")
+ (description
+ "This Erlang library contains a CA bundle that you can
+reference in your Erlang application. This is useful for systems that do not
+have CA bundles that Erlang can find itself, or where a uniform set of CAs is
+valuable.
+
+This an Erlang specific port of certifi. The CA bundle is derived from
+Mozilla's canonical set.")
+ (license license:bsd-3)))
+
+(define-public erlang-cf
+ (package
+ (name "erlang-cf")
+ (version "0.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/project-fifo/cf")
+ (synopsis "Terminal colour helper for Erlang io and io_lib")
+ (description "This package provides a helper library for termial colour
+printing extending the io:format syntax to add colours.")
+ (license license:expat)))
+
+(define-public erlang-yamerl
+ (package
+ (name "erlang-yamerl")
+ (version "0.10.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ ;; There are no tests included on Hex.
+ (url "https://github.com/yakaz/yamerl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0if8abgmispcfk7zhd0a5dndzwzbsmqrbyrm5shk375r2dbbwak6"))))
+ (build-system rebar-build-system)
+ (synopsis "YAML and JSON parser in pure Erlang")
+ (description
+ "Erlang application to parse YAML 1.1 and YAML 1.2 documents, as well as
+JSON documents.")
+ (home-page "https://hexdocs.pm/yamerl/")
+ (license license:bsd-2)))
+
+(define-public erlang-cth-readable
+ (package
+ (name "erlang-cth-readable")
+ (version "1.5.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "104xgybb6iciy6i28pyyrarqzliddi8kjyq43ajaav7y5si42rb8"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-cf))
+ (arguments
+ `(#:tests? #f)) ;no test-suite in hex-pm package
+ (home-page "https://github.com/ferd/cth_readable")
+ (synopsis "Common Test hooks for more readable logs for Erlang")
+ (description
+ "This package provides an OTP library to be used for CT log
+outputs you want to be readable around all that noise they contain.")
+ (license license:bsd-3)))
+
+(define-public erlang-erlware-commons
+ (package
+ (name "erlang-erlware-commons")
+ (version "1.6.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18qam9xdzi74wppb0cj4zc8161i0i8djr79z8662m6d276f2jz5m"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-cf))
+ (native-inputs (list git-minimal/pinned)) ;Required for tests
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-before 'check 'check-setup
+ (lambda _
+ (setenv "TERM" "xterm")))))) ;enable color in logs
+ (home-page "https://erlware.github.io/erlware_commons/")
+ (synopsis "Additional standard library for Erlang")
+ (description "Erlware Commons is an Erlware project focused on all aspects
+of reusable Erlang components.")
+ (license license:expat)))
+
+(define-public erlang-eunit-formatters
+ (package
+ (name "erlang-eunit-formatters")
+ (version "0.5.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/seancribbs/eunit_formatters")
+ (synopsis "Better output for eunit suites")
+ (description "This package provides a better output for Erlang eunits.")
+ (license license:asl2.0)))
+
+(define-public erlang-hex-core
+ (package
+ (name "erlang-hex-core")
+ (version "0.8.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "06p65hlm29ky03vs3fq3qz6px2ylwp8b0f2y75wdf5cm0kx2332b"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "rebar3" "as" "test" "proper")))))))
+ (inputs (list erlang-proper erlang-rebar3-proper))
+ (home-page "https://github.com/hexpm/hex_core")
+ (synopsis "Reference implementation of Hex specifications")
+ (description "This package provides the reference implementation of Hex
+specifications.")
+ (license license:asl2.0)))
+
+(define-public erlang-jsone
+ (package
+ (name "erlang-jsone")
+ (version "1.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1gaxiw76syjp3s9rygskm32y9799b917q752rw8bxj3bxq93g8x3"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-after 'unpack 'disable-covertool
+ ;; no need to generate a coverage report
+ (lambda _
+ (substitute* "rebar.config"
+ (("\\{project_plugins, \\[covertool\\]\\}\\." _)
+ "")))))))
+ (home-page "https://github.com/sile/jsone/")
+ (synopsis "Erlang JSON Library")
+ (description "An Erlang library for encoding and decoding JSON data.")
+ (license license:expat)))
+
+(define-public erlang-parse-trans
+ (package
+ (name "erlang-parse-trans")
+ (version "3.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "16p4c2xjrvz16kzpr9pmcvi6nxq6rwckqi9fp0ksibaxwxn402k2"))))
+ (build-system rebar-build-system)
+ (inputs (list erlang-getopt))
+ (home-page "https://github.com/uwiger/parse_trans")
+ (synopsis "Parse transform utilities for Erlang")
+ (description
+ "This package captures some useful patterns in parse
+transformation and code generation for Erlang.
+
+For example generating standardized accessor functions for records or
+evaluating an expression at compile-time and substitute the result as a
+compile-time constant.")
+ (license license:asl2.0)))
+
+(define-public erlang-proper
+ (package
+ (name "erlang-proper")
+ (version "1.4.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1fwcas4a9kz3w3z1jqdk9lw8822srfjk9lcpvbxkxlsv3115ha0q"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-after 'unpack 'disable-covertool
+ ;; no need to generate a coverage report
+ (lambda _
+ (substitute* "rebar.config"
+ (("\\{plugins, \\[covertool\\]\\}\\." _)
+ "")))))))
+ (home-page "https://proper-testing.github.io/")
+ (synopsis "QuickCheck-inspired property-based testing tool for Erlang")
+ (description
+ "PropEr is a tool for the automated, semi-random,
+property-based testing of Erlang programs. It is fully integrated with
+Erlang's type language, and can also be used for the model-based random
+testing of stateful systems.")
+ (license license:gpl3+)))
+
+(define-public erlang-jsx
+ (package
+ (name "erlang-jsx")
+ (version "3.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1wr7jkxm6nlgvd52xhniav64xr9rml2ngb35rwjwqlqvq7ywhp0c"))))
+ (build-system rebar-build-system)
+ (synopsis "Streaming, evented JSON parsing toolkit")
+ (description
+ "An Erlang application for consuming, producing and manipulating json.")
+ (home-page "https://github.com/talentdeficit/jsx")
+ (license license:expat)))
+
+(define-public erlang-providers
+ (package
+ (name "erlang-providers")
+ (version "1.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "05y0kz3xgx77hzn1l05byaisvmk8bgds7c22hrh0a5ba81sfi1yj"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-erlware-commons erlang-getopt))
+ (home-page "https://github.com/tsloughter/providers")
+ (synopsis "Erlang providers library")
+ (description "This package provides an Erlang providers library.")
+ (license license:asl2.0)))
+
+(define-public erlang-relx
+ (package
+ (name "erlang-relx")
+ (version "4.6.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02gmfx1vxg9m3mq4njsqhs4972l4nb8m5p1pdcf64g09ccf17y1g"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-bbmustache))
+ (home-page "https://erlware.github.io/relx/")
+ (synopsis "Release assembler for Erlang/OTP Releases")
+ (description
+ "Relx assembles releases for an Erlang/OTP release. Given a
+release specification and a list of directories in which to search for OTP
+applications it will generate a release output. That output depends heavily on
+what plugins available and what options are defined, but usually it is simply
+a well configured release directory.")
+ (license license:asl2.0)))
+
+(define-public erlang-ssl-verify-fun
+ (package
+ (name "erlang-ssl-verify-fun")
+ (version "1.1.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/deadtrickster/ssl_verify_fun.erl")
+ (synopsis "SSL verification functions for Erlang")
+ (description "This package provides SSL verification functions for
+Erlang.")
+ (license license:expat)))
+
+(define-public erlang-rebar3-raw-deps
+ (package
+ (name "erlang-rebar3-raw-deps")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1pzmm3m8gb2s9jn8fp6shzgfmy4mvh2vdci0z6nsm74ma3ffh1i3"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/soranoba/rebar3_raw_deps")
+ (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
+ (description "This plugin provides support for handling non-OTP
+applications as a dependent libraries.")
+ (license license:expat)))
+
+(define-public erlang-rebar3-proper
+ (package
+ (name "erlang-rebar3-proper")
+ (version "0.12.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1f174fb6h2071wr7qbw9aqqvnglzsjlylmyi8215fhrmi38w94b6"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/ferd/rebar3_proper")
+ (synopsis "Rebar3 PropEr plugin")
+ (description "This plugin allows running PropEr test suites from within
+rebar3.")
+ (license license:bsd-3)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c53cb72c..df17558b 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; Copyright © 2023 wrobell <wrobell@riseup.net>
;;; Copyright © 2023 Tim Johann <t1m@phrogstar.de>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,160 +28,182 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages erlang)
- #:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix gexp)
- #:use-module (guix build-system gnu)
- #:use-module (guix build-system emacs)
- #:use-module (guix build-system rebar)
- #:use-module (guix download)
- #:use-module (guix git-download)
- #:use-module (guix packages)
- #:use-module (guix utils)
- #:use-module (gnu packages)
+ #:use-module ((guix licenses)
+ #:prefix license:)
+ #:use-module (gnu packages elixir)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gl)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages perl)
- #:use-module (gnu packages version-control)
#:use-module (gnu packages tls)
- #:use-module (gnu packages wxwidgets))
+ #:use-module (gnu packages erlang-xyz)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages wxwidgets)
+ #:use-module (gnu packages)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system emacs)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system rebar)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module (guix utils))
(define-public erlang
(package
(name "erlang")
(version "25.3.2")
- (source (origin
- (method git-fetch)
- ;; The tarball from http://erlang.org/download contains many
- ;; pre-compiled files, so we use this snapshot of the source
- ;; repository.
- (uri (git-reference
- (url "https://github.com/erlang/otp")
- (commit (string-append "OTP-" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "092lym5a181gz89nscw7kqhw1wa6qvgcpkj80q4i9p79mxmsr1nj"))
- (patches (search-patches "erlang-man-path.patch"))))
+ (source
+ (origin
+ (method git-fetch)
+ ;; The tarball from http://erlang.org/download contains many
+ ;; pre-compiled files, so we use this snapshot of the source
+ ;; repository.
+ (uri (git-reference
+ (url "https://github.com/erlang/otp")
+ (commit (string-append "OTP-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "092lym5a181gz89nscw7kqhw1wa6qvgcpkj80q4i9p79mxmsr1nj"))
+ (patches (search-patches "erlang-man-path.patch"))))
(build-system gnu-build-system)
- (native-inputs
- `(("perl" ,perl)
+ (native-inputs `(("perl" ,perl)
- ;; Erlang's documentation is distributed in a separate tarball.
- ("erlang-manpages"
- ,(origin
- (method url-fetch)
- (uri (string-append "http://erlang.org/download/otp_doc_man_"
- (version-major+minor version) ".tar.gz"))
- (sha256
- (base32
- "0vnpds5q17xc4jjj3sbsllpx68wyhgvx70714vkzyd68rbjmhmk7"))))))
- (inputs
- (list ncurses openssl wxwidgets))
- (propagated-inputs
- (list fontconfig glu mesa))
+ ;; Erlang's documentation is distributed in a separate tarball.
+ ("erlang-manpages" ,(origin
+ (method url-fetch)
+ (uri (string-append
+ "http://erlang.org/download/otp_doc_man_"
+ (version-major+minor version)
+ ".tar.gz"))
+ (sha256 (base32
+ "0vnpds5q17xc4jjj3sbsllpx68wyhgvx70714vkzyd68rbjmhmk7"))))))
+ (inputs (list ncurses openssl wxwidgets))
+ (propagated-inputs (list fontconfig glu mesa))
(arguments
`(#:test-target "release_tests"
- #:configure-flags
- (list "--disable-saved-compile-time"
- "--enable-dynamic-ssl-lib"
- "--enable-native-libs"
- "--enable-shared-zlib"
- "--enable-smp-support"
- "--enable-threads"
- "--enable-wx"
- (string-append "--with-ssl=" (assoc-ref %build-inputs "openssl")))
- #:modules ((srfi srfi-19) ; make-time, et cetera.
+ #:configure-flags (list "--disable-saved-compile-time"
+ "--enable-dynamic-ssl-lib"
+ "--enable-native-libs"
+ "--enable-shared-zlib"
+ "--enable-smp-support"
+ "--enable-threads"
+ "--enable-wx"
+ (string-append "--with-ssl="
+ (assoc-ref %build-inputs
+ "openssl")))
+ #:modules ((srfi srfi-19)
+ ;make-time, et cetera.
(guix build utils)
(guix build gnu-build-system))
- #:phases
- (modify-phases %standard-phases
- (delete 'bootstrap)
- ;; The are several code fragments that embed timestamps into the
- ;; output. Here, we alter those fragments to use the value of
- ;; SOURCE_DATE_EPOCH instead.
- (add-after 'unpack 'remove-timestamps
- (lambda _
- (let ((source-date-epoch
- (time-utc->date
- (make-time time-utc 0 (string->number
- (getenv "SOURCE_DATE_EPOCH"))))))
- (substitute* "lib/reltool/src/reltool_target.erl"
- (("Date = date\\(\\),")
- (string-append "Date = "
- (date->string source-date-epoch
- "'{~Y,~m,~d}',"))))
- (substitute* "lib/reltool/src/reltool_target.erl"
- (("Time = time\\(\\),")
- (string-append "Time = "
- (date->string source-date-epoch
- "'{~H,~M,~S}',"))))
- (substitute* '("lib/reltool/src/reltool_target.erl"
- "lib/sasl/src/systools_make.erl")
- (("date\\(\\), time\\(\\),")
- (date->string source-date-epoch
- "{~Y,~m,~d}, {~H,~M,~S},")))
- (substitute* "lib/dialyzer/test/small_SUITE_data/src/gs_make.erl"
- (("tuple_to_list\\(date\\(\\)\\),tuple_to_list\\(time\\(\\)\\)")
- (date->string
- source-date-epoch
- "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})")))
- (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
- (("\\{Y,Mo,D\\} = date\\(\\),")
- (date->string source-date-epoch
- "{Y,Mo,D} = {~Y,~m,~d},")))
- (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
- (("\\{H,Mi,S\\} = time\\(\\),")
- (date->string source-date-epoch
- "{H,Mi,S} = {~H,~M,~S},"))))))
- (add-after 'unpack 'patch-/bin/sh
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((sh (search-input-file inputs "/bin/sh")))
- (substitute* "erts/etc/unix/run_erl.c"
- (("sh = \"/bin/sh\";")
- (string-append "sh = \"" sh "\";")))
- (substitute* "erts/emulator/sys/unix/sys_drivers.c"
- (("SHELL \"/bin/sh\"")
- (string-append "SHELL \"" sh "\"")))
- (substitute* "erts/emulator/sys/unix/erl_child_setup.c"
- (("SHELL \"/bin/sh\"")
- (string-append "SHELL \"" sh "\"")))
- (substitute* "lib/kernel/src/os.erl"
- (("/bin/sh") sh)))))
- (add-after 'patch-source-shebangs 'patch-source-env
- (lambda _
- (let ((escripts
- (append
- (find-files "." "\\.escript")
- (find-files "lib/stdlib/test/escript_SUITE_data/")
- '("erts/lib_src/utils/make_atomics_api"
- "erts/preloaded/src/add_abstract_code"
- "lib/diameter/bin/diameterc"
- "lib/reltool/examples/display_args"
- "lib/reltool/examples/mnesia_core_dump_viewer"
- "lib/snmp/src/compile/snmpc.src"
- "make/verify_runtime_dependencies"
- "make/emd2exml.in"))))
- (substitute* escripts
- (("/usr/bin/env") (which "env"))))))
- (add-before 'configure 'set-erl-top
- (lambda _
- (setenv "ERL_TOP" (getcwd))))
- (add-after 'install 'patch-erl
- ;; This only works after install.
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- (substitute* (string-append out "/bin/erl")
- (("basename") (which "basename"))
- (("dirname") (which "dirname"))))))
- (add-after 'install 'install-doc
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (manpages (assoc-ref inputs "erlang-manpages"))
- (share (string-append out "/share/")))
- (mkdir-p share)
- (with-directory-excursion share
- (invoke "tar" "xvf" manpages))))))))
+ #:phases (modify-phases %standard-phases
+ (delete 'bootstrap)
+ ;; The are several code fragments that embed timestamps into the
+ ;; output. Here, we alter those fragments to use the value of
+ ;; SOURCE_DATE_EPOCH instead.
+ (add-after 'unpack 'remove-timestamps
+ (lambda _
+ (let ((source-date-epoch (time-utc->date (make-time
+ time-utc 0
+ (string->number
+ (getenv
+ "SOURCE_DATE_EPOCH"))))))
+ (substitute* "lib/reltool/src/reltool_target.erl"
+ (("Date = date\\(\\),")
+ (string-append "Date = "
+ (date->string source-date-epoch
+ "'{~Y,~m,~d}',"))))
+ (substitute* "lib/reltool/src/reltool_target.erl"
+ (("Time = time\\(\\),")
+ (string-append "Time = "
+ (date->string source-date-epoch
+ "'{~H,~M,~S}',"))))
+ (substitute* '("lib/reltool/src/reltool_target.erl"
+ "lib/sasl/src/systools_make.erl")
+ (("date\\(\\), time\\(\\),")
+ (date->string source-date-epoch
+ "{~Y,~m,~d}, {~H,~M,~S},")))
+ (substitute* "lib/dialyzer/test/small_SUITE_data/src/gs_make.erl"
+ (("tuple_to_list\\(date\\(\\)\\),tuple_to_list\\(time\\(\\)\\)")
+ (date->string source-date-epoch
+ "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})")))
+ (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
+ (("\\{Y,Mo,D\\} = date\\(\\),")
+ (date->string source-date-epoch
+ "{Y,Mo,D} = {~Y,~m,~d},")))
+ (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
+ (("\\{H,Mi,S\\} = time\\(\\),")
+ (date->string source-date-epoch
+ "{H,Mi,S} = {~H,~M,~S},"))))))
+ (add-after 'unpack 'patch-/bin/sh
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((sh (search-input-file inputs "/bin/sh")))
+ (substitute* "erts/etc/unix/run_erl.c"
+ (("sh = \"/bin/sh\";")
+ (string-append "sh = \"" sh "\";")))
+ (substitute* "erts/emulator/sys/unix/sys_drivers.c"
+ (("SHELL \"/bin/sh\"")
+ (string-append "SHELL \"" sh "\"")))
+ (substitute* "erts/emulator/sys/unix/erl_child_setup.c"
+ (("SHELL \"/bin/sh\"")
+ (string-append "SHELL \"" sh "\"")))
+ (substitute* "lib/kernel/src/os.erl"
+ (("/bin/sh")
+ sh)))))
+ (add-after 'patch-source-shebangs 'patch-source-env
+ (lambda _
+ (let ((escripts (append (find-files "." "\\.escript")
+ (find-files
+ "lib/stdlib/test/escript_SUITE_data/")
+ '("erts/lib_src/utils/make_atomics_api"
+ "erts/preloaded/src/add_abstract_code"
+ "lib/diameter/bin/diameterc"
+ "lib/reltool/examples/display_args"
+ "lib/reltool/examples/mnesia_core_dump_viewer"
+ "lib/snmp/src/compile/snmpc.src"
+ "make/verify_runtime_dependencies"
+ "make/emd2exml.in"))))
+ (substitute* escripts
+ (("/usr/bin/env")
+ (which "env"))))))
+ (add-before 'configure 'set-erl-top
+ (lambda _
+ (setenv "ERL_TOP"
+ (getcwd))))
+ (add-after 'install 'patch-erl
+ ;; This only works after install.
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (substitute* (string-append out "/bin/erl")
+ (("basename")
+ (which "basename"))
+ (("dirname")
+ (which "dirname"))))))
+ (add-after 'patch-erl 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("erl" "erlc" "escript")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/"
+ program)
+ '("ERL_LIBS" ":" prefix
+ ("${GUIX_ERL_LIBS}")))) programs))))
+ (add-after 'wrap-programs 'install-doc
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (manpages (assoc-ref inputs "erlang-manpages"))
+ (share (string-append out "/share/")))
+ (mkdir-p share)
+ (with-directory-excursion share
+ (invoke "tar" "xvf" manpages))))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ERL_LIBS")
+ (files (list "lib/erlang/lib"
+ (string-append "lib/elixir/"
+ (version-major+minor (package-version
+ elixir))))))))
(home-page "https://www.erlang.org/")
(synopsis "The Erlang programming language")
(description
@@ -191,414 +214,13 @@ (define-public erlang
built-in support for concurrency, distribution and fault tolerance.")
;; Erlang is distributed under the Apache License 2.0, but some components
;; have other licenses. See 'system/COPYRIGHT' in the source distribution.
- (license (list license:asl2.0 license:bsd-2 license:bsd-3 license:expat
- license:lgpl2.0+ license:tcl/tk license:zlib))))
-
-(define-public emacs-erlang
- (package
- (name "emacs-erlang")
- (version (package-version erlang))
- (source (package-source erlang))
- (build-system emacs-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-before 'expand-load-path 'change-working-directory
- (lambda _ (chdir "lib/tools/emacs") #t)))))
- (home-page "https://www.erlang.org/")
- (synopsis "Erlang major mode for Emacs")
- (description
- "This package provides an Emacs major mode for editing Erlang source
-files.")
- (license license:asl2.0)))
-
-(define-public erlang-bbmustache
- (package
- (name "erlang-bbmustache")
- (version "1.12.2")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "bbmustache" version))
- (sha256
- (base32 "0fvvaxdpziygxl30j59g98qkh2n47xlb7w5dfpsm2bfcsnj372v8"))))
- (build-system rebar-build-system)
- (inputs
- (list erlang-getopt rebar3-git-vsn
- erlang-edown)) ; for building the docs
- (arguments
- `(#:tests? #f ;; requires mustache specification file
- #:phases
- (modify-phases %standard-phases
- (add-before 'build 'build-more
- (lambda _
- (invoke "rebar3" "as" "dev" "escriptize")))
- (add-after 'install 'install-escript
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out")))
- (install-file "_build/dev/bin/bbmustache"
- (string-append out "/bin"))))))))
- (home-page "https://github.com/soranoba/bbmustache/")
- (synopsis "Binary pattern match Based Mustache template engine for Erlang")
- (description "This Erlang library provides a Binary pattern match Based
-Mustache template engine")
- (license license:expat)))
-
-(define-public erlang-certifi
- (package
- (name "erlang-certifi")
- (version "2.9.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "certifi" version))
- (sha256
- (base32 "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96"))))
- (build-system rebar-build-system)
- (arguments
- `(#:tests? #f)) ;; have not been updated for latest cert bundle
- (home-page "https://github.com/certifi/erlang-certifi/")
- (synopsis "Erlang CA certificate bundle")
- (description "This Erlang library contains a CA bundle that you can
-reference in your Erlang application. This is useful for systems that do not
-have CA bundles that Erlang can find itself, or where a uniform set of CAs is
-valuable.
-
-This an Erlang specific port of certifi. The CA bundle is derived from
-Mozilla's canonical set.")
- (license license:bsd-3)))
-
-(define-public erlang-cf
- (package
- (name "erlang-cf")
- (version "0.3.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "cf" version))
- (sha256
- (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/project-fifo/cf")
- (synopsis "Terminal colour helper for Erlang io and io_lib")
- (description "This package provides a helper library for termial colour
-printing extending the io:format syntax to add colours.")
- (license license:expat)))
-
-(define-public erlang-yamerl
- (package
- (name "erlang-yamerl")
- (version "0.10.0")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- ;; There are no tests included on Hex.
- (url "https://github.com/yakaz/yamerl")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32 "0if8abgmispcfk7zhd0a5dndzwzbsmqrbyrm5shk375r2dbbwak6"))))
- (build-system rebar-build-system)
- (synopsis "YAML and JSON parser in pure Erlang")
- (description
- "Erlang application to parse YAML 1.1 and YAML 1.2 documents, as well as
-JSON documents.")
- (home-page "https://hexdocs.pm/yamerl/")
- (license license:bsd-2)))
-
-(define-public erlang-covertool
- (package
- (name "erlang-covertool")
- (version "2.0.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "covertool" version))
- (sha256
- (base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/covertool/covertool")
- (synopsis "Convert code-coverage data generated by @code{cover} into
-Cobertura XML reports")
- (description "This package provides a build tool and plugin to convert
-exported Erlang @code{cover} data sets into Cobertura XML reports, which can
-then be feed to the Jenkins Cobertura plug-in.
-
-On @emph{hex.pm}, this plugin was previously called @code{rebar_covertool}.")
- (license license:bsd-2)))
-
-(define-public erlang-cth-readable
- (package
- (name "erlang-cth-readable")
- (version "1.5.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "cth_readable" version))
- (sha256
- (base32 "104xgybb6iciy6i28pyyrarqzliddi8kjyq43ajaav7y5si42rb8"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-cf))
- (arguments
- `(#:tests? #f)) ;; no test-suite in hex-pm package
- (home-page "https://github.com/ferd/cth_readable")
- (synopsis "Common Test hooks for more readable logs for Erlang")
- (description "This package provides an OTP library to be used for CT log
-outputs you want to be readable around all that noise they contain.")
- (license license:bsd-3)))
-
-(define-public erlang-edown
- (package
- (name "erlang-edown")
- (version "0.8.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "edown" version))
- (sha256
- (base32 "0ij47gvgs6yfqphj0f54qjzj18crj8y1dsjjlzpp3dp8pscqzbqw"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/uwiger/edown")
- (synopsis "Markdown extension for EDoc")
- (description "This package provides an extension for EDoc for generating
-Markdown.")
- (license license:asl2.0)))
-
-(define-public erlang-erlware-commons
- (package
- (name "erlang-erlware-commons")
- (version "1.6.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "erlware_commons" version))
- (sha256
- (base32 "18qam9xdzi74wppb0cj4zc8161i0i8djr79z8662m6d276f2jz5m"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-cf))
- (native-inputs
- (list git-minimal/pinned)) ;; Required for tests
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-before 'check 'check-setup
- (lambda _
- (setenv "TERM" "xterm")))))) ; enable color in logs
- (home-page "https://erlware.github.io/erlware_commons/")
- (synopsis "Additional standard library for Erlang")
- (description "Erlware Commons is an Erlware project focused on all aspects
-of reusable Erlang components.")
- (license license:expat)))
-
-(define-public erlang-eunit-formatters
- (package
- (name "erlang-eunit-formatters")
- (version "0.5.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "eunit_formatters" version))
- (sha256
- (base32 "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/seancribbs/eunit_formatters")
- (synopsis "Better output for eunit suites")
- (description "This package provides a better output for Erlang eunits.")
- (license license:asl2.0)))
-
-(define-public erlang-getopt
- (package
- (name "erlang-getopt")
- (version "1.0.2")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "getopt" version))
- (sha256
- (base32 "09pasi7ki1rivw9sl7xndj5qgjbdqvcscxk83yk85yr28gm9l0m0"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/jcomellas/getopt")
- (synopsis "Command-line options parser for Erlang")
- (description "This package provides an Erlang module to parse command line
-arguments using the GNU getopt syntax.")
- (license license:bsd-3)))
-
-(define-public erlang-hex-core
- (package
- (name "erlang-hex-core")
- (version "0.8.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "hex_core" version))
- (sha256
- (base32 "06p65hlm29ky03vs3fq3qz6px2ylwp8b0f2y75wdf5cm0kx2332b"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (invoke "rebar3" "as" "test" "proper")))))))
- (inputs
- (list erlang-proper rebar3-proper))
- (home-page "https://github.com/hexpm/hex_core")
- (synopsis "Reference implementation of Hex specifications")
- (description "This package provides the reference implementation of Hex
-specifications.")
- (license license:asl2.0)))
-
-(define-public erlang-jsone
- (package
- (name "erlang-jsone")
- (version "1.7.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "jsone" version))
- (sha256
- (base32 "1gaxiw76syjp3s9rygskm32y9799b917q752rw8bxj3bxq93g8x3"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'disable-covertool
- ;; no need to generate a coverage report
- (lambda _
- (substitute* "rebar.config"
- (("\\{project_plugins, \\[covertool\\]\\}\\." _) "")))))))
- (home-page "https://github.com/sile/jsone/")
- (synopsis "Erlang JSON Library")
- (description "An Erlang library for encoding and decoding JSON data.")
- (license license:expat)))
-
-(define-public erlang-parse-trans
- (package
- (name "erlang-parse-trans")
- (version "3.4.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "parse_trans" version))
- (sha256
- (base32 "16p4c2xjrvz16kzpr9pmcvi6nxq6rwckqi9fp0ksibaxwxn402k2"))))
- (build-system rebar-build-system)
- (inputs
- (list erlang-getopt))
- (home-page "https://github.com/uwiger/parse_trans")
- (synopsis "Parse transform utilities for Erlang")
- (description "This package captures some useful patterns in parse
-transformation and code generation for Erlang.
-
-For example generating standardized accessor functions for records or
-evaluating an expression at compile-time and substitute the result as a
-compile-time constant.")
- (license license:asl2.0)))
-
-(define-public erlang-proper
- (package
- (name "erlang-proper")
- (version "1.4.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "proper" version))
- (sha256
- (base32 "1fwcas4a9kz3w3z1jqdk9lw8822srfjk9lcpvbxkxlsv3115ha0q"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'disable-covertool
- ;; no need to generate a coverage report
- (lambda _
- (substitute* "rebar.config"
- (("\\{plugins, \\[covertool\\]\\}\\." _) "")))))))
- (home-page "https://proper-testing.github.io/")
- (synopsis "QuickCheck-inspired property-based testing tool for Erlang")
- (description "PropEr is a tool for the automated, semi-random,
-property-based testing of Erlang programs. It is fully integrated with
-Erlang's type language, and can also be used for the model-based random
-testing of stateful systems.")
- (license license:gpl3+)))
-
-(define-public erlang-jsx
- (package
- (name "erlang-jsx")
- (version "3.1.0")
- (source (origin
- (method url-fetch)
- (uri (hexpm-uri "jsx" version))
- (sha256
- (base32
- "1wr7jkxm6nlgvd52xhniav64xr9rml2ngb35rwjwqlqvq7ywhp0c"))))
- (build-system rebar-build-system)
- (synopsis "Streaming, evented JSON parsing toolkit")
- (description
- "An Erlang application for consuming, producing and manipulating json.")
- (home-page "https://github.com/talentdeficit/jsx")
- (license license:expat)))
-
-(define-public erlang-providers
- (package
- (name "erlang-providers")
- (version "1.9.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "providers" version))
- (sha256
- (base32 "05y0kz3xgx77hzn1l05byaisvmk8bgds7c22hrh0a5ba81sfi1yj"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-erlware-commons erlang-getopt))
- (home-page "https://github.com/tsloughter/providers")
- (synopsis "Erlang providers library")
- (description "This package provides an Erlang providers library.")
- (license license:asl2.0)))
-
-(define-public erlang-relx
- (package
- (name "erlang-relx")
- (version "4.6.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "relx" version))
- (sha256
- (base32 "02gmfx1vxg9m3mq4njsqhs4972l4nb8m5p1pdcf64g09ccf17y1g"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-bbmustache))
- (home-page "https://erlware.github.io/relx/")
- (synopsis "Release assembler for Erlang/OTP Releases")
- (description "Relx assembles releases for an Erlang/OTP release. Given a
-release specification and a list of directories in which to search for OTP
-applications it will generate a release output. That output depends heavily on
-what plugins available and what options are defined, but usually it is simply
-a well configured release directory.")
- (license license:asl2.0)))
-
-(define-public erlang-ssl-verify-fun
- (package
- (name "erlang-ssl-verify-fun")
- (version "1.1.6")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "ssl_verify_fun" version))
- (sha256
- (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/deadtrickster/ssl_verify_fun.erl")
- (synopsis "SSL verification functions for Erlang")
- (description "This package provides SSL verification functions for
-Erlang.")
- (license license:expat)))
+ (license (list license:asl2.0
+ license:bsd-2
+ license:bsd-3
+ license:expat
+ license:lgpl2.0+
+ license:tcl/tk
+ license:zlib))))
(define-public rebar3
(package
@@ -616,56 +238,71 @@ (define-public rebar3
(build-system gnu-build-system)
;; TODO: remove vendored modules, install man-page, install lib(?)
(arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'bootstrap)
- (add-after 'unpack 'unpack-dependency-sources
- (lambda* (#:key inputs #:allow-other-keys)
- (for-each
- (lambda (pkgname)
- (let* ((src (string-append pkgname "-source"))
- (input (assoc-ref inputs src))
- (checkouts-dir (string-append "_checkouts/" pkgname))
- (lib-dir (string-append "_build/default/lib/" pkgname)))
- (mkdir-p checkouts-dir)
- (invoke "tar" "-xf" input "-C" checkouts-dir)
- (invoke "tar" "-xzf"
- (pk (string-append checkouts-dir "/contents.tar.gz"))
- "-C" checkouts-dir)
- (mkdir-p lib-dir)
- (copy-recursively checkouts-dir lib-dir)))
- (list "bbmustache" "certifi" "cf" "cth_readable"
- "eunit_formatters" "getopt" "hex_core" "erlware_commons"
- "parse_trans" "relx" "ssl_verify_fun" "providers"))))
- (delete 'configure)
- (replace 'build
- (lambda _
- (setenv "HOME" (getcwd))
- (invoke "./bootstrap")))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out")))
- (install-file "rebar3" (string-append out "/bin")))))
- (delete 'check))))
- (native-inputs
- (list erlang))
- (inputs
- `(("bbmustache-source" ,(package-source erlang-bbmustache))
- ("certifi-source" ,(package-source erlang-certifi))
- ("cf-source" ,(package-source erlang-cf))
- ("cth_readable-source" ,(package-source erlang-cth-readable))
- ("erlware_commons-source" ,(package-source erlang-erlware-commons))
- ("eunit_formatters-source" ,(package-source erlang-eunit-formatters))
- ("getopt-source" ,(package-source erlang-getopt))
- ("hex_core-source" ,(package-source erlang-hex-core))
- ("parse_trans-source" ,(package-source erlang-parse-trans))
- ("relx-source" ,(package-source erlang-relx))
- ("ssl_verify_fun-source" ,(package-source erlang-ssl-verify-fun))
- ("providers-source" ,(package-source erlang-providers))))
+ `(#:phases (modify-phases %standard-phases
+ (delete 'bootstrap)
+ (add-after 'unpack 'unpack-dependency-sources
+ (lambda* (#:key inputs #:allow-other-keys)
+ (for-each (lambda (pkgname)
+ (let* ((src (string-append pkgname "-source"))
+ (input (assoc-ref inputs src))
+ (checkouts-dir (string-append
+ "_checkouts/" pkgname))
+ (lib-dir (string-append
+ "_build/default/lib/"
+ pkgname)))
+ (mkdir-p checkouts-dir)
+ (invoke "tar" "-xf" input "-C"
+ checkouts-dir)
+ (invoke "tar" "-xzf"
+ (pk (string-append checkouts-dir
+ "/contents.tar.gz")) "-C"
+ checkouts-dir)
+ (mkdir-p lib-dir)
+ (copy-recursively checkouts-dir lib-dir)))
+ (list "bbmustache"
+ "certifi"
+ "cf"
+ "cth_readable"
+ "eunit_formatters"
+ "getopt"
+ "hex_core"
+ "erlware_commons"
+ "parse_trans"
+ "relx"
+ "ssl_verify_fun"
+ "providers"))))
+ (delete 'configure)
+ (replace 'build
+ (lambda _
+ (setenv "HOME"
+ (getcwd))
+ (invoke "./bootstrap")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (install-file "rebar3"
+ (string-append out "/bin")))))
+ (delete 'check))))
+ (native-inputs (list erlang))
+ (inputs `(("bbmustache-source" ,(package-source erlang-bbmustache))
+ ("certifi-source" ,(package-source erlang-certifi))
+ ("cf-source" ,(package-source erlang-cf))
+ ("cth_readable-source" ,(package-source erlang-cth-readable))
+ ("erlware_commons-source" ,(package-source
+ erlang-erlware-commons))
+ ("eunit_formatters-source" ,(package-source
+ erlang-eunit-formatters))
+ ("getopt-source" ,(package-source erlang-getopt))
+ ("hex_core-source" ,(package-source erlang-hex-core))
+ ("parse_trans-source" ,(package-source erlang-parse-trans))
+ ("relx-source" ,(package-source erlang-relx))
+ ("ssl_verify_fun-source" ,(package-source erlang-ssl-verify-fun))
+ ("providers-source" ,(package-source erlang-providers))))
(home-page "https://rebar3.org/")
(synopsis "Sophisticated build-tool for Erlang projects that follows OTP
principles")
- (description "@code{rebar3} is an Erlang build tool that makes it easy to
+ (description
+ "@code{rebar3} is an Erlang build tool that makes it easy to
compile and test Erlang applications, port drivers and releases.
@code{rebar3} is a self-contained Erlang script, so it's easy to distribute or
@@ -676,84 +313,19 @@ (define-public rebar3
of locations (git, hg, etc).")
(license license:asl2.0)))
-(define-public rebar3-raw-deps
- (package
- (name "rebar3-raw-deps")
- (version "2.0.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "rebar3_raw_deps" version))
- (sha256
- (base32 "1pzmm3m8gb2s9jn8fp6shzgfmy4mvh2vdci0z6nsm74ma3ffh1i3"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/soranoba/rebar3_raw_deps")
- (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
- (description "This plugin provides support for handling non-OTP
-applications as a dependent libraries.")
- (license license:expat)))
-
-(define-public rebar3-git-vsn
- (package
- (name "rebar3-git-vsn")
- (version "1.1.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "rebar3_git_vsn" version))
- (sha256
- (base32 "1dfz56034pa25axly9vqdzv3phkn8ll0qwrkws96pbgcprhky1hx"))))
- (build-system rebar-build-system)
- (inputs
- (list git-minimal/pinned))
- (arguments
- `(;; Running the tests require binary artifact (tar-file containing
- ;; samples git repos) TODO: remove these from the source
- #:tests? #f
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((git (assoc-ref inputs "git-minimal")))
- (substitute* "src/rebar3_git_vsn.erl"
- (("rebar_utils:sh\\(\"git " _)
- (string-append "rebar_utils:sh(\"" git "/bin/git ")))))))))
- (home-page "https://github.com/soranoba/rebar3_git_vsn")
- (synopsis "Rebar3 plugin for generating the version from git")
- (description "This plugin adds support for generating the version from
-a git checkout.")
- (license license:expat)))
-
-(define-public rebar3-proper
- (package
- (name "rebar3-proper")
- (version "0.12.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri "rebar3_proper" version))
- (sha256
- (base32 "1f174fb6h2071wr7qbw9aqqvnglzsjlylmyi8215fhrmi38w94b6"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/ferd/rebar3_proper")
- (synopsis "Rebar3 PropEr plugin")
- (description "This plugin allows running PropEr test suites from within
-rebar3.")
- (license license:bsd-3)))
-
(define-public erlang-lfe
(package
(name "erlang-lfe")
(version "2.1.2")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/lfe/lfe")
- (commit "v2.1.2")))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "180hz1p2v3vb6yyzcfwircmljlnd86ln8z80lzy3mwlyrcxblvxy"))))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/lfe/lfe")
+ (commit "v2.1.2")))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "180hz1p2v3vb6yyzcfwircmljlnd86ln8z80lzy3mwlyrcxblvxy"))))
(build-system gnu-build-system)
(arguments
(list
@@ -761,49 +333,47 @@ (define-public erlang-lfe
(srfi srfi-26)
(guix build gnu-build-system)
(guix build utils))
- #:make-flags #~(list (string-append "PREFIX=" #$output) "CC=gcc")
- #:phases
- #~(modify-phases %standard-phases
- (delete 'configure)
- ;; The following is inspired by rebar-build-system.scm
- (add-before 'check 'erlang-depends
- (lambda* (#:key inputs #:allow-other-keys)
- (define input-directories
- (list #$(this-package-native-input "rebar3-proper")
- #$(this-package-native-input "erlang-proper")))
- (mkdir-p "_checkouts")
- (for-each
- (lambda (input-dir)
- (let ((elibdir (string-append input-dir "/lib/erlang/lib")))
- (when (directory-exists? elibdir)
- (for-each
- (lambda (dirname)
- (let ((src (string-append elibdir "/" dirname))
- (dest (string-append "_checkouts/" dirname)))
- (when (not (file-exists? dest))
- ;; Symlinking will not work, since rebar3 will try
- ;; to overwrite the _build directory several times
- ;; with the contents of _checkout, so we copy the
- ;; directory tree to _checkout and make it
- ;; writable.
- (copy-recursively src dest #:follow-symlinks? #t)
- (for-each (cut chmod <> #o777)
- (find-files dest)))))
- (scandir elibdir (lambda (file)
- (and (not (member file '("." "..")))
- (file-is-directory?
- (string-append elibdir
- "/"
- file)))))))))
- input-directories)))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (begin
- (setenv "REBAR_CACHE_DIR" "/tmp")
- (invoke "make" "-j" (number->string (parallel-job-count))
- "tests"))))))))
- (native-inputs (list rebar3 rebar3-proper erlang-proper))
+ #:make-flags #~(list (string-append "PREFIX="
+ #$output) "CC=gcc")
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure)
+ ;; The following is inspired by rebar-build-system.scm
+ (add-before 'check 'erlang-depends
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define input-directories
+ (list #$(this-package-native-input "rebar3-proper")
+ #$(this-package-native-input "erlang-proper")))
+ (mkdir-p "_checkouts")
+ (for-each
+ (lambda (input-dir)
+ (let ((elibdir (string-append input-dir "/lib/erlang/lib")))
+ (when (directory-exists? elibdir)
+ (for-each
+ (lambda (dirname)
+ (let ((src (string-append elibdir "/" dirname))
+ (dest (string-append "_checkouts/" dirname)))
+ (when (not (file-exists? dest))
+ ;; Symlinking will not work, since rebar3 will try
+ ;; to overwrite the _build directory several times
+ ;; with the contents of _checkout, so we copy the
+ ;; directory tree to _checkout and make it
+ ;; writable.
+ (copy-recursively src dest #:follow-symlinks? #t)
+ (for-each (cut chmod <> 511) (find-files dest)))))
+ (scandir elibdir
+ (lambda (file)
+ (and (not (member file '("." "..")))
+ (file-is-directory? (string-append elibdir "/" file)))))))))
+ input-directories)))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (begin
+ (setenv "REBAR_CACHE_DIR" "/tmp")
+ (invoke "make" "-j"
+ (number->string (parallel-job-count))
+ "tests"))))))))
+ (native-inputs (list rebar3 erlang-rebar3-proper erlang-proper))
(propagated-inputs (list erlang))
(home-page "https://github.com/lfe/lfe")
(synopsis "Lisp Flavoured Erlang")
@@ -812,3 +382,9 @@ (define-public erlang-lfe
compiler. Code produced with it is compatible with \"normal\" Erlang
code. An LFE evaluator and shell is also included.")
(license license:asl2.0)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 00000000..8201b715
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,185 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages elixir)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix search-paths)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix store)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:export (mix-build-system hexpm-uri))
+
+;;
+;; hexpm
+;;
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ (string-append "https://repo.hex.pm/tarballs/"
+ (string-replace-substring (strip-elixir-prefix name) "-" "_")
+ "-" version ".tar"))
+
+;;
+;; utils
+;;
+
+(define utils-locales
+ (make-glibc-utf8-locales glibc
+ #:locales (list "en_US")
+ #:name "glibc-utf8-locales"))
+
+(define (utils-elixir-default)
+ "Return the default Elixir package."
+ ;; Lazily resolve the binding to avoid a circular dependency.
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir
+ 'elixir)))
+
+(define utils-imported-modules
+ `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+
+(define utils-modules
+ '((guix build mix-build-system)
+ (guix build utils)))
+
+;;
+;; mix
+;;
+
+(define* (mix-build name
+ inputs
+ #:key source
+ (tests? #t)
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules utils-imported-modules)
+ (modules utils-modules))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:phases #$(if (pair?
+ phases)
+ (sexp->gexp
+ phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad
+ ((guile (package->derivation (or guile
+ (default-guile)) system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (mix-lower name
+ #:key source
+ inputs
+ native-inputs
+ outputs
+ system
+ target
+ (elixir (utils-elixir-default))
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+
+ ;; The value associated to these keywords are used in the bag below and are
+ ;; not to be used in the arguments.
+ (define private-keywords
+ '(#:inputs #:native-inputs #:outputs #:system #:target #:elixir))
+
+ ;; All that is necessary to complete the build.
+ (define build-inputs
+ ;; If these packages are not present, then Elixir emits these errors:
+ ;; dirname: command not found
+ ;; basename: command not found
+ `(,@(standard-packages)
+
+ ;; If no UTF-8 is present, then Elixir emits this warning:
+ ;;
+ ;; warning: the VM is running with native name encoding of latin1
+ ;; which may cause Elixir to malfunction as it expects utf8. Please
+ ;; ensure your locale is set to UTF-8 (which can be verified by
+ ;; running "locale" in your shell)
+ ("glibc-utf8-locales" ,utils-locales)
+
+ ("elixir" ,elixir)
+
+ ;; If Hex is not present, mix cannot build packages.
+ ("mix-hex" ,mix-hex)
+
+ ,@native-inputs
+
+ ,@inputs))
+
+ (define host-inputs
+ (if target inputs
+ '()))
+
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs host-inputs)
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower mix-lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm
index de1294ec..e1258a78 100644
--- a/guix/build-system/rebar.scm
+++ b/guix/build-system/rebar.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,99 +22,171 @@ (define-module (guix build-system rebar)
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix gexp)
+ #:use-module (ice-9 regex)
#:use-module (guix packages)
#:use-module (guix monads)
#:use-module (guix search-paths)
+ #:use-module (ice-9 match)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
- #:export (hexpm-uri
- hexpm-package-url
- %rebar-build-system-modules
- rebar-build
- rebar-build-system))
+ #:use-module (srfi srfi-1)
+ #:export (hexpm-uri hexpm-package-url %rebar-build-system-modules
+ rebar-build rebar-build-system))
;;;
-;;; Definitions for the hex.pm repository,
+;;; pkg-name
;;;
-;; URL and paths from
-;; https://github.com/hexpm/specifications/blob/master/endpoints.md
-(define %hexpm-repo-url
+(define pkg-name-prefix
+ "erlang-")
+
+;; Pattern that an Erlang Guix package is expected to match.
+(define pkg-name-prefix-re
+ (format #f "^~a(.*)" pkg-name-prefix))
+
+(define (pkg-name->match name)
+ "Return the match object from NAME if NAME starts with pkg-name-prefix."
+ (string-match pkg-name-prefix-re name))
+
+(define (pkg-name? name)
+ "Test if NAME is the name of an Erlang Guix package.
+
+Example: erlang-ssl-verify-fun is the name of an Erlang Guix package."
+ (or (pkg-name->match name) #f))
+
+(define (pkg-name->suffix name)
+ "Return the suffix of the name of an Erlang Guix package."
+ (regexp-substitute #f
+ (pkg-name->match name) 1))
+
+(define* (pkg-name->library-directory-name name
+ #:key (version ""))
+ "Return the name of the library directory associated to NAME.
+
+Example: if an Erlang Guix package name is \"erlang-ssl-verify-fun\" and its
+version is 1.2.3, then the associated library directory name is:
+\"ssl_verify_fun-1.2.3\".
+
+See:
+ - \"Library directory\" description: https://www.erlang.org/doc/man/code#code-path
+"
+ (string-append (string-replace-substring (pkg-name->suffix name) "-" "_")
+ (if (string= version "") ""
+ (string-append "-" version))))
+
+;;;
+;;; hexpm
+;;;
+
+;; See: https://github.com/hexpm/specifications/blob/master/endpoints.md
+(define hexpm
(make-parameter "https://repo.hex.pm"))
-(define hexpm-package-url
- (string-append (%hexpm-repo-url) "/tarballs/"))
+(define hexpm-tarballs
+ (string-append (hexpm) "/tarballs/"))
-(define (hexpm-uri name version)
+(define (hexpm->uri name version)
"Return a URI string for the package hosted at hex.pm corresponding to NAME
-and VERSION."
- (string-append hexpm-package-url name "-" version ".tar"))
+and VERSION.
+
+XXX: should a warning be emitted?
+If NAME is not an Erlang Guix package name, then emit a warning. The download
+will fail if it is not correct anyway."
+
+ (define (warn-about name)
+ (format #t "AssertionWarning 4dcbff27
+ Assertion: re matches name.
+ re = ~a
+ name = ~a
+" pkg-name-prefix-re name) name)
+
+ (define (name->archive-name name)
+ (if (pkg-name? name)
+ (string-append (pkg-name->library-directory-name name
+ #:version version)
+ ".tar")
+ (string-append (warn-about name) "-" version ".tar")))
+
+ (string-append hexpm-tarballs
+ (name->archive-name name)))
;;
-;; Standard build procedure for Erlang packages using Rebar.
+;; utils
;;
-(define %rebar-build-system-modules
- ;; Build-side modules imported by default.
- `((guix build rebar-build-system)
- ,@%gnu-build-system-modules))
-
-(define (default-rebar3)
- "Return the default Rebar3 package."
+(define (utils-rebar-default)
;; Lazily resolve the binding to avoid a circular dependency.
(let ((erlang-mod (resolve-interface '(gnu packages erlang))))
- (module-ref erlang-mod 'rebar3)))
+ (module-ref erlang-mod
+ 'rebar3)))
-(define (default-erlang)
- "Return the default Erlang package."
+(define (utils-erlang-default)
;; Lazily resolve the binding to avoid a circular dependency.
(let ((erlang-mod (resolve-interface '(gnu packages erlang))))
- (module-ref erlang-mod 'erlang)))
-
-(define* (lower name
- #:key source inputs native-inputs outputs system target
- (rebar (default-rebar3))
- (erlang (default-erlang))
- #:allow-other-keys
- #:rest arguments)
- "Return a bag for NAME from the given arguments."
- (define private-keywords
- '(#:target #:rebar #:erlang #:inputs #:native-inputs))
-
- (and (not target) ;XXX: no cross-compilation
- (bag
- (name name)
- (system system)
- (host-inputs `(,@(if source
- `(("source" ,source))
- '())
- ,@inputs))
- (build-inputs `(("rebar" ,rebar)
- ("erlang" ,erlang) ;; for escriptize
- ,@native-inputs
- ;; Keep the standard inputs of 'gnu-build-system'.
- ,@(standard-packages)))
- (outputs outputs)
- (build rebar-build)
- (arguments (strip-keyword-arguments private-keywords arguments)))))
-
-(define* (rebar-build name inputs
- #:key
- guile source
- (rebar-flags ''("skip_deps=true" "-vv"))
- (tests? #t)
- (test-target "eunit")
- ;; TODO: install-name ; default: based on guix package name
- (install-profile "default")
- (phases '(@ (guix build rebar-build-system)
- %standard-phases))
- (outputs '("out"))
- (search-paths '())
- (native-search-paths '())
- (system (%current-system))
- (imported-modules %rebar-build-system-modules)
- (modules '((guix build rebar-build-system)
- (guix build utils))))
+ (module-ref erlang-mod
+ 'erlang)))
+
+(define utils-imported-modules
+ `((guix build rebar-build-system)
+ ,@%gnu-build-system-modules))
+
+;;
+;; source
+;;
+;; If s is a Source, then s has the form (list <name> <source>) where:
+;; <name> is a string representing the name of a library directory.
+;; <origin> is an origin (see: guix/packages.scm) which represents the
+;; source code associated to this library.
+;;
+
+(define source->name
+ car)
+(define source->origin
+ cadr)
+
+;;
+;; input
+;;
+;; If i is an Input, then i has the form (list <name> <package>) where:
+;; <name> is a string representing the name of a package.
+;; <package> is a package with the associated name.
+
+(define input->name
+ car)
+(define input->package
+ cadr)
+
+(define (input->source input)
+ "Return a Source associated to the Input INPUT."
+ (match input
+ ((name package)
+ (list (pkg-name->library-directory-name name)
+ (package-source package)))))
+
+;;
+;; rebar
+;;
+
+(define* (rebar-build name
+ inputs
+ #:key guile
+ source
+ ;; XXX: these are useless.
+ (rebar-flags ''("skip_deps=true" "-vv"))
+ (tests? #t)
+ (test-target "eunit")
+ ;; TODO: install-name ; default: based on guix package name
+ (install-profile "default")
+ (phases '(@ (guix build rebar-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (native-search-paths '())
+ (system (%current-system))
+ (imported-modules utils-imported-modules)
+ (modules '((guix build rebar-build-system)
+ (guix build utils)))
+ (sources-erlang '()))
"Build SOURCE with INPUTS."
(define builder
@@ -122,35 +195,94 @@ (define* (rebar-build name inputs
(use-modules #$@(sexp->gexp modules))
#$(with-build-variables inputs outputs
+
#~(rebar-build #:source #+source
- #:system #$system
- #:name #$name
- #:rebar-flags #$rebar-flags
- #:tests? #$tests?
- #:test-target #$test-target
- ;; TODO: #:install-name #$install-name
- #:install-profile #$install-profile
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:outputs %outputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs %build-inputs)))))
-
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
+ #:sources-erlang '#$sources-erlang
+ #:system #$system
+ #:name #$name
+ #:rebar-flags #$rebar-flags
+ #:tests? #$tests?
+ #:test-target #$test-target
+ ;; TODO: #:install-name #$install-name
+ #:install-profile #$install-profile
+ #:phases #$(if (pair?
+ phases)
+ (sexp->gexp
+ phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad
+ ((guile (package->derivation (or guile
+ (default-guile)) system
+ #:graft? #f)))
+
;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
;; co. would be interpreted as referring to grafted packages.
- (gexp->derivation name builder
+ (gexp->derivation name
+ builder
#:system system
#:target #f
#:graft? #f
#:guile-for-build guile)))
+(define* (rebar-lower name
+ #:key (erlang (utils-erlang-default))
+ inputs
+ native-inputs
+ outputs
+ (rebar (utils-rebar-default))
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME from the given arguments."
+
+ (let* ((erlang-packages ;List of Erlang packages.
+ (filter (lambda (input)
+ (pkg-name? (input->name input)))
+ (append inputs native-inputs)))
+
+ (erlang-sources (map (lambda (input)
+ (input->source input)) erlang-packages)))
+
+ (define private-keywords
+ '(#:target #:rebar #:erlang #:inputs #:native-inputs #:sources-erlang))
+
+ (and (not target) ;XXX: no cross-compilation
+ (bag (name name)
+ (system system)
+ (host-inputs inputs)
+ (build-inputs `(,@(standard-packages) ("erlang" ,erlang)
+ ("rebar" ,rebar)
+ ,@inputs
+ ,@native-inputs))
+ (outputs outputs)
+ (build rebar-build)
+ (arguments (append (list #:sources-erlang erlang-sources)
+ (strip-keyword-arguments private-keywords
+ arguments)))))))
+
(define rebar-build-system
- (build-system
- (name 'rebar)
- (description "The standard Rebar build system")
- (lower lower)))
+ (build-system (name 'rebar)
+ (description "The standard Rebar build system")
+ (lower rebar-lower)))
+
+;;;
+;;; Exports
+;;;
+
+(define hexpm-uri
+ hexpm->uri)
+
+(define hexpm-package-url
+ hexpm-tarballs)
+
+(define %rebar-build-system-modules
+ utils-imported-modules)
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 00000000..1d17ae49
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,373 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Builder-side code of the standard Mix package build procedure.
+;;
+;; The standard procedure is presented here:
+;; https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html#project-compilation
+;;
+;; It boils down to:
+;; 1) MIX_ENV=prod mix compile
+;; 2) mix test
+;;
+;; Most of the code here comes from the necessity to convince mix to compile
+;; without accessing the network. Here is the procedure adapted for Guix:
+;; if:
+;; 1) `<source>' is an archive of a package downloaded from hex.pm.
+;; See: https://github.com/hexpm/specifications/blob/main/package_tarball.md
+;; 2) `<hex-lib>' is the name of the Hex library, e.g. hex-2.0.5.
+;; `<hex-path>' is the path in the store of Hex.
+;; See: `(gnu packages elixir)'
+;;
+;; then the steps to build a package pkg are:
+;; 1) tar <source>
+;; 2) tar contents.tar.gz
+;; 3) export MIX_ENV=prod
+;; 4) export MIX_HOME=.mix
+;; 5) export MIX_ARCHIVES="$(MIX_HOME)"/archives
+;; 6) mkdir -p "$(MIX_ARCHIVES)"
+;; 7) ln -snd <hex-path>/lib/<hex-lib> "$(MIX_ARCHIVES)"/<hex-lib>/<hex-lib>
+;; 8) <profile> is either `prod' or `shared' depending on mix.exs
+;; see: `build_per_environment' in mix documentation.
+;; 9) For all Elixir or Erlang package p in inputs, we have <p-name> the name
+;; of the associated library (e.g. hex-2.0.5). We must:
+;; install p under _build/<profile>/lib/<p-name>
+;; install p source _build/<profile>/lib/<p-name>
+;; 10) mix compile --no-deps-check
+;; 11) mix test --no-deps-check
+;; 12) install build artifacts under #$out/lib/elixir/X.Y/
+;; where X and Y are the major and minor version numbers of Elixir.
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module (guix build utils)
+ #:use-module ((guix build gnu-build-system)
+ #:prefix gnu:)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 ftw)
+ #:use-module (srfi srfi-1)
+ #:export (mix-build strip-elixir-prefix %standard-phases))
+
+;;
+;; version
+;;
+
+;; XXX: copied from (guix utils) since not available from the build side.
+;; XXX: There may be a way to avoid this duplicated code?
+(define (version-prefix version-string num-parts)
+ "Truncate version-string to the first num-parts components of the version.
+For example, (version-prefix \"2.1.47.4.23\" 3) returns \"2.1.47\""
+ (string-join (take (string-split version-string #\.) num-parts) "."))
+
+;; XXX: copied from (guix utils) since not available from the build side.
+;; XXX: There may be a way to avoid this duplicated code?
+(define (version-major+minor version-string)
+ "Return \"<major>.<minor>\", where major and minor are the major and
+minor version numbers from version-string."
+ (version-prefix version-string 2))
+
+;;
+;; pkg
+;;
+
+;; The prefix of Elixir packages as a regular expression.
+(define pkg-elixir-prefix
+ "^elixir-")
+
+;; The prefix of Erlang packages as a regular expression.
+(define pkg-erlang-prefix
+ "^erlang-")
+
+(define (pkg-name->library-name name)
+ "Return the name of the Mix project deduced from the name of the Guix package.
+
+For example: elixir-a-pkg-1.0.2 → a_pkg"
+
+ (let* ((re (format #f "~a(.*)" pkg-elixir-prefix))
+ (re-match (string-match re name))
+ (name-version (if re-match
+ (regexp-substitute #f re-match 1)
+ (error (format #f "AssertionError d722a480
+ Assertion: re matches name.
+ re = ~a
+ name = ~a" re
+ name)))))
+
+ ;; A snake_case name.
+ (string-join (drop-right (string-split name-version #\-) 1) "_")))
+
+(define (pkg->dir-install elixir-store pkg-store pkg-name)
+ "Return the path under the path PKG-STORE where to install the package named PKG-NAME given the path of the Elixir used to build ELIXIR-STORE.
+
+Example:
+ - if:
+ - elixir-store = /gnu/store/…elixir-1.14.0
+ - pkg-store = /gnu/store/…kv-1.0.0
+ - pkg-name = elixir-kv
+ - then:
+ - (pkg->dir-install elixir-store pkg-store pkg-name) = /gnu/store/…kv-1.0.0/lib/elixir/1.14/kv"
+ (let ((X.Y (path->elixir-X.Y elixir-store))
+ (lib-name (pkg-name->library-name pkg-name)))
+ (string-append (path->elixir-lib pkg-store X.Y) "/" lib-name)))
+
+;;
+;; mix
+;;
+
+;; See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+(define mix-MIX_HOME
+ "MIX_HOME")
+(define mix-MIX_ENV
+ "MIX_ENV")
+(define mix-MIX_ENV-prod
+ "prod")
+
+(define (mix-target-dir)
+ "Return the directory where build artifacts are to be installed according to
+MIX_ENV in the current directory."
+
+ (format #f "_build/~a/lib"
+ (getenv mix-MIX_ENV)))
+
+;;
+;; path
+;;
+
+(define (path->elixir-lib path X.Y)
+ "Return the path of the directory where libraries of an Elixir package are installed in the store."
+ (string-append path "/lib/elixir/" X.Y))
+
+(define (path->erlang-lib path)
+ "Return the path of the directory where libraries of an Erlang package are installed in the store."
+ (string-append path "/lib/erlang/lib"))
+
+(define (path->elixir-X.Y elixir)
+ "Given a path in the store where elixir has been installed, return its
+version as X.Y where X and Y are its major and minor versions."
+ (let ((version (last (string-split elixir #\-))))
+ (version-major+minor version)))
+
+;;
+;; phase
+;;
+
+(define* (phase-unpack #:key source #:allow-other-keys)
+ "Unpack SOURCE."
+ (invoke "tar" "xvf" source)
+ (invoke "tar" "xvf" "contents.tar.gz"))
+
+(define* (phase-configure-mix-env #:key (mix-env mix-MIX_ENV-prod)
+ #:allow-other-keys)
+ "Set default MIX_ENV."
+
+ (let ((values (list mix-MIX_ENV-prod "shared")))
+ (when (not (member mix-env values string=?))
+ (error (format #f "AssertionError 45f9a67d
+ Assertion: mix-env is one of values.
+ values = ~a
+" values)))
+ (setenv mix-MIX_ENV mix-env)))
+
+(define* (phase-install-hex #:key inputs name #:allow-other-keys)
+ "Install Hex."
+
+ (let* ((hex-lib (string-append (assoc-ref inputs "mix-hex") "/lib"))
+ (hex-name (last (scandir hex-lib)))
+ (MIX_ARCHIVES "MIX_ARCHIVES")
+ (hex-archive-path ""))
+
+ (setenv mix-MIX_HOME ".mix")
+ (setenv MIX_ARCHIVES
+ (string-append (getenv mix-MIX_HOME) "/archives"))
+ (set! hex-archive-path
+ (string-append (getenv MIX_ARCHIVES) "/" hex-name))
+ (mkdir-p hex-archive-path)
+ (symlink (string-append hex-lib "/" hex-name)
+ (string-append hex-archive-path "/" hex-name))))
+
+;; Below are definitions useful to understand the following code.
+;;
+;; - « p : StorePath » means that « p is a String that represents a path of a
+;; package in the store ».
+;;
+;; - « i : Input » means that i has the form (key . path) where key : String that
+;; represent the name of a package and path : StorePath.
+;;
+;; - « al : AList » means that « al is an Association List ».
+;;
+;; - « al : AList Input » means that « al is an Association List of Input ».
+;;
+;; - « p : Pkg » means that p has the form (type . path) where type is either
+;; 'erlang or 'elixir and path : StorePath.
+;;
+;; - « l : Lib » means that p has the form (lib-name . lib-path) where
+;; lib-name is the name of an Erlang or Elixir library and lib-path is its path.
+(define* (phase-install-dependencies #:key inputs #:allow-other-keys)
+ "Install dependencies."
+
+ (let ((target-dir (mix-target-dir))
+ (X.Y (path->elixir-X.Y (assoc-ref inputs "elixir"))))
+
+ ;; Where to install the dependencies.
+ (mkdir-p target-dir)
+
+ (define (install-lib lib)
+ "Install a Lib LIB under target-dir."
+ ;; XXX: use match
+ (let ((lib-name (car lib))
+ (lib-path (cdr lib)))
+ (let ((target (string-append target-dir "/" lib-name)))
+ (symlink lib-path target))))
+
+ (define (install-libs libraries)
+ "Install the set of the list of Lib LIBRARIES under target-dir."
+ (for-each (lambda (lib)
+ (install-lib lib)) libraries))
+
+ (define (pkg->libraries pkg)
+ "Return the list of Lib libraries associated to a Pkg."
+ ;; XXX: use match
+ (let* ((pkg-type (car pkg))
+ (pkg-path (cdr pkg))
+ (lib-folder (cond
+ ((eq? pkg-type
+ 'elixir)
+ (path->elixir-lib pkg-path X.Y))
+ ((eq? pkg-type
+ 'erlang)
+ (path->erlang-lib pkg-path)))))
+ (map (lambda (lib-name)
+ (cons lib-name
+ (string-append lib-folder "/" lib-name)))
+ (drop (scandir lib-folder) 2))))
+
+ (define (install-pkg-libraries pkg)
+ "Install all libraries of a given Pkg PKG under target-dir."
+ (install-libs (pkg->libraries pkg)))
+
+ (define (input->pkg input)
+ "Return a Pkg if Input INPUT is an Erlang or Elixir Input else #f."
+ (let ((type? (cond
+ ((string-match pkg-erlang-prefix
+ (car input))
+ 'erlang)
+ ((string-match pkg-elixir-prefix
+ (car input))
+ 'elixir)
+ (#t #f))))
+ (if type?
+ (cons type?
+ (cdr input)) #f)))
+
+ (define (inputs->pkgs inputs)
+ "Return the a list of Pkg, one for each Erlang or Elixir Input in INPUTS."
+ (filter pair?
+ (map input->pkg inputs)))
+
+ (for-each (lambda (pkg)
+ (install-pkg-libraries pkg))
+ (inputs->pkgs inputs))))
+
+(define* (phase-build . args_ignored)
+ "Builds the Mix project according to MIX_ENV."
+ (invoke "mix" "compile" "--no-deps-check"))
+
+(define* (phase-check #:key (tests? #t) name #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (begin
+ (let ((mix-env (getenv mix-MIX_ENV)))
+ (setenv mix-MIX_ENV "test")
+ (invoke "mix" "test" "--no-deps-check")
+ (setenv mix-MIX_ENV mix-env)))
+ (format #t "Tests have been skipped since test? parameter value was: ~a.
+"
+ tests?)))
+
+(define* (phase-remove-mix-dirs . ignored_args)
+ "Remove all .mix/ directories."
+ (let ((mix-dirs (find-files "."
+ (file-name-predicate (format #f "\\~a$"
+ (getenv
+ mix-MIX_HOME)))
+ #:directories? #t)))
+ (for-each (lambda (mix-dir)
+ (delete-file-recursively mix-dir)) mix-dirs)))
+
+(define* (phase-install #:key inputs outputs name #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let ((dir-build (string-append (mix-target-dir) "/"
+ (pkg-name->library-name name)))
+ (dir-install (pkg->dir-install (assoc-ref inputs "elixir")
+ (assoc-ref outputs "out") name)))
+ (mkdir-p dir-install)
+ (copy-recursively dir-build dir-install
+ #:follow-symlinks? #t)))
+
+(define mix-%standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'unpack
+ phase-unpack)
+ (add-after 'unpack 'condifure-mix-env
+ phase-configure-mix-env)
+ (add-after 'patch-generated-file-shebangs 'install-hex
+ phase-install-hex)
+ (add-after 'install-hex 'install-dependencies
+ phase-install-dependencies)
+ (replace 'build
+ phase-build)
+ (replace 'check
+ phase-check)
+ (add-before 'install 'remove-mix-dirs
+ phase-remove-mix-dirs)
+ (replace 'install
+ phase-install)))
+
+(define* (mix-build #:key inputs
+ (phases mix-%standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build
+ #:inputs inputs
+ #:phases phases
+ args))
+
+;;
+;; This section gather exports.
+;;
+
+(define (strip-elixir-prefix name)
+ (let* ((re (format #f "~a(.*)" pkg-elixir-prefix))
+ (re-match (string-match re name)))
+
+ (if re-match
+ (regexp-substitute #f re-match 1)
+ (error (format #f "AssertionError d722a480
+ Assertion: re matches name.
+ re = ~a
+ name = ~a" re name)))))
+
+(define %standard-phases
+ mix-%standard-phases)
+
+;;; mix-build-system.scm ends here
diff --git a/guix/build/rebar-build-system.scm b/guix/build/rebar-build-system.scm
index fb664228..80813225 100644
--- a/guix/build/rebar-build-system.scm
+++ b/guix/build/rebar-build-system.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,129 +20,222 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build rebar-build-system)
- #:use-module ((guix build gnu-build-system) #:prefix gnu:)
- #:use-module ((guix build utils) #:hide (delete))
+ #:use-module ((guix build gnu-build-system)
+ #:prefix gnu:)
+ #:use-module ((guix build utils)
+ #:hide (delete))
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
+ #:use-module (ice-9 string-fun)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
- #:export (rebar-build
- %standard-phases))
+ #:export (rebar-build %standard-phases))
;;
;; Builder-side code of the standard build procedure for Erlang packages using
;; rebar3.
;;
-;; TODO: Think about whether bindir ("ebin"), libdir ("priv") and includedir
-;; "(include") need to be configurable
-(define %erlang-libdir "/lib/erlang/lib")
-
-(define* (erlang-depends #:key inputs #:allow-other-keys)
- (define input-directories
- (match inputs
- (((_ . dir) ...)
- dir)))
- (mkdir-p "_checkouts")
-
- (for-each
- (lambda (input-dir)
- (let ((elibdir (string-append input-dir %erlang-libdir)))
- (when (directory-exists? elibdir)
- (for-each
- (lambda (dirname)
- (let ((dest (string-append elibdir "/" dirname))
- (link (string-append "_checkouts/" dirname)))
- (when (not (file-exists? link))
- ;; RETHINK: Maybe better copy and make writable to avoid some
- ;; error messages e.g. when using with rebar3-git-vsn.
- (symlink dest link))))
- (list-directories elibdir)))))
- input-directories))
-
-(define* (unpack #:key source #:allow-other-keys)
- "Unpack SOURCE in the working directory, and change directory within the
-source. When SOURCE is a directory, copy it in a sub-directory of the current
-working directory."
- (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
- (gnu-unpack #:source source)
- ;; Packages from hex.pm typically have a contents.tar.gz containing the
- ;; actual source. If this tar file exists, extract it.
- (when (file-exists? "contents.tar.gz")
- (invoke "tar" "xvf" "contents.tar.gz"))))
-
-(define* (build #:key (rebar-flags '()) #:allow-other-keys)
- (apply invoke `("rebar3" "compile" ,@rebar-flags)))
-
-(define* (check #:key target (rebar-flags '()) (tests? (not target))
- (test-target "eunit")
- #:allow-other-keys)
- (if tests?
- (apply invoke `("rebar3" ,test-target ,@rebar-flags))
- (format #t "test suite not run~%")))
+;;
+;; utils
+;;
-(define (erlang-package? name)
- "Check if NAME correspond to the name of an Erlang package."
- (string-prefix? "erlang-" name))
-
-(define (package-name-version->erlang-name name+ver)
- "Convert the Guix package NAME-VER to the corresponding Erlang name-version
-format. Essentially drop the prefix used in Guix and replace dashes by
-underscores."
- (let* ((name- (package-name->name+version name+ver)))
- (string-join
- (string-split
- (if (erlang-package? name-) ; checks for "erlang-" prefix
- (string-drop name- (string-length "erlang-"))
- name-)
- #\-)
- "_")))
-
-(define (list-directories directory)
+(define (utils-list-directories directory)
"Return file names of the sub-directory of DIRECTORY."
(scandir directory
(lambda (file)
- (and (not (member file '("." "..")))
+ (and (not (member file
+ '("." "..")))
(file-is-directory? (string-append directory "/" file))))))
-(define* (install #:key name outputs
- (install-name (package-name-version->erlang-name name))
- (install-profile "default") ; build profile outputs to install
- #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (pkg-dir (string-append out %erlang-libdir "/" install-name)))
- (let ((bin-dir (string-append "_build/" install-profile "/bin"))
- (lib-dir (string-append "_build/" install-profile "/lib")))
- ;; install _build/PROFILE/bin
- (when (file-exists? bin-dir)
- (copy-recursively bin-dir out #:follow-symlinks? #t))
- ;; install _build/PROFILE/lib/*/{ebin,include,priv}
- (for-each
- (lambda (*)
- (for-each
- (lambda (dirname)
- (let ((src-dir (string-append lib-dir "/" * "/" dirname))
- (dst-dir (string-append pkg-dir "/" dirname)))
- (when (file-exists? src-dir)
- (copy-recursively src-dir dst-dir #:follow-symlinks? #t))
- (false-if-exception
- (delete-file (string-append dst-dir "/.gitignore")))))
- '("ebin" "include" "priv")))
- (list-directories lib-dir))
- (false-if-exception
- (delete-file (string-append pkg-dir "/priv/Run-eunit-loop.expect"))))))
-
-(define %standard-phases
+;;
+;; source
+;;
+
+(define source->name
+ car)
+(define source->tar
+ cadr)
+
+;;
+;; tar
+;;
+
+(define* (tar-unpack tar)
+ (invoke "tar" "xvf" tar)
+ (invoke "tar" "xvf" "contents.tar.gz")
+
+ ;; Prevent an error message at install phase.
+ ;; .
+ ;; rebar3 compile produces a symlinks like so in _build/:
+ ;; priv -> ../../../../priv
+ ;; priv -> ../../../../include
+ ;;
+ ;; The install phase copies whatever has been built to the output directory.
+ ;; If the priv/ directory is absent, then an error `i/o error:
+ ;; _build/…/priv: No such file or directory' occurs. So, we make sure that a
+ ;; directory exists.
+ (for-each (lambda (dir)
+ (mkdir-p dir))
+ (list "priv" "include")))
+
+;;;
+;;; pkg-name
+;;;
+
+(define pkg-name-prefix
+ "erlang-")
+
+(define pkg-name-prefix-re
+ (format #f "^~a(.*)" pkg-name-prefix))
+
+(define (pkg-name? name)
+ (string-match (format #f "^~a" pkg-name-prefix) name))
+
+(define (pkg-name->name name)
+ (regexp-substitute #f
+ (string-match pkg-name-prefix-re name) 1))
+
+(define* (pkg-name->lib-name name)
+ "erlang-a-b-1.0.2 -> a_b-1.0.2"
+
+ (let ((elements (string-split (pkg-name->name name) #\-)))
+ (string-append (string-join (drop-right elements 1) "_") "-"
+ (last elements))))
+
+(define* (pkg-name->build-dir name
+ #:key (profile "default"))
+ (string-append (format #f "_build/~a/lib/" profile)
+ (car (string-split (pkg-name->lib-name name) #\-))))
+
+(define (lib-name-no-version lib-name)
+ (car (string-split lib-name #\-)))
+
+;;
+;; phase
+;;
+
+(define* (phase-unpack #:key source #:allow-other-keys)
+ (tar-unpack source))
+
+(define (phase-configure-HOME . ignored_args)
+ "In some cases, it is needed for the environment variable HOME to be defined
+as a directory with write permission.
+
+Examples of errors:
+ - Could not write to \"/homeless-shelter/.cache/rebar3/hex\". Please ensure the path is writeable.
+"
+
+ (let ((HOME "HOME")
+ (tmp "/tmp"))
+ (setenv HOME tmp)
+ (format #t "~a=~a\n" HOME tmp)))
+
+(define* (phase-configure-dependencies #:key name
+ version
+ inputs
+ sources-erlang
+ (install-profile "default")
+ #:allow-other-keys)
+
+ ;; If source in sources-erlang, then install it under _checkouts/.
+ ;; see: https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies
+ (let ((_checkouts "_checkouts"))
+ (mkdir-p _checkouts)
+ (for-each (lambda (source)
+ (match source
+ ((name tar)
+ (let ((src (string-append _checkouts "/" name)))
+ (mkdir-p src)
+ (with-directory-excursion src
+ (tar-unpack tar))))
+ (_ #f))) sources-erlang))
+
+ ;; If input in inputs is an Erlang package, then install it under _build/.
+ (let ((_build (format #f "_build/~a/checkouts" install-profile)))
+ (mkdir-p _build)
+ (match inputs
+ (((_ . dirs) ..1)
+ (for-each (lambda (dir)
+ (let ((elib (string-append dir "/lib/erlang/lib")))
+ (when (directory-exists? elib)
+ (for-each (lambda (dirname)
+ (let ((src (string-append elib "/" dirname))
+ (dest (string-append _build "/"
+ (lib-name-no-version
+ dirname))))
+ (copy-recursively src dest
+ #:log #f)
+ (mkdir-p (string-append dest "/priv"))))
+ (utils-list-directories elib))))) dirs))
+ (_ #f))))
+
+(define* (phase-build #:key name
+ (rebar-flags '()) #:allow-other-keys)
+ (apply invoke
+ `("rebar3" "compile"
+ ,@rebar-flags)))
+
+(define* (phase-check #:key target
+ (rebar-flags '())
+ (tests? (not target))
+ (test-target "eunit")
+ #:allow-other-keys)
+ (if tests?
+ (apply invoke
+ `("rebar3" ,test-target
+ ,@rebar-flags))
+ (format #t "test suite not run~%")))
+
+(define* (phase-install #:key name outputs
+ (install-profile "default") #:allow-other-keys)
+ (let* ((build-dir (pkg-name->build-dir name
+ #:profile install-profile))
+ (out-build-dir (string-append (assoc-ref outputs "out")
+ "/lib/erlang/lib/"
+ (pkg-name->lib-name name))))
+
+ (mkdir-p out-build-dir)
+ (copy-recursively build-dir out-build-dir
+ #:follow-symlinks? #t)))
+
+;;
+;; rebar
+;;
+
+(define rebar-%standard-phases
(modify-phases gnu:%standard-phases
- (replace 'unpack unpack)
+ (replace 'unpack
+ phase-unpack)
+ (add-after 'unpack 'configure-HOME
+ phase-configure-HOME)
(delete 'bootstrap)
(delete 'configure)
- (add-before 'build 'erlang-depends erlang-depends)
- (replace 'build build)
- (replace 'check check)
- (replace 'install install)))
+ (add-before 'build 'configure-dependencies
+ phase-configure-dependencies)
+ (replace 'build
+ phase-build)
+ (replace 'check
+ phase-check)
+ (replace 'install
+ phase-install)))
-(define* (rebar-build #:key inputs (phases %standard-phases)
+(define* (rebar-build #:key inputs
+ (phases rebar-%standard-phases)
#:allow-other-keys #:rest args)
"Build the given Erlang package, applying all of PHASES in order."
- (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+ (apply gnu:gnu-build
+ #:inputs inputs
+ #:phases phases
+ args))
+
+;;
+;; Exported bindings.
+;;
+
+(define %standard-phases rebar-%standard-phases)
+
+
+;;; rebar-build-system.scm ends here
base-commit: 4dfbc536689b07e56aead3dd864b8af54613d091
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] mix-build-system: draft 1
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
@ 2023-10-28 21:43 ` Liliana Marie Prikler
2023-10-29 17:19 ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (12 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-10-28 21:43 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801; +Cc: Katherine Cox-Buday, Andrew Tropin
Am Samstag, dem 28.10.2023 um 22:19 +0200 schrieb Pierre-Henry
Fröhring:
> This commit introduces a mix-build-system. The provided code ensures
> that the following code runs without errors:
>
> ./pre-inst-env guix build elixir-machete
>
> A key challenge is the lack of bit reproducibility, in part due to
> rebar3's lack of bit reproducibility. Future patches may address
> this, and I welcome feedback.
>
> Given the changes, splitting them into focused patches might be best.
> As a first-time contributor, I seek advice on a suitable patch
> sequence.
>
> I also request guidance from the Guix community for a seamless
> integration. Please suggest next steps for the mix-build-system
> integration.
>
> Thank you.
> ---
I'd suggest the following order:
1. Clean up your changes for rebar-build-system
2. Add all the packages that can be built with rebar-build-system
3. Add mix-build-system
4. Add all the packages that need to be built with mix-build-system
Steps 2 and 4 should be further split in one patch per package with
each package only requiring the previous ones to build.
> +(define* (tar-unpack tar)
> + [...])
> +(define* (phase-unpack #:key source #:allow-other-keys)
> + (tar-unpack source))
That's a little silly, isn't it? Stick with a single procedure please.
Also, we're not doing Hungarian variable names.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
2023-10-28 21:43 ` Liliana Marie Prikler
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated Pierre-Henry Fröhring
` (31 more replies)
2023-11-08 9:21 ` [bug#66801] A minimal set of changes Pierre-Henry Fröhring
` (11 subsequent siblings)
13 siblings, 32 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
The builder now accepts the `#:sources-erlang` parameter, which expects a list
of "Source" items. Each "Source" corresponds to the source code of a library
directory, which is where Erlang looks for compiled modules. Documentation:
https://www.erlang.org/doc/man/code#code-path. Each Source is installed as a
"Checkout", which are local dependencies linked to directories managed by
rebar. For more information, see
https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies. Lacking
checkouts, rebar3 will not compile if there is no network access.
Change-Id: Idc3aa8bb204f55d0594c1669399845cd9b9e86ab
---
guix/build-system/rebar.scm | 274 +++++++++++++++++++-----------
guix/build/rebar-build-system.scm | 255 +++++++++++++++++----------
2 files changed, 339 insertions(+), 190 deletions(-)
diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm
index de1294ec..862721ee 100644
--- a/guix/build-system/rebar.scm
+++ b/guix/build-system/rebar.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,102 +19,117 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system rebar)
- #:use-module (guix store)
- #:use-module (guix utils)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
#:use-module (guix gexp)
- #:use-module (guix packages)
#:use-module (guix monads)
+ #:use-module (guix packages)
#:use-module (guix search-paths)
- #:use-module (guix build-system)
- #:use-module (guix build-system gnu)
- #:export (hexpm-uri
- hexpm-package-url
- %rebar-build-system-modules
- rebar-build
- rebar-build-system))
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (srfi srfi-1)
+ #:export (hexpm-uri hexpm-package-url %rebar-build-system-modules
+ rebar-build rebar-build-system))
-;;;
-;;; Definitions for the hex.pm repository,
-;;;
+;; Source
+;; A « Source » reprensents the source code to a library directory. It is
+;; defined as (list <name> <origin>) where: <name> is a string representing
+;; the name of a library directory and <origin> is an origin as defined
+;; (guix packages).
+
+
+;; Pattern that an Erlang Guix package name is expected to match.
+(define pkg-name-re "^erlang-(.*)")
+
+(define (pkg-name->match name)
+ "Return the match object from NAME if NAME starts with pkg-name-prefix."
+ (string-match pkg-name-re name))
+
+(define (pkg-name? name)
+ "Test if NAME is the name of an Erlang Guix package."
+ (or (pkg-name->match name) #f))
-;; URL and paths from
-;; https://github.com/hexpm/specifications/blob/master/endpoints.md
-(define %hexpm-repo-url
- (make-parameter "https://repo.hex.pm"))
+(define (pkg-name->suffix name)
+ "Return the suffix of the name of an Erlang Guix package."
+ (regexp-substitute #f (pkg-name->match name) 1))
-(define hexpm-package-url
- (string-append (%hexpm-repo-url) "/tarballs/"))
+(define* (pkg-name->library-directory-name name #:key (version ""))
+ "Return the name of the library directory associated with the Erlang Guix package name NAME."
+ (string-append (string-replace-substring (pkg-name->suffix name) "-" "_")
+ (if (string= version "") "" (string-append "-" version))))
+
+;; See: https://github.com/hexpm/specifications/blob/master/endpoints.md
+(define hexpm (make-parameter "https://repo.hex.pm"))
+
+(define hexpm-tarballs (string-append (hexpm) "/tarballs/"))
(define (hexpm-uri name version)
"Return a URI string for the package hosted at hex.pm corresponding to NAME
-and VERSION."
- (string-append hexpm-package-url name "-" version ".tar"))
+and VERSION.
-;;
-;; Standard build procedure for Erlang packages using Rebar.
-;;
+XXX: should a warning be emitted?
+If NAME is not an Erlang Guix package name, then emit a warning. The download
+will fail if it is not correct anyway."
-(define %rebar-build-system-modules
- ;; Build-side modules imported by default.
- `((guix build rebar-build-system)
- ,@%gnu-build-system-modules))
+ (define (warn-about name)
+ (format #t "AssertionWarning 4dcbff27
+ Assertion: re matches name.
+ re = ~a
+ name = ~a
+" pkg-name-re name)
+
+ name)
-(define (default-rebar3)
- "Return the default Rebar3 package."
+ (define (name->archive-name name)
+ (if (pkg-name? name)
+ (string-append (pkg-name->library-directory-name name #:version version) ".tar")
+ (string-append (warn-about name) "-" version ".tar")))
+
+ (string-append hexpm-tarballs (name->archive-name name)))
+
+(define (rebar-default)
;; Lazily resolve the binding to avoid a circular dependency.
(let ((erlang-mod (resolve-interface '(gnu packages erlang))))
(module-ref erlang-mod 'rebar3)))
-(define (default-erlang)
- "Return the default Erlang package."
+(define (erlang-default)
;; Lazily resolve the binding to avoid a circular dependency.
(let ((erlang-mod (resolve-interface '(gnu packages erlang))))
(module-ref erlang-mod 'erlang)))
-(define* (lower name
- #:key source inputs native-inputs outputs system target
- (rebar (default-rebar3))
- (erlang (default-erlang))
- #:allow-other-keys
- #:rest arguments)
- "Return a bag for NAME from the given arguments."
- (define private-keywords
- '(#:target #:rebar #:erlang #:inputs #:native-inputs))
-
- (and (not target) ;XXX: no cross-compilation
- (bag
- (name name)
- (system system)
- (host-inputs `(,@(if source
- `(("source" ,source))
- '())
- ,@inputs))
- (build-inputs `(("rebar" ,rebar)
- ("erlang" ,erlang) ;; for escriptize
- ,@native-inputs
- ;; Keep the standard inputs of 'gnu-build-system'.
- ,@(standard-packages)))
- (outputs outputs)
- (build rebar-build)
- (arguments (strip-keyword-arguments private-keywords arguments)))))
-
-(define* (rebar-build name inputs
- #:key
- guile source
- (rebar-flags ''("skip_deps=true" "-vv"))
- (tests? #t)
- (test-target "eunit")
- ;; TODO: install-name ; default: based on guix package name
- (install-profile "default")
- (phases '(@ (guix build rebar-build-system)
- %standard-phases))
- (outputs '("out"))
- (search-paths '())
- (native-search-paths '())
- (system (%current-system))
- (imported-modules %rebar-build-system-modules)
- (modules '((guix build rebar-build-system)
- (guix build utils))))
+(define imported-modules
+ `((guix build rebar-build-system)
+ ,@%gnu-build-system-modules))
+
+(define (input->source input)
+ "Return a Source associated to the Input INPUT."
+ (match input
+ ((name package)
+ (list (pkg-name->library-directory-name name)
+ (package-source package)))))
+
+(define* (rebar-build name
+ inputs
+ #:key
+ guile
+ source
+ (rebar-flags ''())
+ (tests? #t)
+ (test-target "eunit")
+ ;; TODO: install-name ; default: based on guix package name
+ (install-profile "default")
+ (phases '(@ (guix build rebar-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (native-search-paths '())
+ (system (%current-system))
+ (imported-modules imported-modules)
+ (modules '((guix build rebar-build-system)
+ (guix build utils)))
+ (sources-erlang '()))
"Build SOURCE with INPUTS."
(define builder
@@ -122,35 +138,95 @@ (define* (rebar-build name inputs
(use-modules #$@(sexp->gexp modules))
#$(with-build-variables inputs outputs
+
#~(rebar-build #:source #+source
- #:system #$system
- #:name #$name
- #:rebar-flags #$rebar-flags
- #:tests? #$tests?
- #:test-target #$test-target
- ;; TODO: #:install-name #$install-name
- #:install-profile #$install-profile
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:outputs %outputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs %build-inputs)))))
-
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
+ #:sources-erlang '#$sources-erlang
+ #:system #$system
+ #:name #$name
+ #:rebar-flags #$rebar-flags
+ #:tests? #$tests?
+ #:test-target #$test-target
+ ;; TODO: #:install-name #$install-name
+ #:install-profile #$install-profile
+ #:phases #$(if (pair?
+ phases)
+ (sexp->gexp
+ phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad
+ ((guile (package->derivation (or guile
+ (default-guile)) system
+ #:graft? #f)))
+
;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
;; co. would be interpreted as referring to grafted packages.
- (gexp->derivation name builder
+ (gexp->derivation name
+ builder
#:system system
#:target #f
#:graft? #f
#:guile-for-build guile)))
+(define* (lower name
+ #:key
+ (erlang (erlang-default))
+ inputs
+ native-inputs
+ outputs
+ (rebar (rebar-default))
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME from the given arguments."
+
+ (let* ((erlang-packages
+ (filter (lambda (input)
+ (match input
+ ((name _) (pkg-name? name))))
+ (append inputs native-inputs)))
+
+ (erlang-sources (map input->source erlang-packages)))
+
+ (define private-keywords
+ '(#:target #:rebar #:erlang #:inputs #:native-inputs #:sources-erlang))
+
+ (and (not target) ;XXX: no cross-compilation
+ (bag (name name)
+ (system system)
+ (host-inputs inputs)
+ (build-inputs `(,@(standard-packages)
+ ("erlang" ,erlang)
+ ("rebar" ,rebar)
+ ,@inputs
+ ,@native-inputs))
+ (outputs outputs)
+ (build rebar-build)
+ (arguments (append (list #:sources-erlang erlang-sources)
+ (strip-keyword-arguments private-keywords
+ arguments)))))))
+
(define rebar-build-system
- (build-system
- (name 'rebar)
- (description "The standard Rebar build system")
- (lower lower)))
+ (build-system (name 'rebar)
+ (description "The standard Rebar build system")
+ (lower lower)))
+
+
+;;;
+;;; Exports
+;;;
+
+(define hexpm-package-url hexpm-tarballs)
+
+(define %rebar-build-system-modules imported-modules)
+
+
+;;; rebar.scm ends here
diff --git a/guix/build/rebar-build-system.scm b/guix/build/rebar-build-system.scm
index fb664228..b68348bd 100644
--- a/guix/build/rebar-build-system.scm
+++ b/guix/build/rebar-build-system.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,125 +24,197 @@ (define-module (guix build rebar-build-system)
#:use-module ((guix build utils) #:hide (delete))
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
+ #:use-module (ice-9 string-fun)
+ #:use-module (ice-9 receive)
+ #:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
- #:export (rebar-build
- %standard-phases))
+ #:export (rebar-build %standard-phases))
;;
;; Builder-side code of the standard build procedure for Erlang packages using
;; rebar3.
;;
-;; TODO: Think about whether bindir ("ebin"), libdir ("priv") and includedir
-;; "(include") need to be configurable
+;; Library directory
+;; A « library directory » is a directory where Erlang searches for compiled
+;; code. Its name should look like: `a_name-1.2.3' where the suffix `-1.2.3'
+;; is optional. See: https://www.erlang.org/doc/man/code#code-path.
+;;
+;; Package name
+;; A « package name » is the value of the name field of a package
+;; definition. It looks like: `prefix-a-name-1.2.3'. See:
+;; https://guix.gnu.org/manual/en/html_node/Package-Naming.html
+;;
+;; Profile
+;; For Rebar3, a « profile » is a name associated to a set of configuration
+;; settings overriding or complementing the regular configuration. See:
+;; https://rebar3.org/docs/configuration/profiles
+;;
+;; Source
+;; A « source » represents the source code associated to a Guix package as
+;; defined by its `source' field. Here, the data sctructure used to
+;; represent a source has the form `(list name path)' where `name' is a
+;; library directory name and `path' is the store path where to find the
+;; source code.
+;;
+;; Checkout
+;; A « checkout » is a locally defined dependency related to a directory
+;; managed by rebar. See:
+;; https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies
-(define %erlang-libdir "/lib/erlang/lib")
+(define sep "/")
-(define* (erlang-depends #:key inputs #:allow-other-keys)
- (define input-directories
- (match inputs
- (((_ . dir) ...)
- dir)))
- (mkdir-p "_checkouts")
-
- (for-each
- (lambda (input-dir)
- (let ((elibdir (string-append input-dir %erlang-libdir)))
- (when (directory-exists? elibdir)
- (for-each
- (lambda (dirname)
- (let ((dest (string-append elibdir "/" dirname))
- (link (string-append "_checkouts/" dirname)))
- (when (not (file-exists? link))
- ;; RETHINK: Maybe better copy and make writable to avoid some
- ;; error messages e.g. when using with rebar3-git-vsn.
- (symlink dest link))))
- (list-directories elibdir)))))
- input-directories))
+;; Where Erlang libraries are installed relative to a package path in the store.
+(define lib-erlang-lib "lib/erlang/lib")
+
+(define (list-directories directory)
+ "Return file names of the sub-directory of DIRECTORY."
+ (scandir directory
+ (lambda (file)
+ (and (not (member file '("." "..")))
+ (file-is-directory? (string-append directory sep file))))))
+
+(define* (pkg-name->libdir-name name)
+ "Return the library name deduced from the Erlang package name NAME."
+ (let* ((suffix (regexp-substitute #f (string-match "^erlang-(.*)" name) 1))
+ (elements (string-split suffix #\-)))
+ (string-append (string-join (drop-right elements 1) "_") "-" (last elements))))
+
+(define (libdir-name->prefix name)
+ "Return the prefix of a library directory name NAME."
+ (car (string-split name #\-)))
+
+(define (rebar-build-dir profile)
+ "Return the path where rebar builds libraries given the profile PROFILE."
+ (format #f "_build/~a/lib" profile))
+
+(define* (pkg-name->build-dir name #:key (profile "default"))
+ "Return the path of library directory where rebar3 builds code of an Erlang package named NAME given the profile PROFILE."
+ (string-append (rebar-build-dir profile) sep (libdir-name->prefix (pkg-name->libdir-name name))))
(define* (unpack #:key source #:allow-other-keys)
- "Unpack SOURCE in the working directory, and change directory within the
-source. When SOURCE is a directory, copy it in a sub-directory of the current
-working directory."
- (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
- (gnu-unpack #:source source)
- ;; Packages from hex.pm typically have a contents.tar.gz containing the
- ;; actual source. If this tar file exists, extract it.
- (when (file-exists? "contents.tar.gz")
- (invoke "tar" "xvf" "contents.tar.gz"))))
-
-(define* (build #:key (rebar-flags '()) #:allow-other-keys)
+ (if (file-is-directory? source)
+ ;; If source is a checkout:
+ (begin
+ ;; Preserve timestamps (set to the Epoch) on the copied tree so that
+ ;; things work deterministically.
+ (copy-recursively source "." #:keep-mtime? #t)
+ ;; Make the source checkout files writable, for convenience.
+ (for-each (lambda (f)
+ (false-if-exception (make-file-writable f)))
+ (find-files ".")))
+
+ ;; If source is an hex.pm archive:
+ (begin
+ (invoke "tar" "xvf" source)
+ (invoke "tar" "xvf" "contents.tar.gz")
+
+ ;; Prevent an error message during the install phase.
+ ;; `rebar3 compile' produces symlinks like so in _build/:
+ ;; priv -> ../../../../priv
+ ;; include -> ../../../../include
+ ;;
+ ;; The install phase copies whatever has been built to the output directory.
+ ;; If the priv/ directory is absent, then an error `i/o error:
+ ;; _build/…/priv: No such file or directory' occurs. So, we make sure that a
+ ;; directory exists.
+ (for-each (lambda (dir) (mkdir-p dir)) (list "priv" "include")))))
+
+(define (configure-HOME . ignored_args)
+ "In some cases, it is needed for the environment variable HOME to be defined
+as a directory with write permission. Examples of errors:
+
+Could not write to \"/homeless-shelter/.cache/rebar3/hex\". Please ensure the path is writeable.
+"
+ (let ((HOME "HOME")
+ (tmp "/tmp"))
+ (setenv HOME tmp)
+ (format #t "~a=~a\n" HOME tmp)))
+
+(define* (configure-dependencies #:key
+ (install-profile "default")
+ inputs
+ name
+ sources-erlang ;List of Source.
+ version
+ #:allow-other-keys)
+ "Rebar3 refuses to compile without network access unless its dependencies are
+present as source checkouts. To prevent unnecessary compilations, we must «
+pre-install » dependencies in Rebar's build directory."
+
+ ;; If source in sources-erlang, then install it under _checkouts/.
+ (let ((_checkouts "_checkouts"))
+ (mkdir-p _checkouts)
+
+ (define (install-source source)
+ "Install the Source SOURCE in _checkouts."
+ (match source
+ ((name path)
+ (let ((src (string-append _checkouts sep name)))
+ (mkdir-p src)
+ (with-directory-excursion src (unpack #:source path))))
+ (_ #f)))
+
+ (for-each install-source sources-erlang))
+
+ ;; If input in inputs is an Erlang package, then install it under _build/.
+ (let ((_build (format #f "_build/~a/checkouts" install-profile)))
+ (mkdir-p _build)
+
+ (define (install-libdir elib name dest)
+ "Install the library directory named NAME from ELIB to DEST."
+ (let ((src (string-append elib sep name))
+ (dest (string-append dest sep (libdir-name->prefix name))))
+ (copy-recursively src dest)
+ (mkdir-p (string-append dest "/priv"))))
+
+ (define (install-all-libdirs dir dest)
+ "Install in DEST all library directories in DIR."
+ (let ((elib (string-append dir sep lib-erlang-lib)))
+ (when (directory-exists? elib)
+ (for-each (lambda (name) (install-libdir elib name dest))
+ (list-directories elib)))))
+
+ (match inputs
+ (((_ . dirs) ..1)
+ (for-each
+ (lambda (dir) (install-all-libdirs dir _build))
+ dirs))
+ (_ #f))))
+
+(define* (build #:key name (rebar-flags '()) #:allow-other-keys)
(apply invoke `("rebar3" "compile" ,@rebar-flags)))
-(define* (check #:key target (rebar-flags '()) (tests? (not target))
+(define* (check #:key target
+ (rebar-flags '())
+ (tests? (not target))
(test-target "eunit")
#:allow-other-keys)
(if tests?
(apply invoke `("rebar3" ,test-target ,@rebar-flags))
(format #t "test suite not run~%")))
-(define (erlang-package? name)
- "Check if NAME correspond to the name of an Erlang package."
- (string-prefix? "erlang-" name))
-
-(define (package-name-version->erlang-name name+ver)
- "Convert the Guix package NAME-VER to the corresponding Erlang name-version
-format. Essentially drop the prefix used in Guix and replace dashes by
-underscores."
- (let* ((name- (package-name->name+version name+ver)))
- (string-join
- (string-split
- (if (erlang-package? name-) ; checks for "erlang-" prefix
- (string-drop name- (string-length "erlang-"))
- name-)
- #\-)
- "_")))
-
-(define (list-directories directory)
- "Return file names of the sub-directory of DIRECTORY."
- (scandir directory
- (lambda (file)
- (and (not (member file '("." "..")))
- (file-is-directory? (string-append directory "/" file))))))
-
-(define* (install #:key name outputs
- (install-name (package-name-version->erlang-name name))
- (install-profile "default") ; build profile outputs to install
- #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (pkg-dir (string-append out %erlang-libdir "/" install-name)))
- (let ((bin-dir (string-append "_build/" install-profile "/bin"))
- (lib-dir (string-append "_build/" install-profile "/lib")))
- ;; install _build/PROFILE/bin
- (when (file-exists? bin-dir)
- (copy-recursively bin-dir out #:follow-symlinks? #t))
- ;; install _build/PROFILE/lib/*/{ebin,include,priv}
- (for-each
- (lambda (*)
- (for-each
- (lambda (dirname)
- (let ((src-dir (string-append lib-dir "/" * "/" dirname))
- (dst-dir (string-append pkg-dir "/" dirname)))
- (when (file-exists? src-dir)
- (copy-recursively src-dir dst-dir #:follow-symlinks? #t))
- (false-if-exception
- (delete-file (string-append dst-dir "/.gitignore")))))
- '("ebin" "include" "priv")))
- (list-directories lib-dir))
- (false-if-exception
- (delete-file (string-append pkg-dir "/priv/Run-eunit-loop.expect"))))))
+(define* (install #:key name outputs (install-profile "default") #:allow-other-keys)
+ (let* ((src (pkg-name->build-dir name #:profile install-profile))
+ (dest (string-append (assoc-ref outputs "out")
+ sep lib-erlang-lib sep
+ (pkg-name->libdir-name name))))
+ (mkdir-p dest)
+ (copy-recursively src dest #:follow-symlinks? #t)))
(define %standard-phases
(modify-phases gnu:%standard-phases
(replace 'unpack unpack)
+ (add-after 'unpack 'configure-HOME configure-HOME)
(delete 'bootstrap)
(delete 'configure)
- (add-before 'build 'erlang-depends erlang-depends)
+ (add-before 'build 'configure-dependencies configure-dependencies)
(replace 'build build)
(replace 'check check)
(replace 'install install)))
-(define* (rebar-build #:key inputs (phases %standard-phases)
- #:allow-other-keys #:rest args)
+(define* (rebar-build #:key inputs (phases %standard-phases) #:allow-other-keys #:rest args)
"Build the given Erlang package, applying all of PHASES in order."
(apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; rebar-build-system.scm ends here
base-commit: 4dfbc536689b07e56aead3dd864b8af54613d091
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated.
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 19:22 ` Liliana Marie Prikler
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm Pierre-Henry Fröhring
` (30 subsequent siblings)
31 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Wrapped Erlang programs (`erl`, `erlc`, `escript`) now prepend ERL_LIBS with
GUIX_ERL_LIBS. Reference: https://www.erlang.org/doc/man/code#code-path. The
`native-search-paths` field in the package specification sets GUIX_ERL_LIBS,
which aggregates all compiled libraries for Erlang and Elixir, akin to the
functionality of GUIX_PYTHONPATH.
Change-Id: I53d0462eb366ebe66422e0b187f4db091a9fe5b5
---
gnu/packages/erlang.scm | 101 ++++++++++++++++++++++++----------------
1 file changed, 60 insertions(+), 41 deletions(-)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c53cb72c..dafc0e81 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -28,22 +28,23 @@
(define-module (gnu packages erlang)
#:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix gexp)
- #:use-module (guix build-system gnu)
- #:use-module (guix build-system emacs)
- #:use-module (guix build-system rebar)
- #:use-module (guix download)
- #:use-module (guix git-download)
- #:use-module (guix packages)
- #:use-module (guix utils)
- #:use-module (gnu packages)
+ #:use-module (gnu packages elixir)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gl)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages perl)
- #:use-module (gnu packages version-control)
#:use-module (gnu packages tls)
- #:use-module (gnu packages wxwidgets))
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages wxwidgets)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system emacs)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system rebar)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module (guix utils))
(define-public erlang
(package
@@ -173,7 +174,16 @@ (define-public erlang
(substitute* (string-append out "/bin/erl")
(("basename") (which "basename"))
(("dirname") (which "dirname"))))))
- (add-after 'install 'install-doc
+ (add-after 'patch-erl 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("erl" "erlc" "escript")))
+ (for-each
+ (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" ":" prefix ("${GUIX_ERL_LIBS}"))))
+ programs))))
+ (add-after 'wrap-programs 'install-doc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(manpages (assoc-ref inputs "erlang-manpages"))
@@ -181,6 +191,15 @@ (define-public erlang
(mkdir-p share)
(with-directory-excursion share
(invoke "tar" "xvf" manpages))))))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ERL_LIBS")
+ (files
+ (list
+ "lib/erlang/lib"
+ (string-append
+ "lib/elixir/"
+ (version-major+minor (package-version elixir))))))))
(home-page "https://www.erlang.org/")
(synopsis "The Erlang programming language")
(description
@@ -219,12 +238,12 @@ (define-public erlang-bbmustache
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "bbmustache" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "0fvvaxdpziygxl30j59g98qkh2n47xlb7w5dfpsm2bfcsnj372v8"))))
(build-system rebar-build-system)
(inputs
- (list erlang-getopt rebar3-git-vsn
+ (list erlang-getopt erlang-rebar3-git-vsn
erlang-edown)) ; for building the docs
(arguments
`(#:tests? #f ;; requires mustache specification file
@@ -251,7 +270,7 @@ (define-public erlang-certifi
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "certifi" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96"))))
(build-system rebar-build-system)
@@ -275,7 +294,7 @@ (define-public erlang-cf
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "cf" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
(build-system rebar-build-system)
@@ -314,7 +333,7 @@ (define-public erlang-covertool
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "covertool" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
(build-system rebar-build-system)
@@ -335,7 +354,7 @@ (define-public erlang-cth-readable
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "cth_readable" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "104xgybb6iciy6i28pyyrarqzliddi8kjyq43ajaav7y5si42rb8"))))
(build-system rebar-build-system)
@@ -356,7 +375,7 @@ (define-public erlang-edown
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "edown" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "0ij47gvgs6yfqphj0f54qjzj18crj8y1dsjjlzpp3dp8pscqzbqw"))))
(build-system rebar-build-system)
@@ -373,7 +392,7 @@ (define-public erlang-erlware-commons
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "erlware_commons" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "18qam9xdzi74wppb0cj4zc8161i0i8djr79z8662m6d276f2jz5m"))))
(build-system rebar-build-system)
@@ -400,7 +419,7 @@ (define-public erlang-eunit-formatters
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "eunit_formatters" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"))))
(build-system rebar-build-system)
@@ -416,7 +435,7 @@ (define-public erlang-getopt
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "getopt" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "09pasi7ki1rivw9sl7xndj5qgjbdqvcscxk83yk85yr28gm9l0m0"))))
(build-system rebar-build-system)
@@ -433,7 +452,7 @@ (define-public erlang-hex-core
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "hex_core" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "06p65hlm29ky03vs3fq3qz6px2ylwp8b0f2y75wdf5cm0kx2332b"))))
(build-system rebar-build-system)
@@ -445,7 +464,7 @@ (define-public erlang-hex-core
(when tests?
(invoke "rebar3" "as" "test" "proper")))))))
(inputs
- (list erlang-proper rebar3-proper))
+ (list erlang-proper erlang-rebar3-proper))
(home-page "https://github.com/hexpm/hex_core")
(synopsis "Reference implementation of Hex specifications")
(description "This package provides the reference implementation of Hex
@@ -459,7 +478,7 @@ (define-public erlang-jsone
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "jsone" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1gaxiw76syjp3s9rygskm32y9799b917q752rw8bxj3bxq93g8x3"))))
(build-system rebar-build-system)
@@ -483,7 +502,7 @@ (define-public erlang-parse-trans
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "parse_trans" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "16p4c2xjrvz16kzpr9pmcvi6nxq6rwckqi9fp0ksibaxwxn402k2"))))
(build-system rebar-build-system)
@@ -506,7 +525,7 @@ (define-public erlang-proper
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "proper" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1fwcas4a9kz3w3z1jqdk9lw8822srfjk9lcpvbxkxlsv3115ha0q"))))
(build-system rebar-build-system)
@@ -532,7 +551,7 @@ (define-public erlang-jsx
(version "3.1.0")
(source (origin
(method url-fetch)
- (uri (hexpm-uri "jsx" version))
+ (uri (hexpm-uri name version))
(sha256
(base32
"1wr7jkxm6nlgvd52xhniav64xr9rml2ngb35rwjwqlqvq7ywhp0c"))))
@@ -550,7 +569,7 @@ (define-public erlang-providers
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "providers" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "05y0kz3xgx77hzn1l05byaisvmk8bgds7c22hrh0a5ba81sfi1yj"))))
(build-system rebar-build-system)
@@ -568,7 +587,7 @@ (define-public erlang-relx
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "relx" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "02gmfx1vxg9m3mq4njsqhs4972l4nb8m5p1pdcf64g09ccf17y1g"))))
(build-system rebar-build-system)
@@ -590,7 +609,7 @@ (define-public erlang-ssl-verify-fun
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "ssl_verify_fun" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
(build-system rebar-build-system)
@@ -676,14 +695,14 @@ (define-public rebar3
of locations (git, hg, etc).")
(license license:asl2.0)))
-(define-public rebar3-raw-deps
+(define-public erlang-rebar3-raw-deps
(package
- (name "rebar3-raw-deps")
+ (name "erlang-rebar3-raw-deps")
(version "2.0.0")
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "rebar3_raw_deps" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1pzmm3m8gb2s9jn8fp6shzgfmy4mvh2vdci0z6nsm74ma3ffh1i3"))))
(build-system rebar-build-system)
@@ -693,14 +712,14 @@ (define-public rebar3-raw-deps
applications as a dependent libraries.")
(license license:expat)))
-(define-public rebar3-git-vsn
+(define-public erlang-rebar3-git-vsn
(package
- (name "rebar3-git-vsn")
+ (name "erlang-rebar3-git-vsn")
(version "1.1.1")
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "rebar3_git_vsn" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1dfz56034pa25axly9vqdzv3phkn8ll0qwrkws96pbgcprhky1hx"))))
(build-system rebar-build-system)
@@ -724,14 +743,14 @@ (define-public rebar3-git-vsn
a git checkout.")
(license license:expat)))
-(define-public rebar3-proper
+(define-public erlang-rebar3-proper
(package
- (name "rebar3-proper")
+ (name "erlang-rebar3-proper")
(version "0.12.1")
(source
(origin
(method url-fetch)
- (uri (hexpm-uri "rebar3_proper" version))
+ (uri (hexpm-uri name version))
(sha256
(base32 "1f174fb6h2071wr7qbw9aqqvnglzsjlylmyi8215fhrmi38w94b6"))))
(build-system rebar-build-system)
@@ -803,7 +822,7 @@ (define-public erlang-lfe
(setenv "REBAR_CACHE_DIR" "/tmp")
(invoke "make" "-j" (number->string (parallel-job-count))
"tests"))))))))
- (native-inputs (list rebar3 rebar3-proper erlang-proper))
+ (native-inputs (list rebar3 erlang-rebar3-proper erlang-proper))
(propagated-inputs (list erlang))
(home-page "https://github.com/lfe/lfe")
(synopsis "Lisp Flavoured Erlang")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated Pierre-Henry Fröhring
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 19:25 ` Liliana Marie Prikler
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 04/32] gnu: erlang-getopt: " Pierre-Henry Fröhring
` (29 subsequent siblings)
31 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I7491af542af5ffb2d82b5555675f4f7dbef167af
---
gnu/packages/erlang-xyz.scm | 62 +++++++++++++++++++++++++++++++++++++
gnu/packages/erlang.scm | 25 +--------------
2 files changed, 63 insertions(+), 24 deletions(-)
create mode 100644 gnu/packages/erlang-xyz.scm
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
new file mode 100644
index 00000000..444fa648
--- /dev/null
+++ b/gnu/packages/erlang-xyz.scm
@@ -0,0 +1,62 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages erlang-xyz)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system rebar)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix git-download)
+ #:use-module (guix hg-download)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26))
+
+(define-public erlang-certifi
+ (package
+ (name "erlang-certifi")
+ (version "2.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96"))))
+ (build-system rebar-build-system)
+ (arguments `(#:tests? #f)) ;; have not been updated for latest cert bundle
+ (home-page "https://github.com/certifi/erlang-certifi/")
+ (synopsis "Erlang CA certificate bundle")
+ (description "This Erlang library contains a CA bundle that you can
+reference in your Erlang application. This is useful for systems that do not
+have CA bundles that Erlang can find itself, or where a uniform set of CAs is
+valuable.
+
+This an Erlang specific port of certifi. The CA bundle is derived from
+Mozilla's canonical set.")
+ (license license:bsd-3)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index dafc0e81..c729ab8a 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -29,6 +29,7 @@
(define-module (gnu packages erlang)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages elixir)
+ #:use-module (gnu packages erlang-xyz)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gl)
#:use-module (gnu packages ncurses)
@@ -263,30 +264,6 @@ (define-public erlang-bbmustache
Mustache template engine")
(license license:expat)))
-(define-public erlang-certifi
- (package
- (name "erlang-certifi")
- (version "2.9.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96"))))
- (build-system rebar-build-system)
- (arguments
- `(#:tests? #f)) ;; have not been updated for latest cert bundle
- (home-page "https://github.com/certifi/erlang-certifi/")
- (synopsis "Erlang CA certificate bundle")
- (description "This Erlang library contains a CA bundle that you can
-reference in your Erlang application. This is useful for systems that do not
-have CA bundles that Erlang can find itself, or where a uniform set of CAs is
-valuable.
-
-This an Erlang specific port of certifi. The CA bundle is derived from
-Mozilla's canonical set.")
- (license license:bsd-3)))
-
(define-public erlang-cf
(package
(name "erlang-cf")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm Pierre-Henry Fröhring
@ 2023-10-29 19:25 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-10-29 19:25 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Sonntag, dem 29.10.2023 um 15:36 +0100 schrieb Pierre-Henry
Fröhring:
> Change-Id: I7491af542af5ffb2d82b5555675f4f7dbef167af
Missing ChangeLog.
> ---
> gnu/packages/erlang-xyz.scm | 62
> +++++++++++++++++++++++++++++++++++++
> gnu/packages/erlang.scm | 25 +--------------
> 2 files changed, 63 insertions(+), 24 deletions(-)
> create mode 100644 gnu/packages/erlang-xyz.scm
>
> diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-
> xyz.scm
> new file mode 100644
> index 00000000..444fa648
> --- /dev/null
> +++ b/gnu/packages/erlang-xyz.scm
> @@ -0,0 +1,62 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
Don't forget to carry over all other relevant copyright headers.
Likewise for the following patches.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 04/32] gnu: erlang-getopt: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm Pierre-Henry Fröhring
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 05/32] gnu: erlang-edown: " Pierre-Henry Fröhring
` (28 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ic7740512545c8798a4a7927b7aeee6e33f6990a2
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 444fa648..6ca0b4ae 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -55,6 +55,23 @@ (define-public erlang-certifi
Mozilla's canonical set.")
(license license:bsd-3)))
+(define-public erlang-getopt
+ (package
+ (name "erlang-getopt")
+ (version "1.0.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "09pasi7ki1rivw9sl7xndj5qgjbdqvcscxk83yk85yr28gm9l0m0"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/jcomellas/getopt")
+ (synopsis "Command-line options parser for Erlang")
+ (description "This package provides an Erlang module to parse command line
+arguments using the GNU getopt syntax.")
+ (license license:bsd-3)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c729ab8a..6c3b845b 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -405,23 +405,6 @@ (define-public erlang-eunit-formatters
(description "This package provides a better output for Erlang eunits.")
(license license:asl2.0)))
-(define-public erlang-getopt
- (package
- (name "erlang-getopt")
- (version "1.0.2")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "09pasi7ki1rivw9sl7xndj5qgjbdqvcscxk83yk85yr28gm9l0m0"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/jcomellas/getopt")
- (synopsis "Command-line options parser for Erlang")
- (description "This package provides an Erlang module to parse command line
-arguments using the GNU getopt syntax.")
- (license license:bsd-3)))
-
(define-public erlang-hex-core
(package
(name "erlang-hex-core")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 05/32] gnu: erlang-edown: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 04/32] gnu: erlang-getopt: " Pierre-Henry Fröhring
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 06/32] gnu: erlang-rebar3-git-vsn: " Pierre-Henry Fröhring
` (27 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Iceff5a74baf1de97f478b168f122e7ec715b24d7
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 6ca0b4ae..5815d19f 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -72,6 +72,23 @@ (define-public erlang-getopt
arguments using the GNU getopt syntax.")
(license license:bsd-3)))
+(define-public erlang-edown
+ (package
+ (name "erlang-edown")
+ (version "0.8.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0ij47gvgs6yfqphj0f54qjzj18crj8y1dsjjlzpp3dp8pscqzbqw"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/uwiger/edown")
+ (synopsis "Markdown extension for EDoc")
+ (description "This package provides an extension for EDoc for generating
+Markdown.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 6c3b845b..5148abf0 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -345,23 +345,6 @@ (define-public erlang-cth-readable
outputs you want to be readable around all that noise they contain.")
(license license:bsd-3)))
-(define-public erlang-edown
- (package
- (name "erlang-edown")
- (version "0.8.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "0ij47gvgs6yfqphj0f54qjzj18crj8y1dsjjlzpp3dp8pscqzbqw"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/uwiger/edown")
- (synopsis "Markdown extension for EDoc")
- (description "This package provides an extension for EDoc for generating
-Markdown.")
- (license license:asl2.0)))
-
(define-public erlang-erlware-commons
(package
(name "erlang-erlware-commons")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 06/32] gnu: erlang-rebar3-git-vsn: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 05/32] gnu: erlang-edown: " Pierre-Henry Fröhring
@ 2023-10-29 14:36 ` Pierre-Henry Fröhring
2023-10-29 19:31 ` Liliana Marie Prikler
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 07/32] gnu: erlang-rebar3-raw-deps: " Pierre-Henry Fröhring
` (26 subsequent siblings)
31 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:36 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I5a743e71b2034ba1cfe71fe6121137b3194befed
---
gnu/packages/erlang-xyz.scm | 32 +++++++++++++++++++++++++++++++-
gnu/packages/erlang.scm | 31 -------------------------------
2 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 5815d19f..bfc4802a 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -25,7 +25,6 @@ (define-module (gnu packages erlang-xyz)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download)
- #:use-module (guix git-download)
#:use-module (guix hg-download)
#:use-module (guix packages)
#:use-module (guix utils)
@@ -89,6 +88,37 @@ (define-public erlang-edown
Markdown.")
(license license:asl2.0)))
+(define-public erlang-rebar3-git-vsn
+ (package
+ (name "erlang-rebar3-git-vsn")
+ (version "1.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1dfz56034pa25axly9vqdzv3phkn8ll0qwrkws96pbgcprhky1hx"))))
+ (build-system rebar-build-system)
+ (inputs
+ (list git-minimal/pinned))
+ (arguments
+ `(;; Running the tests require binary artifact (tar-file containing
+ ;; samples git repos) TODO: remove these from the source
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((git (assoc-ref inputs "git-minimal")))
+ (substitute* "src/rebar3_git_vsn.erl"
+ (("rebar_utils:sh\\(\"git " _)
+ (string-append "rebar_utils:sh(\"" git "/bin/git ")))))))))
+ (home-page "https://github.com/soranoba/rebar3_git_vsn")
+ (synopsis "Rebar3 plugin for generating the version from git")
+ (description "This plugin adds support for generating the version from
+a git checkout.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 5148abf0..6320e3d0 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -655,37 +655,6 @@ (define-public erlang-rebar3-raw-deps
applications as a dependent libraries.")
(license license:expat)))
-(define-public erlang-rebar3-git-vsn
- (package
- (name "erlang-rebar3-git-vsn")
- (version "1.1.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1dfz56034pa25axly9vqdzv3phkn8ll0qwrkws96pbgcprhky1hx"))))
- (build-system rebar-build-system)
- (inputs
- (list git-minimal/pinned))
- (arguments
- `(;; Running the tests require binary artifact (tar-file containing
- ;; samples git repos) TODO: remove these from the source
- #:tests? #f
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((git (assoc-ref inputs "git-minimal")))
- (substitute* "src/rebar3_git_vsn.erl"
- (("rebar_utils:sh\\(\"git " _)
- (string-append "rebar_utils:sh(\"" git "/bin/git ")))))))))
- (home-page "https://github.com/soranoba/rebar3_git_vsn")
- (synopsis "Rebar3 plugin for generating the version from git")
- (description "This plugin adds support for generating the version from
-a git checkout.")
- (license license:expat)))
-
(define-public erlang-rebar3-proper
(package
(name "erlang-rebar3-proper")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 07/32] gnu: erlang-rebar3-raw-deps: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (4 preceding siblings ...)
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 06/32] gnu: erlang-rebar3-git-vsn: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 08/32] gnu: erlang-rebar3-proper: " Pierre-Henry Fröhring
` (25 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I42b34a1bba7e2eb3cce4c385f0c3d27c5bba146e
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index bfc4802a..61d7416a 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -119,6 +119,23 @@ (define-public erlang-rebar3-git-vsn
a git checkout.")
(license license:expat)))
+(define-public erlang-rebar3-raw-deps
+ (package
+ (name "erlang-rebar3-raw-deps")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1pzmm3m8gb2s9jn8fp6shzgfmy4mvh2vdci0z6nsm74ma3ffh1i3"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/soranoba/rebar3_raw_deps")
+ (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
+ (description "This plugin provides support for handling non-OTP
+applications as a dependent libraries.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 6320e3d0..147b0451 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -638,23 +638,6 @@ (define-public rebar3
of locations (git, hg, etc).")
(license license:asl2.0)))
-(define-public erlang-rebar3-raw-deps
- (package
- (name "erlang-rebar3-raw-deps")
- (version "2.0.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1pzmm3m8gb2s9jn8fp6shzgfmy4mvh2vdci0z6nsm74ma3ffh1i3"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/soranoba/rebar3_raw_deps")
- (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
- (description "This plugin provides support for handling non-OTP
-applications as a dependent libraries.")
- (license license:expat)))
-
(define-public erlang-rebar3-proper
(package
(name "erlang-rebar3-proper")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 08/32] gnu: erlang-rebar3-proper: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (5 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 07/32] gnu: erlang-rebar3-raw-deps: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 09/32] gnu: erlang-bbmustache: " Pierre-Henry Fröhring
` (24 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ibd9df5c77fae83c3e90c4e2dc77b3cfb5e6a482b
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 61d7416a..426a5f95 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -136,6 +136,23 @@ (define-public erlang-rebar3-raw-deps
applications as a dependent libraries.")
(license license:expat)))
+(define-public erlang-rebar3-proper
+ (package
+ (name "erlang-rebar3-proper")
+ (version "0.12.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1f174fb6h2071wr7qbw9aqqvnglzsjlylmyi8215fhrmi38w94b6"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/ferd/rebar3_proper")
+ (synopsis "Rebar3 PropEr plugin")
+ (description "This plugin allows running PropEr test suites from within
+rebar3.")
+ (license license:bsd-3)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 147b0451..8269cba1 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -638,23 +638,6 @@ (define-public rebar3
of locations (git, hg, etc).")
(license license:asl2.0)))
-(define-public erlang-rebar3-proper
- (package
- (name "erlang-rebar3-proper")
- (version "0.12.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1f174fb6h2071wr7qbw9aqqvnglzsjlylmyi8215fhrmi38w94b6"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/ferd/rebar3_proper")
- (synopsis "Rebar3 PropEr plugin")
- (description "This plugin allows running PropEr test suites from within
-rebar3.")
- (license license:bsd-3)))
-
(define-public erlang-lfe
(package
(name "erlang-lfe")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 09/32] gnu: erlang-bbmustache: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (6 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 08/32] gnu: erlang-rebar3-proper: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 10/32] gnu: erlang-cf: " Pierre-Henry Fröhring
` (23 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ied29a387cbaef59f16613d7425417da4fc8eed0c
---
gnu/packages/erlang-xyz.scm | 32 ++++++++++++++++++++++++++++++++
gnu/packages/erlang.scm | 32 --------------------------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 426a5f95..5a966d2a 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -153,6 +153,38 @@ (define-public erlang-rebar3-proper
rebar3.")
(license license:bsd-3)))
+(define-public erlang-bbmustache
+ (package
+ (name "erlang-bbmustache")
+ (version "1.12.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0fvvaxdpziygxl30j59g98qkh2n47xlb7w5dfpsm2bfcsnj372v8"))))
+ (build-system rebar-build-system)
+ (inputs
+ (list erlang-getopt erlang-rebar3-git-vsn
+ erlang-edown)) ; for building the docs
+ (arguments
+ `(#:tests? #f ;; requires mustache specification file
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'build-more
+ (lambda _
+ (invoke "rebar3" "as" "dev" "escriptize")))
+ (add-after 'install 'install-escript
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (install-file "_build/dev/bin/bbmustache"
+ (string-append out "/bin"))))))))
+ (home-page "https://github.com/soranoba/bbmustache/")
+ (synopsis "Binary pattern match Based Mustache template engine for Erlang")
+ (description "This Erlang library provides a Binary pattern match Based
+Mustache template engine")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 8269cba1..c0cbf5a6 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,38 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-bbmustache
- (package
- (name "erlang-bbmustache")
- (version "1.12.2")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "0fvvaxdpziygxl30j59g98qkh2n47xlb7w5dfpsm2bfcsnj372v8"))))
- (build-system rebar-build-system)
- (inputs
- (list erlang-getopt erlang-rebar3-git-vsn
- erlang-edown)) ; for building the docs
- (arguments
- `(#:tests? #f ;; requires mustache specification file
- #:phases
- (modify-phases %standard-phases
- (add-before 'build 'build-more
- (lambda _
- (invoke "rebar3" "as" "dev" "escriptize")))
- (add-after 'install 'install-escript
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out")))
- (install-file "_build/dev/bin/bbmustache"
- (string-append out "/bin"))))))))
- (home-page "https://github.com/soranoba/bbmustache/")
- (synopsis "Binary pattern match Based Mustache template engine for Erlang")
- (description "This Erlang library provides a Binary pattern match Based
-Mustache template engine")
- (license license:expat)))
-
(define-public erlang-cf
(package
(name "erlang-cf")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 10/32] gnu: erlang-cf: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (7 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 09/32] gnu: erlang-bbmustache: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 11/32] gnu: erlang-yamerl: " Pierre-Henry Fröhring
` (22 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Idcb18977a9409268ae7258d8398772021a651c63
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 5a966d2a..1eb7437e 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -185,6 +185,23 @@ (define-public erlang-bbmustache
Mustache template engine")
(license license:expat)))
+(define-public erlang-cf
+ (package
+ (name "erlang-cf")
+ (version "0.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/project-fifo/cf")
+ (synopsis "Terminal colour helper for Erlang io and io_lib")
+ (description "This package provides a helper library for termial colour
+printing extending the io:format syntax to add colours.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c0cbf5a6..eeb1231e 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,23 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-cf
- (package
- (name "erlang-cf")
- (version "0.3.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/project-fifo/cf")
- (synopsis "Terminal colour helper for Erlang io and io_lib")
- (description "This package provides a helper library for termial colour
-printing extending the io:format syntax to add colours.")
- (license license:expat)))
-
(define-public erlang-yamerl
(package
(name "erlang-yamerl")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 11/32] gnu: erlang-yamerl: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (8 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 10/32] gnu: erlang-cf: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 12/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
` (21 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I1a9712519e8d243f506e60acf19d1607a705269d
---
gnu/packages/erlang-xyz.scm | 22 ++++++++++++++++++++++
gnu/packages/erlang.scm | 22 ----------------------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 1eb7437e..78f829e9 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -202,6 +202,28 @@ (define-public erlang-cf
printing extending the io:format syntax to add colours.")
(license license:expat)))
+(define-public erlang-yamerl
+ (package
+ (name "erlang-yamerl")
+ (version "0.10.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ ;; There are no tests included on Hex.
+ (url "https://github.com/yakaz/yamerl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0if8abgmispcfk7zhd0a5dndzwzbsmqrbyrm5shk375r2dbbwak6"))))
+ (build-system rebar-build-system)
+ (synopsis "YAML and JSON parser in pure Erlang")
+ (description
+ "Erlang application to parse YAML 1.1 and YAML 1.2 documents, as well as
+JSON documents.")
+ (home-page "https://hexdocs.pm/yamerl/")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index eeb1231e..5ed11c28 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,28 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-yamerl
- (package
- (name "erlang-yamerl")
- (version "0.10.0")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- ;; There are no tests included on Hex.
- (url "https://github.com/yakaz/yamerl")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32 "0if8abgmispcfk7zhd0a5dndzwzbsmqrbyrm5shk375r2dbbwak6"))))
- (build-system rebar-build-system)
- (synopsis "YAML and JSON parser in pure Erlang")
- (description
- "Erlang application to parse YAML 1.1 and YAML 1.2 documents, as well as
-JSON documents.")
- (home-page "https://hexdocs.pm/yamerl/")
- (license license:bsd-2)))
-
(define-public erlang-covertool
(package
(name "erlang-covertool")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 12/32] gnu: erlang-covertool: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (9 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 11/32] gnu: erlang-yamerl: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 13/32] gnu: erlang-cth-readable: " Pierre-Henry Fröhring
` (20 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I1212ff469a12e926d4728106c15f12b181819e2c
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
gnu/packages/erlang.scm | 21 ---------------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 78f829e9..ae2193f5 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -224,6 +224,27 @@ (define-public erlang-yamerl
(home-page "https://hexdocs.pm/yamerl/")
(license license:bsd-2)))
+(define-public erlang-covertool
+ (package
+ (name "erlang-covertool")
+ (version "2.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/covertool/covertool")
+ (synopsis "Convert code-coverage data generated by @code{cover} into
+Cobertura XML reports")
+ (description "This package provides a build tool and plugin to convert
+exported Erlang @code{cover} data sets into Cobertura XML reports, which can
+then be feed to the Jenkins Cobertura plug-in.
+
+On @emph{hex.pm}, this plugin was previously called @code{rebar_covertool}.")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 5ed11c28..55a6edb7 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,27 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-covertool
- (package
- (name "erlang-covertool")
- (version "2.0.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/covertool/covertool")
- (synopsis "Convert code-coverage data generated by @code{cover} into
-Cobertura XML reports")
- (description "This package provides a build tool and plugin to convert
-exported Erlang @code{cover} data sets into Cobertura XML reports, which can
-then be feed to the Jenkins Cobertura plug-in.
-
-On @emph{hex.pm}, this plugin was previously called @code{rebar_covertool}.")
- (license license:bsd-2)))
-
(define-public erlang-cth-readable
(package
(name "erlang-cth-readable")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 13/32] gnu: erlang-cth-readable: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (10 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 12/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 14/32] gnu: erlang-erlware-commons: " Pierre-Henry Fröhring
` (19 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I9ce2a8a7250f3176ff149d4fd1c3a9746c95edca
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
gnu/packages/erlang.scm | 21 ---------------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index ae2193f5..86e50656 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -245,6 +245,27 @@ (define-public erlang-covertool
On @emph{hex.pm}, this plugin was previously called @code{rebar_covertool}.")
(license license:bsd-2)))
+(define-public erlang-cth-readable
+ (package
+ (name "erlang-cth-readable")
+ (version "1.5.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "104xgybb6iciy6i28pyyrarqzliddi8kjyq43ajaav7y5si42rb8"))))
+ (build-system rebar-build-system)
+ (propagated-inputs
+ (list erlang-cf))
+ (arguments
+ `(#:tests? #f)) ;; no test-suite in hex-pm package
+ (home-page "https://github.com/ferd/cth_readable")
+ (synopsis "Common Test hooks for more readable logs for Erlang")
+ (description "This package provides an OTP library to be used for CT log
+outputs you want to be readable around all that noise they contain.")
+ (license license:bsd-3)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 55a6edb7..4cc530b7 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,27 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-cth-readable
- (package
- (name "erlang-cth-readable")
- (version "1.5.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "104xgybb6iciy6i28pyyrarqzliddi8kjyq43ajaav7y5si42rb8"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-cf))
- (arguments
- `(#:tests? #f)) ;; no test-suite in hex-pm package
- (home-page "https://github.com/ferd/cth_readable")
- (synopsis "Common Test hooks for more readable logs for Erlang")
- (description "This package provides an OTP library to be used for CT log
-outputs you want to be readable around all that noise they contain.")
- (license license:bsd-3)))
-
(define-public erlang-erlware-commons
(package
(name "erlang-erlware-commons")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 14/32] gnu: erlang-erlware-commons: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (11 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 13/32] gnu: erlang-cth-readable: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 15/32] gnu: erlang-eunit-formatters: " Pierre-Henry Fröhring
` (18 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ic2cfcfbd9d3623464200d26412c9af79b861a970
---
gnu/packages/erlang-xyz.scm | 27 +++++++++++++++++++++++++++
gnu/packages/erlang.scm | 27 ---------------------------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 86e50656..66a2cd94 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -266,6 +266,33 @@ (define-public erlang-cth-readable
outputs you want to be readable around all that noise they contain.")
(license license:bsd-3)))
+(define-public erlang-erlware-commons
+ (package
+ (name "erlang-erlware-commons")
+ (version "1.6.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18qam9xdzi74wppb0cj4zc8161i0i8djr79z8662m6d276f2jz5m"))))
+ (build-system rebar-build-system)
+ (propagated-inputs
+ (list erlang-cf))
+ (native-inputs
+ (list git-minimal/pinned)) ;; Required for tests
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'check-setup
+ (lambda _
+ (setenv "TERM" "xterm")))))) ; enable color in logs
+ (home-page "https://erlware.github.io/erlware_commons/")
+ (synopsis "Additional standard library for Erlang")
+ (description "Erlware Commons is an Erlware project focused on all aspects
+of reusable Erlang components.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 4cc530b7..941674c4 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,33 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-erlware-commons
- (package
- (name "erlang-erlware-commons")
- (version "1.6.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "18qam9xdzi74wppb0cj4zc8161i0i8djr79z8662m6d276f2jz5m"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-cf))
- (native-inputs
- (list git-minimal/pinned)) ;; Required for tests
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-before 'check 'check-setup
- (lambda _
- (setenv "TERM" "xterm")))))) ; enable color in logs
- (home-page "https://erlware.github.io/erlware_commons/")
- (synopsis "Additional standard library for Erlang")
- (description "Erlware Commons is an Erlware project focused on all aspects
-of reusable Erlang components.")
- (license license:expat)))
-
(define-public erlang-eunit-formatters
(package
(name "erlang-eunit-formatters")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 15/32] gnu: erlang-eunit-formatters: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (12 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 14/32] gnu: erlang-erlware-commons: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 16/32] gnu: erlang-proper: " Pierre-Henry Fröhring
` (17 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I10bc54bbf240bc9db3f764408b2a80966cc1221a
---
gnu/packages/erlang-xyz.scm | 16 ++++++++++++++++
gnu/packages/erlang.scm | 16 ----------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 66a2cd94..47434a96 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -293,6 +293,22 @@ (define-public erlang-erlware-commons
of reusable Erlang components.")
(license license:expat)))
+(define-public erlang-eunit-formatters
+ (package
+ (name "erlang-eunit-formatters")
+ (version "0.5.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/seancribbs/eunit_formatters")
+ (synopsis "Better output for eunit suites")
+ (description "This package provides a better output for Erlang eunits.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 941674c4..ffca507e 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,22 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-eunit-formatters
- (package
- (name "erlang-eunit-formatters")
- (version "0.5.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/seancribbs/eunit_formatters")
- (synopsis "Better output for eunit suites")
- (description "This package provides a better output for Erlang eunits.")
- (license license:asl2.0)))
-
(define-public erlang-hex-core
(package
(name "erlang-hex-core")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 16/32] gnu: erlang-proper: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (13 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 15/32] gnu: erlang-eunit-formatters: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 17/32] gnu: erlang-hex-core: " Pierre-Henry Fröhring
` (16 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I8a8e3d16a9b02e53615cf95b336895dc89367ce2
---
gnu/packages/erlang-xyz.scm | 27 +++++++++++++++++++++++++++
gnu/packages/erlang.scm | 27 ---------------------------
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 47434a96..b83bc6c0 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -293,6 +293,33 @@ (define-public erlang-erlware-commons
of reusable Erlang components.")
(license license:expat)))
+(define-public erlang-proper
+ (package
+ (name "erlang-proper")
+ (version "1.4.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1fwcas4a9kz3w3z1jqdk9lw8822srfjk9lcpvbxkxlsv3115ha0q"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'disable-covertool
+ ;; no need to generate a coverage report
+ (lambda _
+ (substitute* "rebar.config"
+ (("\\{plugins, \\[covertool\\]\\}\\." _) "")))))))
+ (home-page "https://proper-testing.github.io/")
+ (synopsis "QuickCheck-inspired property-based testing tool for Erlang")
+ (description "PropEr is a tool for the automated, semi-random,
+property-based testing of Erlang programs. It is fully integrated with
+Erlang's type language, and can also be used for the model-based random
+testing of stateful systems.")
+ (license license:gpl3+)))
+
(define-public erlang-eunit-formatters
(package
(name "erlang-eunit-formatters")
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index ffca507e..8d3b682c 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -305,33 +305,6 @@ (define-public erlang-parse-trans
compile-time constant.")
(license license:asl2.0)))
-(define-public erlang-proper
- (package
- (name "erlang-proper")
- (version "1.4.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1fwcas4a9kz3w3z1jqdk9lw8822srfjk9lcpvbxkxlsv3115ha0q"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'disable-covertool
- ;; no need to generate a coverage report
- (lambda _
- (substitute* "rebar.config"
- (("\\{plugins, \\[covertool\\]\\}\\." _) "")))))))
- (home-page "https://proper-testing.github.io/")
- (synopsis "QuickCheck-inspired property-based testing tool for Erlang")
- (description "PropEr is a tool for the automated, semi-random,
-property-based testing of Erlang programs. It is fully integrated with
-Erlang's type language, and can also be used for the model-based random
-testing of stateful systems.")
- (license license:gpl3+)))
-
(define-public erlang-jsx
(package
(name "erlang-jsx")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 17/32] gnu: erlang-hex-core: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (14 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 16/32] gnu: erlang-proper: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 18/32] gnu: erlang-jsx: " Pierre-Henry Fröhring
` (15 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Id69281bb2ec1847723582a461b0fa87df1c3ace7
---
gnu/packages/erlang-xyz.scm | 26 ++++++++++++++++++++++++++
gnu/packages/erlang.scm | 26 --------------------------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index b83bc6c0..2ce2e3f0 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -336,6 +336,32 @@ (define-public erlang-eunit-formatters
(description "This package provides a better output for Erlang eunits.")
(license license:asl2.0)))
+(define-public erlang-hex-core
+ (package
+ (name "erlang-hex-core")
+ (version "0.8.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "06p65hlm29ky03vs3fq3qz6px2ylwp8b0f2y75wdf5cm0kx2332b"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "rebar3" "as" "test" "proper")))))))
+ (inputs
+ (list erlang-proper erlang-rebar3-proper))
+ (home-page "https://github.com/hexpm/hex_core")
+ (synopsis "Reference implementation of Hex specifications")
+ (description "This package provides the reference implementation of Hex
+specifications.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 8d3b682c..c509282d 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,32 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-hex-core
- (package
- (name "erlang-hex-core")
- (version "0.8.4")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "06p65hlm29ky03vs3fq3qz6px2ylwp8b0f2y75wdf5cm0kx2332b"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (invoke "rebar3" "as" "test" "proper")))))))
- (inputs
- (list erlang-proper erlang-rebar3-proper))
- (home-page "https://github.com/hexpm/hex_core")
- (synopsis "Reference implementation of Hex specifications")
- (description "This package provides the reference implementation of Hex
-specifications.")
- (license license:asl2.0)))
-
(define-public erlang-jsone
(package
(name "erlang-jsone")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 18/32] gnu: erlang-jsx: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (15 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 17/32] gnu: erlang-hex-core: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 19/32] gnu: erlang-relx: " Pierre-Henry Fröhring
` (14 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I5d71483d9e00b81f61d3339bbe1195865c05171f
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
gnu/packages/erlang.scm | 17 -----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 2ce2e3f0..1d7984fb 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -362,6 +362,23 @@ (define-public erlang-hex-core
specifications.")
(license license:asl2.0)))
+(define-public erlang-jsx
+ (package
+ (name "erlang-jsx")
+ (version "3.1.0")
+ (source (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32
+ "1wr7jkxm6nlgvd52xhniav64xr9rml2ngb35rwjwqlqvq7ywhp0c"))))
+ (build-system rebar-build-system)
+ (synopsis "Streaming, evented JSON parsing toolkit")
+ (description
+ "An Erlang application for consuming, producing and manipulating json.")
+ (home-page "https://github.com/talentdeficit/jsx")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c509282d..eeaf7cf0 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -279,23 +279,6 @@ (define-public erlang-parse-trans
compile-time constant.")
(license license:asl2.0)))
-(define-public erlang-jsx
- (package
- (name "erlang-jsx")
- (version "3.1.0")
- (source (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32
- "1wr7jkxm6nlgvd52xhniav64xr9rml2ngb35rwjwqlqvq7ywhp0c"))))
- (build-system rebar-build-system)
- (synopsis "Streaming, evented JSON parsing toolkit")
- (description
- "An Erlang application for consuming, producing and manipulating json.")
- (home-page "https://github.com/talentdeficit/jsx")
- (license license:expat)))
-
(define-public erlang-providers
(package
(name "erlang-providers")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 19/32] gnu: erlang-relx: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (16 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 18/32] gnu: erlang-jsx: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 20/32] gnu: erlang-providers: " Pierre-Henry Fröhring
` (13 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ibeaa35080cf5ef271ce79faa4f1eddc5451acb14
---
gnu/packages/erlang-xyz.scm | 22 ++++++++++++++++++++++
gnu/packages/erlang.scm | 22 ----------------------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 1d7984fb..ad56b9d2 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -379,6 +379,28 @@ (define-public erlang-jsx
(home-page "https://github.com/talentdeficit/jsx")
(license license:expat)))
+(define-public erlang-relx
+ (package
+ (name "erlang-relx")
+ (version "4.6.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02gmfx1vxg9m3mq4njsqhs4972l4nb8m5p1pdcf64g09ccf17y1g"))))
+ (build-system rebar-build-system)
+ (propagated-inputs
+ (list erlang-bbmustache))
+ (home-page "https://erlware.github.io/relx/")
+ (synopsis "Release assembler for Erlang/OTP Releases")
+ (description "Relx assembles releases for an Erlang/OTP release. Given a
+release specification and a list of directories in which to search for OTP
+applications it will generate a release output. That output depends heavily on
+what plugins available and what options are defined, but usually it is simply
+a well configured release directory.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index eeaf7cf0..c4e81aa2 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -297,28 +297,6 @@ (define-public erlang-providers
(description "This package provides an Erlang providers library.")
(license license:asl2.0)))
-(define-public erlang-relx
- (package
- (name "erlang-relx")
- (version "4.6.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "02gmfx1vxg9m3mq4njsqhs4972l4nb8m5p1pdcf64g09ccf17y1g"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-bbmustache))
- (home-page "https://erlware.github.io/relx/")
- (synopsis "Release assembler for Erlang/OTP Releases")
- (description "Relx assembles releases for an Erlang/OTP release. Given a
-release specification and a list of directories in which to search for OTP
-applications it will generate a release output. That output depends heavily on
-what plugins available and what options are defined, but usually it is simply
-a well configured release directory.")
- (license license:asl2.0)))
-
(define-public erlang-ssl-verify-fun
(package
(name "erlang-ssl-verify-fun")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 20/32] gnu: erlang-providers: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (17 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 19/32] gnu: erlang-relx: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 21/32] gnu: erlang-jsone: " Pierre-Henry Fröhring
` (12 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ic418ef50076311c8f6f49b563710d404d5e39154
---
gnu/packages/erlang-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
gnu/packages/erlang.scm | 35 -----------------------------------
2 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index ad56b9d2..65495d68 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -401,6 +401,41 @@ (define-public erlang-relx
a well configured release directory.")
(license license:asl2.0)))
+(define-public erlang-ssl-verify-fun
+ (package
+ (name "erlang-ssl-verify-fun")
+ (version "1.1.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/deadtrickster/ssl_verify_fun.erl")
+ (synopsis "SSL verification functions for Erlang")
+ (description "This package provides SSL verification functions for
+Erlang.")
+ (license license:expat)))
+
+(define-public erlang-providers
+ (package
+ (name "erlang-providers")
+ (version "1.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "05y0kz3xgx77hzn1l05byaisvmk8bgds7c22hrh0a5ba81sfi1yj"))))
+ (build-system rebar-build-system)
+ (propagated-inputs
+ (list erlang-erlware-commons erlang-getopt))
+ (home-page "https://github.com/tsloughter/providers")
+ (synopsis "Erlang providers library")
+ (description "This package provides an Erlang providers library.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c4e81aa2..c5426381 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -279,41 +279,6 @@ (define-public erlang-parse-trans
compile-time constant.")
(license license:asl2.0)))
-(define-public erlang-providers
- (package
- (name "erlang-providers")
- (version "1.9.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "05y0kz3xgx77hzn1l05byaisvmk8bgds7c22hrh0a5ba81sfi1yj"))))
- (build-system rebar-build-system)
- (propagated-inputs
- (list erlang-erlware-commons erlang-getopt))
- (home-page "https://github.com/tsloughter/providers")
- (synopsis "Erlang providers library")
- (description "This package provides an Erlang providers library.")
- (license license:asl2.0)))
-
-(define-public erlang-ssl-verify-fun
- (package
- (name "erlang-ssl-verify-fun")
- (version "1.1.6")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
- (build-system rebar-build-system)
- (home-page "https://github.com/deadtrickster/ssl_verify_fun.erl")
- (synopsis "SSL verification functions for Erlang")
- (description "This package provides SSL verification functions for
-Erlang.")
- (license license:expat)))
-
(define-public rebar3
(package
(name "rebar3")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 21/32] gnu: erlang-jsone: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (18 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 20/32] gnu: erlang-providers: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 22/32] gnu: erlang-parse-trans: " Pierre-Henry Fröhring
` (11 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I1828e8c85296212540fe5562c1663c18f7585d11
---
gnu/packages/erlang-xyz.scm | 24 ++++++++++++++++++++++++
gnu/packages/erlang.scm | 24 ------------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 65495d68..ed66aaee 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -436,6 +436,30 @@ (define-public erlang-providers
(description "This package provides an Erlang providers library.")
(license license:asl2.0)))
+(define-public erlang-jsone
+ (package
+ (name "erlang-jsone")
+ (version "1.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1gaxiw76syjp3s9rygskm32y9799b917q752rw8bxj3bxq93g8x3"))))
+ (build-system rebar-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'disable-covertool
+ ;; no need to generate a coverage report
+ (lambda _
+ (substitute* "rebar.config"
+ (("\\{project_plugins, \\[covertool\\]\\}\\." _) "")))))))
+ (home-page "https://github.com/sile/jsone/")
+ (synopsis "Erlang JSON Library")
+ (description "An Erlang library for encoding and decoding JSON data.")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c5426381..b9815901 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,30 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-jsone
- (package
- (name "erlang-jsone")
- (version "1.7.0")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "1gaxiw76syjp3s9rygskm32y9799b917q752rw8bxj3bxq93g8x3"))))
- (build-system rebar-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'disable-covertool
- ;; no need to generate a coverage report
- (lambda _
- (substitute* "rebar.config"
- (("\\{project_plugins, \\[covertool\\]\\}\\." _) "")))))))
- (home-page "https://github.com/sile/jsone/")
- (synopsis "Erlang JSON Library")
- (description "An Erlang library for encoding and decoding JSON data.")
- (license license:expat)))
-
(define-public erlang-parse-trans
(package
(name "erlang-parse-trans")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 22/32] gnu: erlang-parse-trans: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (19 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 21/32] gnu: erlang-jsone: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 23/32] gnu: erlang-unicode-util-compat: " Pierre-Henry Fröhring
` (10 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I11422aca794584d34ee84ddcf77217245a7ce2b0
---
gnu/packages/erlang-xyz.scm | 23 +++++++++++++++++++++++
gnu/packages/erlang.scm | 23 -----------------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index ed66aaee..6947c9c2 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -460,6 +460,29 @@ (define-public erlang-jsone
(description "An Erlang library for encoding and decoding JSON data.")
(license license:expat)))
+(define-public erlang-parse-trans
+ (package
+ (name "erlang-parse-trans")
+ (version "3.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "16p4c2xjrvz16kzpr9pmcvi6nxq6rwckqi9fp0ksibaxwxn402k2"))))
+ (build-system rebar-build-system)
+ (inputs
+ (list erlang-getopt))
+ (home-page "https://github.com/uwiger/parse_trans")
+ (synopsis "Parse transform utilities for Erlang")
+ (description "This package captures some useful patterns in parse
+transformation and code generation for Erlang.
+
+For example generating standardized accessor functions for records or
+evaluating an expression at compile-time and substitute the result as a
+compile-time constant.")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index b9815901..d3844933 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -232,29 +232,6 @@ (define-public emacs-erlang
files.")
(license license:asl2.0)))
-(define-public erlang-parse-trans
- (package
- (name "erlang-parse-trans")
- (version "3.4.1")
- (source
- (origin
- (method url-fetch)
- (uri (hexpm-uri name version))
- (sha256
- (base32 "16p4c2xjrvz16kzpr9pmcvi6nxq6rwckqi9fp0ksibaxwxn402k2"))))
- (build-system rebar-build-system)
- (inputs
- (list erlang-getopt))
- (home-page "https://github.com/uwiger/parse_trans")
- (synopsis "Parse transform utilities for Erlang")
- (description "This package captures some useful patterns in parse
-transformation and code generation for Erlang.
-
-For example generating standardized accessor functions for records or
-evaluating an expression at compile-time and substitute the result as a
-compile-time constant.")
- (license license:asl2.0)))
-
(define-public rebar3
(package
(name "rebar3")
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 23/32] gnu: erlang-unicode-util-compat: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (20 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 22/32] gnu: erlang-parse-trans: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 24/32] gnu: erlang-idna: " Pierre-Henry Fröhring
` (9 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I8a946fc973f97608109a5e03809c343a1e18e97d
---
gnu/packages/erlang-xyz.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 6947c9c2..f0c8521c 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -483,6 +483,22 @@ (define-public erlang-parse-trans
compile-time constant.")
(license license:asl2.0)))
+(define-public erlang-unicode-util-compat
+ (package
+ (name "erlang-unicode-util-compat")
+ (version "0.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "08952lw8cjdw8w171lv8wqbrxc4rcmb3jhkrdb7n06gngpbfdvi5"))))
+ (build-system rebar-build-system)
+ (synopsis "Unicode compatibility library for Erlang < 20")
+ (description "Unicode compatibility library for Erlang < 20.")
+ (home-page "https://hex.pm/packages/unicode_util_compat")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 24/32] gnu: erlang-idna: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (21 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 23/32] gnu: erlang-unicode-util-compat: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 25/32] gnu: erlang-bear: " Pierre-Henry Fröhring
` (8 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ifb67d5364658ee59bb8286c3f454ce4f95d0db2b
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index f0c8521c..67be758c 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -499,6 +499,27 @@ (define-public erlang-unicode-util-compat
(home-page "https://hex.pm/packages/unicode_util_compat")
(license license:asl2.0)))
+(define-public erlang-idna
+ (package
+ (name "erlang-idna")
+ (version "6.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1sjcjibl34sprpf1dgdmzfww24xlyy34lpj7mhcys4j4i6vnwdwj"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-unicode-util-compat))
+ (synopsis
+ "Erlang Internationalized Domain Names in Applications (IDNA) protocol")
+ (description
+ "Library to register and look up IDNs in a way
+ that does not require changes to the DNS itself. IDNA is only meant for
+processing domain names, not free text. See: RFC 5891.")
+ (home-page "https://hexdocs.pm/idna/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 25/32] gnu: erlang-bear: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (22 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 24/32] gnu: erlang-idna: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 26/32] gnu: erlang-erlang-color: " Pierre-Henry Fröhring
` (7 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ia04e1bf291f8ca680c0d8c5c54b3c820f263e1cc
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 67be758c..ff6254ac 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -520,6 +520,23 @@ (define-public erlang-idna
(home-page "https://hexdocs.pm/idna/")
(license license:expat)))
+(define-public erlang-bear
+ (package
+ (name "erlang-bear")
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1nsri73b50n5v1a8252mm8car84j2b53bq7alq6zz16z3a86fyqm"))))
+ (build-system rebar-build-system)
+ (synopsis "Statistics functions for Erlang")
+ (description
+ "This package provides a set of statistics functions for erlang.")
+ (home-page "https://hex.pm/packages/bear")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 26/32] gnu: erlang-erlang-color: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (23 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 25/32] gnu: erlang-bear: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 27/32] gnu: erlang-tdiff: " Pierre-Henry Fröhring
` (6 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I914c87d513dbbbe222f852144a706759023044bf
---
gnu/packages/erlang-xyz.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index ff6254ac..52a30530 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -537,6 +537,22 @@ (define-public erlang-bear
(home-page "https://hex.pm/packages/bear")
(license license:asl2.0)))
+(define-public erlang-erlang-color
+ (package
+ (name "erlang-erlang-color")
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0f707vxihn3f9m3zxal38ajcihnfcwms77jcax0gbzn8i7jya5vb"))))
+ (build-system rebar-build-system)
+ (synopsis "ANSI colors for your Erlang")
+ (description "ANSI colors for your Erlang.")
+ (home-page "https://hex.pm/packages/erlang_color")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 27/32] gnu: erlang-tdiff: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (24 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 26/32] gnu: erlang-erlang-color: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 28/32] gnu: erlang-rebar3-ex-doc: " Pierre-Henry Fröhring
` (5 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ia1214c866f62330a847444254ff47af01a59e760
---
gnu/packages/erlang-xyz.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 52a30530..c16ad5aa 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -553,6 +553,23 @@ (define-public erlang-erlang-color
(home-page "https://hex.pm/packages/erlang_color")
(license license:expat)))
+(define-public erlang-tdiff
+ (package
+ (name "erlang-tdiff")
+ (version "0.1.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0xbq7p9ii2kp49ms1kylj92ih2jiwvqwimb8jy4aalljz5lf3hp0"))))
+ (build-system rebar-build-system)
+ (synopsis "Library to compute the difference between two strings")
+ (description
+ "Erlang implementation of the O(ND) differnence algorithm by EUGENE W. MYERS.")
+ (home-page "https://hex.pm/packages/tdiff")
+ (license license:lgpl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 28/32] gnu: erlang-rebar3-ex-doc: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (25 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 27/32] gnu: erlang-tdiff: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 29/32] gnu: erlang-samovar: " Pierre-Henry Fröhring
` (4 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I51d485dba18c317bf9b51cfad02809c4e991dedc
---
gnu/packages/erlang-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index c16ad5aa..11b765b7 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -570,6 +570,25 @@ (define-public erlang-tdiff
(home-page "https://hex.pm/packages/tdiff")
(license license:lgpl2.0)))
+(define-public erlang-rebar3-ex-doc
+ (package
+ (name "erlang-rebar3-ex-doc")
+ (version "0.2.21")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0c720shjf03y4slj56q5nxgyhqif0926cs3pvl3zbv1i64qh8wdm"))))
+ (build-system rebar-build-system)
+ (synopsis "rebar3 plugin for generating docs with ex_doc")
+ (description
+ "rebar3_ex_doc is a rebar3 plugin for creating documentation with ex_doc. It
+includes ex_doc as an escript, eliminating the need for Elixir installation or
+compiling ex_doc dependencies.")
+ (home-page "https://hexdocs.pm/rebar3_ex_doc/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 29/32] gnu: erlang-samovar: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (26 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 28/32] gnu: erlang-rebar3-ex-doc: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 30/32] gnu: erlang-geas: " Pierre-Henry Fröhring
` (3 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ia1d6efa1eff8faa6e5e4ea181bde37fe630280b7
---
gnu/packages/erlang-xyz.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 11b765b7..bd4f78fe 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -589,6 +589,22 @@ (define-public erlang-rebar3-ex-doc
(home-page "https://hexdocs.pm/rebar3_ex_doc/")
(license license:asl2.0)))
+(define-public erlang-samovar
+ (package
+ (name "erlang-samovar")
+ (version "1.0.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1nfw5vbzcvqzpsahwxz7zjlshg31pa9f306g3hzm1kfx5rsyvry4"))))
+ (build-system rebar-build-system)
+ (synopsis "SEMVER library for Erlang")
+ (description "SEMVER library for Erlang")
+ (home-page "https://hexdocs.pm/samovar/")
+ (license license:isc)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 30/32] gnu: erlang-geas: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (27 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 29/32] gnu: erlang-samovar: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 31/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
` (2 subsequent siblings)
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: If9d92d8da4b50d0832fb51a8e331b5a30394e81f
---
gnu/packages/erlang-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index bd4f78fe..6642aeea 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -605,6 +605,28 @@ (define-public erlang-samovar
(home-page "https://hexdocs.pm/samovar/")
(license license:isc)))
+(define-public erlang-geas
+ (package
+ (name "erlang-geas")
+ (version "2.7.14")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1maxv5zg2ckrikr8xpxgg9kpfaxvahqilbkl9dl9ibchlgrbj6i4"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-samovar))
+ (synopsis
+ "Tool to detect the runnable official Erlang release window for your project")
+ (description
+ "Geas will tell you also what are the offending functions in the beam/source
+files that reduce the available window, if some beam files are compiled native
+and the installed patches and recommend patches that should be installed
+depending your code.")
+ (home-page "https://hexdocs.pm/geas/")
+ (license license:isc)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 31/32] gnu: erlang-covertool: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (28 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 30/32] gnu: erlang-geas: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 32/32] gnu: erlang-telemetry: " Pierre-Henry Fröhring
2023-10-29 18:29 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Liliana Marie Prikler
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ibbac6334f247f86f56386fc53ef176875a13cb2a
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 6642aeea..366c5f2c 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -627,6 +627,27 @@ (define-public erlang-geas
(home-page "https://hexdocs.pm/geas/")
(license license:isc)))
+(define-public erlang-covertool
+ (package
+ (name "erlang-covertool")
+ (version "2.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0c1n3nl4063xwi1sv176l1x68xqf07qwvj444a5z888fx6i5aw"))))
+ (build-system rebar-build-system)
+ (home-page "https://github.com/covertool/covertool")
+ (synopsis "Convert code-coverage data generated by @code{cover} into
+Cobertura XML reports")
+ (description
+ "This package provides a build tool and plugin to convert
+exported Erlang @code{cover} data sets into Cobertura XML reports, which can
+then be feed to the Jenkins Cobertura plug-in. On @emph{hex.pm}, this plugin
+was previously called @code{rebar_covertool}.")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 32/32] gnu: erlang-telemetry: moved to erlang-xyz.scm
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (29 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 31/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
@ 2023-10-29 14:37 ` Pierre-Henry Fröhring
2023-10-29 18:29 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Liliana Marie Prikler
31 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 14:37 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I54cfe6fb244c26c6a226d76ee62a502a72e198a7
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 366c5f2c..b43b4403 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -648,6 +648,27 @@ (define-public erlang-covertool
was previously called @code{rebar_covertool}.")
(license license:bsd-2)))
+(define-public erlang-telemetry
+ (package
+ (name "erlang-telemetry")
+ (version "1.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1mgyx9zw92g6w8fp9pblm3b0bghwxwwcbslrixq23ipzisfwxnfs"))))
+ (build-system rebar-build-system)
+ (native-inputs (list erlang-covertool))
+ (synopsis "Dynamic dispatching library for metrics and instrumentations")
+ (description
+ "Telemetry is a lightweight library for dynamic dispatching of events, with a
+focus on metrics and instrumentation. Any Erlang or Elixir library can use
+telemetry to emit events. Application code and other libraries can then hook
+into those events and run custom handlers.")
+ (home-page "https://hexdocs.pm/telemetry/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
` (30 preceding siblings ...)
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 32/32] gnu: erlang-telemetry: " Pierre-Henry Fröhring
@ 2023-10-29 18:29 ` Liliana Marie Prikler
2023-10-29 22:14 ` Pierre-Henry Fröhring
31 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-10-29 18:29 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Sonntag, dem 29.10.2023 um 15:36 +0100 schrieb Pierre-Henry
Fröhring:
> [PATCH va3e5ae0f..37252e07 01/32]
The middle should indicate a revision number and an optional branch (as
well as optional WIP and RFC). Since this goes to master (I assume),
it should just be v2, v3, … vN
> The builder now accepts the `#:sources-erlang` parameter, which
> expects a list of "Source" items. Each "Source" corresponds to the
> source code of a library directory, which is where Erlang looks for
> compiled modules.
> Documentation:
> https://www.erlang.org/doc/man/code#code-path. Each Source is
> installed as a "Checkout", which are local dependencies linked to
> directories managed by rebar. For more information, see
> https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies
> . Lacking checkouts, rebar3 will not compile if there is no network
> access.
>
> Change-Id: Idc3aa8bb204f55d0594c1669399845cd9b9e86ab
> ---
> guix/build-system/rebar.scm | 274 +++++++++++++++++++---------
> --
> guix/build/rebar-build-system.scm | 255 +++++++++++++++++----------
> 2 files changed, 339 insertions(+), 190 deletions(-)
>
> diff --git a/guix/build-system/rebar.scm b/guix/build-
> system/rebar.scm
> index de1294ec..862721ee 100644
> --- a/guix/build-system/rebar.scm
> +++ b/guix/build-system/rebar.scm
> @@ -1,6 +1,7 @@
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
> ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -18,102 +19,117 @@
> ;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
>
> (define-module (guix build-system rebar)
> - #:use-module (guix store)
> - #:use-module (guix utils)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> #:use-module (guix gexp)
> - #:use-module (guix packages)
> #:use-module (guix monads)
> + #:use-module (guix packages)
> #:use-module (guix search-paths)
> - #:use-module (guix build-system)
> - #:use-module (guix build-system gnu)
> - #:export (hexpm-uri
> - hexpm-package-url
> - %rebar-build-system-modules
> - rebar-build
> - rebar-build-system))
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 regex)
> + #:use-module (srfi srfi-1)
> + #:export (hexpm-uri hexpm-package-url %rebar-build-system-modules
> + rebar-build rebar-build-system))
>
> -;;;
> -;;; Definitions for the hex.pm repository,
> -;;;
> +;; Source
> +;; A « Source » reprensents the source code to a library
> directory. It is
> +;; defined as (list <name> <origin>) where: <name> is a string
> representing
> +;; the name of a library directory and <origin> is an origin as
> defined
> +;; (guix packages).
> +
> +
> +;; Pattern that an Erlang Guix package name is expected to match.
> +(define pkg-name-re "^erlang-(.*)")
Emacs, Rust, etc. build systems just strip out the prefix. No need to
go all fancy regexpy :)
> +(define (pkg-name->match name)
> + "Return the match object from NAME if NAME starts with pkg-name-
> prefix."
> + (string-match pkg-name-re name))
> +
> +(define (pkg-name? name)
> + "Test if NAME is the name of an Erlang Guix package."
> + (or (pkg-name->match name) #f))
>
> -;; URL and paths from
> -;; https://github.com/hexpm/specifications/blob/master/endpoints.md
> -(define %hexpm-repo-url
> - (make-parameter "https://repo.hex.pm"))
> +(define (pkg-name->suffix name)
> + "Return the suffix of the name of an Erlang Guix package."
> + (regexp-substitute #f (pkg-name->match name) 1))
>
> -(define hexpm-package-url
> - (string-append (%hexpm-repo-url) "/tarballs/"))
> +(define* (pkg-name->library-directory-name name #:key (version ""))
> + "Return the name of the library directory associated with the
> Erlang Guix package name NAME."
> + (string-append (string-replace-substring (pkg-name->suffix name)
> "-" "_")
> + (if (string= version "") "" (string-append "-"
> version))))
> +
> +;; See:
> https://github.com/hexpm/specifications/blob/master/endpoints.md
> +(define hexpm (make-parameter "https://repo.hex.pm"))
> +
> +(define hexpm-tarballs (string-append (hexpm) "/tarballs/"))
>
> (define (hexpm-uri name version)
> "Return a URI string for the package hosted at hex.pm
> corresponding to NAME
> -and VERSION."
> - (string-append hexpm-package-url name "-" version ".tar"))
> +and VERSION.
>
> -;;
> -;; Standard build procedure for Erlang packages using Rebar.
> -;;
> +XXX: should a warning be emitted?
> +If NAME is not an Erlang Guix package name, then emit a warning. The
> download
> +will fail if it is not correct anyway."
>
> -(define %rebar-build-system-modules
> - ;; Build-side modules imported by default.
> - `((guix build rebar-build-system)
> - ,@%gnu-build-system-modules))
> + (define (warn-about name)
> + (format #t "AssertionWarning 4dcbff27
> + Assertion: re matches name.
> + re = ~a
> + name = ~a
> +" pkg-name-re name)
> +
> + name)
何で?
>
> -(define (default-rebar3)
> - "Return the default Rebar3 package."
> + (define (name->archive-name name)
> + (if (pkg-name? name)
> + (string-append (pkg-name->library-directory-name name
> #:version version) ".tar")
> + (string-append (warn-about name) "-" version ".tar")))
> +
> + (string-append hexpm-tarballs (name->archive-name name)))
> +
> +(define (rebar-default)
> ;; Lazily resolve the binding to avoid a circular dependency.
> (let ((erlang-mod (resolve-interface '(gnu packages erlang))))
> (module-ref erlang-mod 'rebar3)))
I suggest not to rename these procedures. default-X reads more
naturally than X-default.
> -(define (default-erlang)
> - "Return the default Erlang package."
> +(define (erlang-default)
> ;; Lazily resolve the binding to avoid a circular dependency.
> (let ((erlang-mod (resolve-interface '(gnu packages erlang))))
> (module-ref erlang-mod 'erlang)))
>
> -(define* (lower name
> - #:key source inputs native-inputs outputs system
> target
> - (rebar (default-rebar3))
> - (erlang (default-erlang))
> - #:allow-other-keys
> - #:rest arguments)
> - "Return a bag for NAME from the given arguments."
> - (define private-keywords
> - '(#:target #:rebar #:erlang #:inputs #:native-inputs))
> -
> - (and (not target) ;XXX: no cross-
> compilation
> - (bag
> - (name name)
> - (system system)
> - (host-inputs `(,@(if source
> - `(("source" ,source))
> - '())
> - ,@inputs))
> - (build-inputs `(("rebar" ,rebar)
> - ("erlang" ,erlang) ;; for escriptize
> - ,@native-inputs
> - ;; Keep the standard inputs of 'gnu-build-
> system'.
> - ,@(standard-packages)))
> - (outputs outputs)
> - (build rebar-build)
> - (arguments (strip-keyword-arguments private-keywords
> arguments)))))
> -
> -(define* (rebar-build name inputs
> - #:key
> - guile source
> - (rebar-flags ''("skip_deps=true" "-vv"))
> - (tests? #t)
> - (test-target "eunit")
> - ;; TODO: install-name ; default: based on
> guix package name
> - (install-profile "default")
> - (phases '(@ (guix build rebar-build-system)
> - %standard-phases))
> - (outputs '("out"))
> - (search-paths '())
> - (native-search-paths '())
> - (system (%current-system))
> - (imported-modules %rebar-build-system-
> modules)
> - (modules '((guix build rebar-build-system)
> - (guix build utils))))
> +(define imported-modules
> + `((guix build rebar-build-system)
> + ,@%gnu-build-system-modules))
> +
> +(define (input->source input)
> + "Return a Source associated to the Input INPUT."
> + (match input
> + ((name package)
> + (list (pkg-name->library-directory-name name)
> + (package-source package)))))
> +
> +(define* (rebar-build name
> + inputs
> + #:key
> + guile
> + source
> + (rebar-flags ''())
> + (tests? #t)
> + (test-target "eunit")
> + ;; TODO: install-name ; default: based on
> guix package name
> + (install-profile "default")
> + (phases '(@ (guix build rebar-build-system)
> + %standard-phases))
> + (outputs '("out"))
> + (search-paths '())
> + (native-search-paths '())
> + (system (%current-system))
> + (imported-modules imported-modules)
> + (modules '((guix build rebar-build-system)
> + (guix build utils)))
> + (sources-erlang '()))
> "Build SOURCE with INPUTS."
>
> (define builder
> @@ -122,35 +138,95 @@ (define* (rebar-build name inputs
> (use-modules #$@(sexp->gexp modules))
>
> #$(with-build-variables inputs outputs
> +
> #~(rebar-build #:source #+source
> - #:system #$system
> - #:name #$name
> - #:rebar-flags #$rebar-flags
> - #:tests? #$tests?
> - #:test-target #$test-target
> - ;; TODO: #:install-name #$install-name
> - #:install-profile #$install-profile
> - #:phases #$(if (pair? phases)
> - (sexp->gexp phases)
> - phases)
> - #:outputs %outputs
> - #:search-paths '#$(sexp->gexp
> - (map search-path-
> specification->sexp
> - search-paths))
> - #:inputs %build-inputs)))))
> -
> - (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> - system #:graft?
> #f)))
> + #:sources-erlang '#$sources-erlang
This reeks of the hack that we need for cargo-build-system, except with
a worse variable name. I strongly suggest looking into ways we can do
without it.
> + #:system #$system
> + #:name #$name
> + #:rebar-flags #$rebar-flags
> + #:tests? #$tests?
> + #:test-target #$test-target
> + ;; TODO: #:install-name #$install-name
> + #:install-profile #$install-profile
> + #:phases #$(if (pair?
> + phases)
> + (sexp->gexp
> + phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map
> + search-path-
> specification->sexp
> + search-paths))
> + #:inputs
> + %build-inputs)))))
> +
> + (mlet %store-monad
> + ((guile (package->derivation (or guile
> + (default-guile)) system
> + #:graft? #f)))
> +
> ;; Note: Always pass #:graft? #f. Without it, ALLOWED-
> REFERENCES &
> ;; co. would be interpreted as referring to grafted packages.
> - (gexp->derivation name builder
> + (gexp->derivation name
> + builder
> #:system system
> #:target #f
> #:graft? #f
> #:guile-for-build guile)))
>
> +(define* (lower name
> + #:key
> + (erlang (erlang-default))
> + inputs
> + native-inputs
> + outputs
> + (rebar (rebar-default))
> + source
> + system
> + target
> + #:allow-other-keys #:rest arguments)
> + "Return a bag for NAME from the given arguments."
> +
> + (let* ((erlang-packages
> + (filter (lambda (input)
> + (match input
> + ((name _) (pkg-name? name))))
> + (append inputs native-inputs)))
> +
> + (erlang-sources (map input->source erlang-packages)))
> +
> + (define private-keywords
> + '(#:target #:rebar #:erlang #:inputs #:native-inputs
> #:sources-erlang))
> +
> + (and (not target) ;XXX: no cross-compilation
> + (bag (name name)
> + (system system)
> + (host-inputs inputs)
> + (build-inputs `(,@(standard-packages)
> + ("erlang" ,erlang)
> + ("rebar" ,rebar)
> + ,@inputs
> + ,@native-inputs))
> + (outputs outputs)
> + (build rebar-build)
> + (arguments (append (list #:sources-erlang erlang-
> sources)
> + (strip-keyword-arguments private-
> keywords
> +
> arguments)))))))
> +
> (define rebar-build-system
> - (build-system
> - (name 'rebar)
> - (description "The standard Rebar build system")
> - (lower lower)))
> + (build-system (name 'rebar)
> + (description "The standard Rebar build system")
> + (lower lower)))
> +
> +
> +;;;
> +;;; Exports
> +;;;
> +
> +(define hexpm-package-url hexpm-tarballs)
> +
> +(define %rebar-build-system-modules imported-modules)
> +
> +
> +;;; rebar.scm ends here
> diff --git a/guix/build/rebar-build-system.scm b/guix/build/rebar-
> build-system.scm
> index fb664228..b68348bd 100644
> --- a/guix/build/rebar-build-system.scm
> +++ b/guix/build/rebar-build-system.scm
> @@ -2,6 +2,7 @@
> ;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
> ;;; Copyright © 2019 Björn Höfling
> <bjoern.hoefling@bjoernhoefling.de>
> ;;; Copyright © 2020, 2022 Hartmut Goebel
> <h.goebel@crazy-compilers.com>
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -23,125 +24,197 @@ (define-module (guix build rebar-build-system)
> #:use-module ((guix build utils) #:hide (delete))
> #:use-module (ice-9 match)
> #:use-module (ice-9 ftw)
> + #:use-module (ice-9 string-fun)
> + #:use-module (ice-9 receive)
> + #:use-module (ice-9 regex)
> #:use-module (srfi srfi-1)
> #:use-module (srfi srfi-26)
> - #:export (rebar-build
> - %standard-phases))
> + #:export (rebar-build %standard-phases))
>
> ;;
> ;; Builder-side code of the standard build procedure for Erlang
> packages using
> ;; rebar3.
> ;;
> -;; TODO: Think about whether bindir ("ebin"), libdir ("priv") and
> includedir
> -;; "(include") need to be configurable
> +;; Library directory
> +;; A « library directory » is a directory where Erlang searches
> for compiled
> +;; code. Its name should look like: `a_name-1.2.3' where the
> suffix `-1.2.3'
> +;; is optional. See:
> https://www.erlang.org/doc/man/code#code-path.
> +;;
> +;; Package name
> +;; A « package name » is the value of the name field of a package
> +;; definition. It looks like: `prefix-a-name-1.2.3'. See:
> +;; https://guix.gnu.org/manual/en/html_node/Package-Naming.html
> +;;
> +;; Profile
> +;; For Rebar3, a « profile » is a name associated to a set of
> configuration
> +;; settings overriding or complementing the regular configuration.
> See:
> +;; https://rebar3.org/docs/configuration/profiles
> +;;
> +;; Source
> +;; A « source » represents the source code associated to a Guix
> package as
> +;; defined by its `source' field. Here, the data sctructure used
> to
> +;; represent a source has the form `(list name path)' where `name'
> is a
> +;; library directory name and `path' is the store path where to
> find the
> +;; source code.
> +;;
> +;; Checkout
> +;; A « checkout » is a locally defined dependency related to a
> directory
> +;; managed by rebar. See:
> +;;
> https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies
>
> -(define %erlang-libdir "/lib/erlang/lib")
> +(define sep "/")
Uhm, did you mean file-name-separator-string from Guile core?
> -(define* (erlang-depends #:key inputs #:allow-other-keys)
> - (define input-directories
> - (match inputs
> - (((_ . dir) ...)
> - dir)))
> - (mkdir-p "_checkouts")
> -
> - (for-each
> - (lambda (input-dir)
> - (let ((elibdir (string-append input-dir %erlang-libdir)))
> - (when (directory-exists? elibdir)
> - (for-each
> - (lambda (dirname)
> - (let ((dest (string-append elibdir "/" dirname))
> - (link (string-append "_checkouts/" dirname)))
> - (when (not (file-exists? link))
> - ;; RETHINK: Maybe better copy and make writable to
> avoid some
> - ;; error messages e.g. when using with rebar3-git-
> vsn.
> - (symlink dest link))))
> - (list-directories elibdir)))))
> - input-directories))
> +;; Where Erlang libraries are installed relative to a package path
> in the store.
> +(define lib-erlang-lib "lib/erlang/lib")
> +
> +(define (list-directories directory)
> + "Return file names of the sub-directory of DIRECTORY."
> + (scandir directory
> + (lambda (file)
> + (and (not (member file '("." "..")))
> + (file-is-directory? (string-append directory sep
> file))))))
We have find-files?
> +
> +(define* (pkg-name->libdir-name name)
> + "Return the library name deduced from the Erlang package name
> NAME."
> + (let* ((suffix (regexp-substitute #f (string-match "^erlang-(.*)"
> name) 1))
> + (elements (string-split suffix #\-)))
> + (string-append (string-join (drop-right elements 1) "_") "-"
> (last elements))))
> +
> +(define (libdir-name->prefix name)
> + "Return the prefix of a library directory name NAME."
> + (car (string-split name #\-)))
> +
> +(define (rebar-build-dir profile)
> + "Return the path where rebar builds libraries given the profile
> PROFILE."
> + (format #f "_build/~a/lib" profile))
> +
> +(define* (pkg-name->build-dir name #:key (profile "default"))
> + "Return the path of library directory where rebar3 builds code of
> an Erlang package named NAME given the profile PROFILE."
> + (string-append (rebar-build-dir profile) sep (libdir-name->prefix
> (pkg-name->libdir-name name))))
>
> (define* (unpack #:key source #:allow-other-keys)
> - "Unpack SOURCE in the working directory, and change directory
> within the
> -source. When SOURCE is a directory, copy it in a sub-directory of
> the current
> -working directory."
> - (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> - (gnu-unpack #:source source)
> - ;; Packages from hex.pm typically have a contents.tar.gz
> containing the
> - ;; actual source. If this tar file exists, extract it.
> - (when (file-exists? "contents.tar.gz")
> - (invoke "tar" "xvf" "contents.tar.gz"))))
> -
> -(define* (build #:key (rebar-flags '()) #:allow-other-keys)
> + (if (file-is-directory? source)
> + ;; If source is a checkout:
> + (begin
> + ;; Preserve timestamps (set to the Epoch) on the copied tree
> so that
> + ;; things work deterministically.
> + (copy-recursively source "." #:keep-mtime? #t)
> + ;; Make the source checkout files writable, for convenience.
> + (for-each (lambda (f)
> + (false-if-exception (make-file-writable f)))
> + (find-files ".")))
> +
> + ;; If source is an hex.pm archive:
> + (begin
> + (invoke "tar" "xvf" source)
> + (invoke "tar" "xvf" "contents.tar.gz")
> +
> + ;; Prevent an error message during the install phase.
> + ;; `rebar3 compile' produces symlinks like so in _build/:
> + ;; priv -> ../../../../priv
> + ;; include -> ../../../../include
> + ;;
> + ;; The install phase copies whatever has been built to the
> output directory.
> + ;; If the priv/ directory is absent, then an error `i/o
> error:
> + ;; _build/…/priv: No such file or directory' occurs. So,
> we make sure that a
> + ;; directory exists.
> + (for-each (lambda (dir) (mkdir-p dir)) (list "priv"
> "include")))))
Uhm, how are you improving the status quo here?
> +
> +(define (configure-HOME . ignored_args)
Just _ is fine for ignored arguments.
> + "In some cases, it is needed for the environment variable HOME to
> be defined
> +as a directory with write permission. Examples of errors:
> +
> +Could not write to \"/homeless-shelter/.cache/rebar3/hex\". Please
> ensure the path is writeable.
> +"
> + (let ((HOME "HOME")
> + (tmp "/tmp"))
> + (setenv HOME tmp)
> + (format #t "~a=~a\n" HOME tmp)))
The canonical way is to use (getcwd) as HOME. You can could also try
something like (canonicalize-path "../hexpm-home"). Anyhow, you might
want to try using a variable that is less global than HOME.
> +(define* (configure-dependencies #:key
> + (install-profile "default")
> + inputs
> + name
> + sources-erlang ;List of Source.
> + version
> + #:allow-other-keys)
> + "Rebar3 refuses to compile without network access unless its
> dependencies are
> +present as source checkouts. To prevent unnecessary compilations, we
> must «
> +pre-install » dependencies in Rebar's build directory."
I suggest not using french quotes – they are confusing between French
and German native speakers :)
You might want to look into possible PATH variables or put these
sources into a special folder so that you can use search-path-as-list.
Also, IIUC erlang-depends already does something rather similar. Is
there any reason it's broken for you?
> +
> + ;; If source in sources-erlang, then install it under _checkouts/.
> + (let ((_checkouts "_checkouts"))
> + (mkdir-p _checkouts)
> +
> + (define (install-source source)
> + "Install the Source SOURCE in _checkouts."
> + (match source
> + ((name path)
> + (let ((src (string-append _checkouts sep name)))
> + (mkdir-p src)
> + (with-directory-excursion src (unpack #:source path))))
> + (_ #f)))
> +
> + (for-each install-source sources-erlang))
> +
> + ;; If input in inputs is an Erlang package, then install it under
> _build/.
> + (let ((_build (format #f "_build/~a/checkouts" install-profile)))
> + (mkdir-p _build)
> +
> + (define (install-libdir elib name dest)
> + "Install the library directory named NAME from ELIB to DEST."
> + (let ((src (string-append elib sep name))
> + (dest (string-append dest sep (libdir-name->prefix
> name))))
> + (copy-recursively src dest)
> + (mkdir-p (string-append dest "/priv"))))
> +
> + (define (install-all-libdirs dir dest)
> + "Install in DEST all library directories in DIR."
> + (let ((elib (string-append dir sep lib-erlang-lib)))
> + (when (directory-exists? elib)
> + (for-each (lambda (name) (install-libdir elib name dest))
> + (list-directories elib)))))
> +
> + (match inputs
> + (((_ . dirs) ..1)
> + (for-each
> + (lambda (dir) (install-all-libdirs dir _build))
> + dirs))
> + (_ #f))))
> +
> +(define* (build #:key name (rebar-flags '()) #:allow-other-keys)
> (apply invoke `("rebar3" "compile" ,@rebar-flags)))
>
> -(define* (check #:key target (rebar-flags '()) (tests? (not target))
> +(define* (check #:key target
> + (rebar-flags '())
> + (tests? (not target))
> (test-target "eunit")
> #:allow-other-keys)
> (if tests?
> (apply invoke `("rebar3" ,test-target ,@rebar-flags))
> (format #t "test suite not run~%")))
>
> -(define (erlang-package? name)
> - "Check if NAME correspond to the name of an Erlang package."
> - (string-prefix? "erlang-" name))
> -
> -(define (package-name-version->erlang-name name+ver)
> - "Convert the Guix package NAME-VER to the corresponding Erlang
> name-version
> -format. Essentially drop the prefix used in Guix and replace dashes
> by
> -underscores."
> - (let* ((name- (package-name->name+version name+ver)))
> - (string-join
> - (string-split
> - (if (erlang-package? name-) ; checks for "erlang-" prefix
> - (string-drop name- (string-length "erlang-"))
> - name-)
> - #\-)
> - "_")))
> -
> -(define (list-directories directory)
> - "Return file names of the sub-directory of DIRECTORY."
> - (scandir directory
> - (lambda (file)
> - (and (not (member file '("." "..")))
> - (file-is-directory? (string-append directory "/"
> file))))))
> -
> -(define* (install #:key name outputs
> - (install-name (package-name-version->erlang-name
> name))
> - (install-profile "default") ; build profile
> outputs to install
> - #:allow-other-keys)
> - (let* ((out (assoc-ref outputs "out"))
> - (pkg-dir (string-append out %erlang-libdir "/" install-
> name)))
> - (let ((bin-dir (string-append "_build/" install-profile "/bin"))
> - (lib-dir (string-append "_build/" install-profile
> "/lib")))
> - ;; install _build/PROFILE/bin
> - (when (file-exists? bin-dir)
> - (copy-recursively bin-dir out #:follow-symlinks? #t))
> - ;; install _build/PROFILE/lib/*/{ebin,include,priv}
> - (for-each
> - (lambda (*)
> - (for-each
> - (lambda (dirname)
> - (let ((src-dir (string-append lib-dir "/" * "/"
> dirname))
> - (dst-dir (string-append pkg-dir "/" dirname)))
> - (when (file-exists? src-dir)
> - (copy-recursively src-dir dst-dir #:follow-symlinks?
> #t))
> - (false-if-exception
> - (delete-file (string-append dst-dir
> "/.gitignore")))))
> - '("ebin" "include" "priv")))
> - (list-directories lib-dir))
> - (false-if-exception
> - (delete-file (string-append pkg-dir "/priv/Run-eunit-
> loop.expect"))))))
> +(define* (install #:key name outputs (install-profile "default")
> #:allow-other-keys)
> + (let* ((src (pkg-name->build-dir name #:profile install-profile))
> + (dest (string-append (assoc-ref outputs "out")
> + sep lib-erlang-lib sep
> + (pkg-name->libdir-name name))))
> + (mkdir-p dest)
> + (copy-recursively src dest #:follow-symlinks? #t)))
>
> (define %standard-phases
> (modify-phases gnu:%standard-phases
> (replace 'unpack unpack)
> + (add-after 'unpack 'configure-HOME configure-HOME)
> (delete 'bootstrap)
> (delete 'configure)
> - (add-before 'build 'erlang-depends erlang-depends)
> + (add-before 'build 'configure-dependencies configure-
> dependencies)
> (replace 'build build)
> (replace 'check check)
> (replace 'install install)))
>
> -(define* (rebar-build #:key inputs (phases %standard-phases)
> - #:allow-other-keys #:rest args)
> +(define* (rebar-build #:key inputs (phases %standard-phases)
> #:allow-other-keys #:rest args)
> "Build the given Erlang package, applying all of PHASES in order."
> (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; rebar-build-system.scm ends here
>
> base-commit: 4dfbc536689b07e56aead3dd864b8af54613d091
> --
> 2.41.0
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-29 18:29 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Liliana Marie Prikler
@ 2023-10-29 22:14 ` Pierre-Henry Fröhring
2023-10-30 5:29 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-29 22:14 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
[-- Attachment #1: Type: text/plain, Size: 2971 bytes --]
> The middle should indicate a revision number and an optional branch
> (as well as optional WIP and RFC). Since this goes to master (I
> assume), it should just be v2, v3, … vN.
DONE: Ok. If I understood correctly, it means that it should have been
[PATCH v2]. So this time, it will be [PATCH v3].
> Emacs, Rust, etc., build systems just strip out the prefix. No need
> to go all fancy regexpy :)何で?
WAITING: Well, it makes the warning message completely explicit, for
example:
┌────
│ AssertionWarning 4dcbff27
│ Assertion: re matches name.
│ re = ^erlang-(.*)
│ name = something-else
└────
Is it OK if it stays like this?
> I suggest not renaming these procedures. default-X reads more
> naturally than X-default.
DONE.
> This reeks of the hack that we need for cargo-build-system, except
> with a worse variable name. I strongly suggest looking into ways we
> can do without it.
WAITING: this idea came from a discussion with jpoiret. See:
<https://logs.guix.gnu.org/guix/2023-10-24.log#180111>. It seems that
the idea you suggest is to use `search-path-as-list' as hinted below. Is
this correct?
> Uhm, did you mean file-name-separator-string from Guile core?
DONE: Great. That is what I was searching for; I'm not yet familiar with
the standard library.
> We have find-files?
DONE: replaced.
> Uhm, how are you improving the status quo here?
WAITING: comment updated with:
┌────
│ ;; If these directories exist, then no error occurs. So, we make sure
│ ;; they exist.
└────
Is this OK?
> The canonical way is to use (getcwd) as HOME. You could also try
> something like (canonicalize-path "../hexpm-home"). Anyhow, you might
> want to try using a variable that is less global than HOME.
DONE: HOME has been replaced by REBAR_CACHE_DIR.
> I suggest not using French examples – they are confusing between
> French and German native speakers :)
DONE: « → “, » → ”
> You might want to look into possible PATH variables or put these
> sources into a special folder so that you can use search-path-as-list.
WAITING: Perhaps an idea:
1) If we require all Erlang packages to have an output “src” something
like: /gnu/store/…elixir-pkg-1.2.3/src/elixir/src/…,
2) then (search-path-as-list '("src/elixir/src")
'("/gnu/store…elixir-pkg-1.2.3" …)) would return
'("/gnu/store…elixir-pkg-1.2.3/src/elixir/src" …) ≡ lst-src.
3) Given lst-src, it would be enough to install each source under
_checkouts, i.e., _checkouts/lib-name/src. It is probably feasible to
retrieve lib-name from somewhere.
What do you think?
> Also, IIUC, erlang-depends already does something rather similar. Is
> there any reason it's broken for you?
WAITING: Without that (i.e., _checkouts/lib-name/src), rebar3 will not
compile things. Is this a satisfaying explaination?
[-- Attachment #2: Type: text/html, Size: 3422 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-29 22:14 ` Pierre-Henry Fröhring
@ 2023-10-30 5:29 ` Liliana Marie Prikler
2023-10-30 12:30 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-10-30 5:29 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Sonntag, dem 29.10.2023 um 23:14 +0100 schrieb Pierre-Henry
Fröhring:
> n [PATCH v2]. So this time, it will be [PATCH v3].
>
> > Emacs, Rust, etc., build systems just strip out the prefix. No
> > need to go all fancy regexpy :)何で?
>
> WAITING: Well, it makes the warning message completely explicit, for
> example:
> ┌────
> │ AssertionWarning 4dcbff27
> │ Assertion: re matches name.
> │ re = ^erlang-(.*)
> │ name = something-else
> └────
> Is it OK if it stays like this?
You can use a shorter error and explain the problem better:
"~a does not start with \"erlang-\"" name
>
> > Uhm, how are you improving the status quo here?
>
> WAITING: comment updated with:
> ┌────
> │ ;; If these directories exist, then no error occurs. So, we make
> sure
> │ ;; they exist.
> └────
> Is this OK?
>
>
> [...]
> > You might want to look into possible PATH variables or put these
> > sources into a special folder so that you can use search-path-as-
> > list.
>
> WAITING: Perhaps an idea:
> 1) If we require all Erlang packages to have an output “src”
> something
> like: /gnu/store/…elixir-pkg-1.2.3/src/elixir/src/…,
> 2) then (search-path-as-list '("src/elixir/src")
> '("/gnu/store…elixir-pkg-1.2.3" …)) would return
> '("/gnu/store…elixir-pkg-1.2.3/src/elixir/src" …) ≡ lst-src.
> 3) Given lst-src, it would be enough to install each source under
> _checkouts, i.e., _checkouts/lib-name/src. It is probably feasible
> to
> retrieve lib-name from somewhere.
> What do you think?
Rather than require, you can add a phase to ensure that this is the
case. I'm not sure whether we should make that an extra output,
however; there might be many packages for which we don't need those
sources and where we do need them, we could potentially add them as
native-inputs.
Another alternative would be to keep the sources in
lib/erlang/lib/lib-name/src so that it gets symlinked by the phase we
have. Though at that point we can surely go with a less surprising
install directory.
> > Also, IIUC, erlang-depends already does something rather similar.
> > Is there any reason it's broken for you?
>
> WAITING: Without that (i.e., _checkouts/lib-name/src), rebar3 will
> not compile things. Is this a satisfaying explaination?
I mean, ideally we would store these things in some other directory,
given that _checkouts/lib-name already contains the precompiled stuff
after erlang-depends. However, if the tooling insists on storing both
in the same place, you could simply amend the existing erlang-depends
phase to
1. Copy instead of symlinking
2. Also copy the sources
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-30 5:29 ` Liliana Marie Prikler
@ 2023-10-30 12:30 ` Pierre-Henry Fröhring
2023-10-30 20:40 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-10-30 12:30 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
[-- Attachment #1: Type: text/plain, Size: 4449 bytes --]
I've collected your comments in an org-file so that it's easier (at least
for me, but I hope it's the case for you too)
to follow multiple discussions at the same time. I've only included the
ones that are still open to discussion.
The structure should be self-evident. The most important comment may be
Comment 9.
Cheers.
* TODO Comment 4
** LMP
This reeks of the hack that we need for cargo-build-system, except with a
worse variable name. I strongly suggest looking into ways we can do without
it.
** PHF
This idea came from a discussion with jpoiret. See:
https://logs.guix.gnu.org/guix/2023-10-24.log#180111. It seems that the idea
you suggest is to use =search-path-as-list= as hinted below (=Comment 9=).
Is this
correct?
* TODO Comment 6
** LMP
Uhm, how are you improving the status quo here?
** PHF
Comment updated with:
#+begin_example
;; If these directories exist, then no error occurs. So, we make sure
;; they exist.
#+end_example
Is this OK?
I don't see how to prevent rebar3 to do that. It's apparently an opened
issue:
https://github.com/erlang/rebar3/issues/1173
* TODO Comment 9
** LMP
You might want to look into possible PATH variables or put these sources
into
a special folder so that you can use search-path-as-list.
** PHF
Perhaps an idea:
1) If we require all Erlang packages to have an output “src” something
like: /gnu/store/…elixir-pkg-1.2.3/src/elixir/src/…,
2) then (search-path-as-list '("src/elixir/src")
'("/gnu/store…elixir-pkg-1.2.3" …)) would return
'("/gnu/store…elixir-pkg-1.2.3/src/elixir/src" …) ≡ lst-src.
3) Given lst-src, it would be enough to install each source under
_checkouts,
i.e., _checkouts/lib-name/src. It is probably feasible to retrieve
lib-name
from somewhere.
What do you think?
** LMP
Rather than require, you can add a phase to ensure that this is the case.
I'm not sure whether we should make that an extra output, however; there
might be many packages for which we don't need those sources and where we do
need them, we could potentially add them as native-inputs.
** PHF
Agreed.
** LMP
Another alternative would be to keep the sources in
=lib/erlang/lib/lib-name/src= so that it gets symlinked by the phase we
have.
Though at that point we can surely go with a less surprising install
directory.
** PHF
Here is the approach taken so far:
1) The objective is to ensure that =mix compile= does not attempt to use the
network and, as a result, fails to compile.
2) For the above to be true, it is necessary to have — at build time — the
sources of all Erlang input packages and install them as checkouts.
3) Thus, the question becomes: How to access all the Erlang package sources
at
build time?
4) One idea was to have the client side of the build code send all the
sources
to the server through the poorly named argument =#:sources-erlang=. This
led
to the current code. It relies on the fact that for a given Erlang
package,
it is possible to access its source in the store, for example,
=/gnu/store/…erlang-kv/erlang-kv.tar=.
5) Instead, you propose modifying the installation process so that sources
are
installed along with the built libraries. The source might be collected
with =search-path-as-list=.
The downside seems to be that the source code is stored twice: first in
the
archive, then in the package.
However, this could lead to a much cleaner method of passing the sources
to
the build-side code, that is, the source code would not be passed through
=arguments=.
I'm sending a patch based on this latter idea. Are you OK with that?
* TODO Comment 10
** LMP
Also, IIUC, erlang-depends already does something rather similar. Is there
any reason it's broken for you?
** PHF
Without that (i.e., _checkouts/lib-name/src), rebar3 will not compile
things. Is this a satisfying explanation?
** LMP
I mean, ideally we would store these things in some other directory,
given that _checkouts/lib-name already contains the precompiled stuff
after erlang-depends. However, if the tooling insists on storing both
in the same place, you could simply amend the existing erlang-depends
phase to:
1. Copy instead of symlinking
2. Also copy the sources
** PHF
If I understand correctly, this should be addressed with the patch from
=Comment 9= section above.
[-- Attachment #2: Type: text/html, Size: 4962 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages.
2023-10-30 12:30 ` Pierre-Henry Fröhring
@ 2023-10-30 20:40 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-10-30 20:40 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Montag, dem 30.10.2023 um 13:30 +0100 schrieb Pierre-Henry Fröhring:
> [...]
> Comment updated with:
> #+begin_example
> ;; If these directories exist, then no error occurs. So, we make
> sure
> ;; they exist.
> #+end_example
> Is this OK?
>
> I don't see how to prevent rebar3 to do that. It's apparently an
> opened issue:
> https://github.com/erlang/rebar3/issues/1173
I'd recommend sticking with the current flow, however, and either
create those directories unconditionally or inside the
(when (file-exists? …) …)
In general, don't mix gratuitous "styling" changes into your commits.
Try to keep your edits minimal and reviewable.
> Here is the approach taken so far:
> 1) The objective is to ensure that =mix compile= does not attempt to
> use the network and, as a result, fails to compile.
> 2) For the above to be true, it is necessary to have — at build time
> — the sources of all Erlang input packages and install them as
> checkouts.
> 3) Thus, the question becomes: How to access all the Erlang package
> sources at build time?
> [...]
One idea both of us haven't voiced so far is to actually grab these in
the (guix build-system …) code rather than the (guix build …) side and
make the sources available via a mapping. Think package → (package-
source package).
The downsides of this are quite obvious. First, to my knowledge
something like that hasn't been done yet, so there's no reference
point. Second, the (guix build …) side would still need to identify
what's an erlang source. Given our code for the unpack phase, I'd
hazard a guess that this is non-trivial. Thus, even if there's
theoretically a way to not store the same tarball twice, in practice it
doesn't really matter.
You could alternatively also write the sources to a special source
output if and only if one such output is requested via the outputs
field. Again, I'd hazard a guess that this would be a very standard
output for anything that needs to go into mix-build-system and thus not
worth the split after all.
Alternatively² you could patch mix to only look for compiled stuff and
not sources. That would tackle the issue at the root instead of trying
to work around it, with the caveat being that we would need to maintain
this patch ourselves if upstream doesn't accept it.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] A minimal set of changes.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
2023-10-28 21:43 ` Liliana Marie Prikler
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
@ 2023-11-08 9:21 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
` (10 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:21 UTC (permalink / raw)
To: 66801, Liliana Marie Prikler
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
Dear Liliana,
Learning from our previous exchanges, I would like to first thank you
for your patience and propose refocusing our conversation on a more
concise set of changes.
I am preparing to send a cover letter as recommended in the "Sending a
Patch Series" section of the Guix manual, accompanied by a couple of
patches. These will contain just enough code to validate the approach
taken, along with a few packages for testing purposes.
If the approach is deemed satisfactory, I will make any necessary
corrections based on your feedback and continue to send more patches
until the Phoenix package can be successfully built.
Cheers.
[-- Attachment #2: Type: text/html, Size: 737 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 0/5] build Erlang packages with dependencies
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-11-08 9:21 ` [bug#66801] A minimal set of changes Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
` (4 more replies)
2023-11-13 20:26 ` [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system Pierre-Henry Fröhring
` (9 subsequent siblings)
13 siblings, 5 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Introduction
════════════
• The objective is to introduce a `mix-build-system' for building
Elixir packages.
• It is first necessary to have `rebar-build-system' to build Erlang
packages.
• We start by showing a build procedure using a package named `lager'
that operates without the need for network access.
• We generalize the build procedure to any Erlang package by using
[Checkout Dependencies].
• To align this build procedure with Guix, we ensure that for any
Erlang Guix package, all its dependencies, including the transitive
ones, can be identified.
• We show that the source code for each dependency is retrievable from
the store.
• We modify `rebar.scm' and `rebar-build-system.scm' to build
procedure into Guix.
• The packages defined in `erlang-xyz.scm' serve as the test cases for
this implementation.
• The changes to the Guix source code are minimal. While the primary
goal is to validate the approach, it may be necessary to resolve
stylistic issues or potential bugs.
[Checkout Dependencies]
<https://rebar3.org/docs/configuration/dependencies/#checkout-dependencies>
Bash
════
Rebar3 compiles and tests Lager without network access
──────────────────────────────────────────────────────
There is a directory and an environment such that `rebar3 compile' and
`rebar3 test' compile and test the [lager package] without network
access.
[lager package] <https://hex.pm/packages/lager>
Sources are fetched and unpacked
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ #! /usr/bin/env bash
│ set -euo pipefail
│ IFS=$'\n\t'
│
│ tmpdir=$(mktemp -d)
│ cd $tmpdir
│ wget -O source.tar https://repo.hex.pm/tarballs/lager-3.9.2.tar
│ tar xf source.tar
│ tar xf contents.tar.gz
└────
Dependencies are fetched
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ rebar3 compile
│ rebar3 eunit
└────
Checkouts are built
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#+begin_src bash mkdir _checkouts mv _build/default/lib/goldrush
_checkouts rm -rf _build #+end_srcè
The directory is built
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ .
│ ├── _checkouts
│ │ └── goldrush
│ │ ├── ebin
│ │ │ ├── …
│ │ │ └── gr_sup.beam
│ │ ├── hex_metadata.config
│ │ ├── LICENSE
│ │ ├── priv
│ │ │ └── edoc.css
│ │ ├── README.org
│ │ ├── rebar.config
│ │ ├── rebar.lock
│ │ └── src
│ │ ├── …
│ │ └── gr_sup.erl
│ ├── CHECKSUM
│ ├── contents.tar.gz
│ ├── include
│ │ └── lager.hrl
│ ├── LICENSE
│ ├── metadata.config
│ ├── priv
│ │ └── edoc.css
│ ├── README.md
│ ├── rebar.config
│ ├── rebar.config.script
│ ├── rebar.lock
│ ├── source.tar
│ ├── src
│ │ ├── …
│ │ └── lager_util.erl
│ └── VERSION
│
│ 9 directories, 73 files
└────
The environment is defined
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ (specifications->manifest '("coreutils" "rebar3"))
└────
Lager is compiled and tested without network access
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ guix shell -C -m manifest.scm -- rebar3 compile
│ guix shell -C -m manifest.scm -- rebar3 eunit
└────
Erlang can find and use the compiled module
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ ERL_LIBS=_build/default/lib erl -noshell -eval 'io:format("~p~n", [code:which(lager)]).' -s init stop
└────
┌────
│ "_build/default/lib/lager/ebin/lager.beam"
└────
Discussion
══════════
Several observations can be made, and alternative approaches can be
proposed, as listed below. Meanwhile, with the implementation
described above, it becomes feasible to build Erlang packages with
Guix, which is an essential step towards building Elixir packages.
Wasted Computations
───────────────────
This build procedure needs to re-build of all Erlang dependencies for
an Erlang package, even if they have been previously built. This is
due to the `rebar3' build system's refusal to operate without network
access unless the dependencies are checked out. If checked out, it
insists on rebuilding them from sources.
Expensive computations
──────────────────────
For a given Erlang dependency, it is necessary to retreive all its
transitive dependencies which might be expensive to compute. See:
[all-transitive-inputs].
[all-transitive-inputs] <./guix/build-system/rebar.scm::(define
(all-transitive-inputs>
Wasted Space
────────────
The source code for all Erlang dependencies of a specific Erlang
package must be available on the build machine, whereas it might be
assumed that the build artifacts alone would suffice.
Alternatives
────────────
Liliana Marie Pinker has suggested several alternatives listed below.
Store sources along the build artifacts
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
From [issue/66801]:
keep the sources in lib/erlang/lib/lib-name/src so that it
gets symlinked by the phase we have. Though at that point
we can surely go with a less surprising install directory.
[issue/66801] <https://issues.guix.gnu.org/issue/66801>
Write the sources to a special source output
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
From [issue/66801]:
You could alternatively also write the sources to a
special source output if and only if one such output is
requested via the outputs field. Again, I'd hazard a
guess that this would be a very standard output for
anything that needs to go into mix-build-system and thus
not worth the split after all.
[issue/66801] <https://issues.guix.gnu.org/issue/66801>
Patch Rebar3
╌╌╌╌╌╌╌╌╌╌╌╌
From [issue/66801]:
you could patch mix to only look for compiled stuff and
not sources. That would tackle the issue at the root
instead of trying to work around it, with the caveat being
that we would need to maintain this patch ourselves if
upstream doesn't accept it.
[issue/66801] <https://issues.guix.gnu.org/issue/66801>
Pierre-Henry Fröhring (5):
guix: build-system: rebar: build Erlang packages with dependencies.
gnu: Add erlang-goldrush.
gnu: Add erlang-lager.
gnu: Add erlang-unicode-util-compat.
gnu: Add erlang-idna.
gnu/packages/erlang-xyz.scm | 111 +++++++++++++++
guix/build-system/rebar.scm | 223 ++++++++++++++++++++++--------
guix/build/rebar-build-system.scm | 43 +++---
3 files changed, 300 insertions(+), 77 deletions(-)
create mode 100644 gnu/packages/erlang-xyz.scm
base-commit: 4dfbc536689b07e56aead3dd864b8af54613d091
--
2.41.0
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 1/5] guix: build-system: rebar: build Erlang packages with dependencies.
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
2023-11-08 20:40 ` Liliana Marie Prikler
2023-11-08 9:22 ` [bug#66801] [PATCH 2/5] gnu: Add erlang-goldrush Pierre-Henry Fröhring
` (3 subsequent siblings)
4 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 13264 bytes --]
Change-Id: Ie221d47fd1c9a766c2e2cdf76460ddfdf65e090d
---
guix/build-system/rebar.scm | 223 ++++++++++++++++++++++--------
guix/build/rebar-build-system.scm | 43 +++---
2 files changed, 189 insertions(+), 77 deletions(-)
diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm
index de1294ec..cdff85a6 100644
--- a/guix/build-system/rebar.scm
+++ b/guix/build-system/rebar.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,20 +19,120 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system rebar)
- #:use-module (guix store)
- #:use-module (guix utils)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
#:use-module (guix gexp)
- #:use-module (guix packages)
#:use-module (guix monads)
+ #:use-module (guix packages)
#:use-module (guix search-paths)
- #:use-module (guix build-system)
- #:use-module (guix build-system gnu)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:export (hexpm-uri
hexpm-package-url
%rebar-build-system-modules
rebar-build
rebar-build-system))
+
+;;;
+;;; Utils
+;;;
+
+(define (flatten lst) (fold append '() lst))
+
+
+;;;
+;;; Packages
+;;;
+
+(define %erlang-package-prefix "erlang-")
+
+(define (erlang-package-name? name)
+ "Indicates if NAME is an Erlang package name.
+If a package name starts with %erlang-package-prefix, then it is an Erlang package name.
+An Erlang package name must start with %erlang-package-prefix."
+ (string-prefix? %erlang-package-prefix name))
+
+(define (hexpm-name pkg-name)
+ "Given a package name PKG-NAME, returns the corresponding hex.pm package name."
+ (let ((suffix (string-drop pkg-name (string-length %erlang-package-prefix))))
+ (string-replace-substring suffix "-" "_")))
+
+(define (all-transitive-inputs pkg pred)
+ "Given a package PKG and a predicate PRED, return all transitive inputs of PKG
+that match the predicate PRED."
+ (delete-duplicates
+ (append
+ (filter pred (package-transitive-inputs pkg))
+ (filter pred (package-transitive-native-inputs pkg))
+ (filter pred (package-transitive-propagated-inputs pkg)))
+ input=?))
+
+
+;;;
+;;; Input
+;;;
+
+(define (input-mk name package)
+ "Build an Input."
+ (list name package))
+
+(define (input->name input)
+ "Return the name of INPUT."
+ (car input))
+
+(define (input->package input)
+ "Return the package of INPUT."
+ (cadr input))
+
+(define (input=? i1 i2)
+ "Test whether Inputs I1 and I2 are equal."
+ (string=? (input->name i1) (input->name i2)))
+
+(define (erlang-input? input)
+ "Test whether INPUT is an Erlang Input."
+ (erlang-package-name? (input->name input)))
+
+(define (input->all-inputs input pred)
+ "Return the list of implicit satisfying PRED Inputs associated to INPUT, including INPUT."
+ (cons input (all-transitive-inputs (input->package input) pred)))
+
+(define (inputs->all-erlang-inputs erlang-inputs)
+ "Return a list of implicit Erlang Inputs associated to INPUT, including INPUT."
+ (let ((all-inputs (flatten (map (cut input->all-inputs <> erlang-package-name?) erlang-inputs))))
+ (delete-duplicates all-inputs input=?)))
+
+
+;;;
+;;; Source
+;;;
+
+(define (source-mk name origin)
+ "Build a source.
+NAME is an hex.pm package name.
+ORIGIN is an Origin."
+ (list name origin))
+
+(define (source->name source)
+ "Return the name of SOURCE."
+ (car source))
+
+(define (source->origin source)
+ "Return the origin of SOURCE."
+ (cadr source))
+
+(define (source=? s1 s2)
+ "Test whether Sources S1 and S2 are equal."
+ (string=? (source->name s1) (source->name s2)))
+
+(define (input->source input)
+ "Given an Input INPUT, return its associated Source."
+ (source-mk (hexpm-name (input->name input))
+ (package-source (input->package input))))
+
+
;;;
;;; Definitions for the hex.pm repository,
;;;
@@ -44,10 +145,11 @@ (define %hexpm-repo-url
(define hexpm-package-url
(string-append (%hexpm-repo-url) "/tarballs/"))
-(define (hexpm-uri name version)
+(define (hexpm-uri pkg-name version)
"Return a URI string for the package hosted at hex.pm corresponding to NAME
and VERSION."
- (string-append hexpm-package-url name "-" version ".tar"))
+ (let ((name (if (erlang-package-name? pkg-name) (hexpm-name pkg-name) pkg-name)))
+ (string-append hexpm-package-url name "-" version ".tar")))
;;
;; Standard build procedure for Erlang packages using Rebar.
@@ -78,42 +180,50 @@ (define* (lower name
#:rest arguments)
"Return a bag for NAME from the given arguments."
(define private-keywords
- '(#:target #:rebar #:erlang #:inputs #:native-inputs))
-
- (and (not target) ;XXX: no cross-compilation
- (bag
- (name name)
- (system system)
- (host-inputs `(,@(if source
- `(("source" ,source))
- '())
- ,@inputs))
- (build-inputs `(("rebar" ,rebar)
- ("erlang" ,erlang) ;; for escriptize
- ,@native-inputs
- ;; Keep the standard inputs of 'gnu-build-system'.
- ,@(standard-packages)))
- (outputs outputs)
- (build rebar-build)
- (arguments (strip-keyword-arguments private-keywords arguments)))))
+ '(#:target #:rebar #:erlang #:inputs #:native-inputs #:erlang-sources))
+
+ (let* ((inputs-all (append inputs native-inputs))
+ (erlang-inputs (filter erlang-input? inputs-all))
+ (all-erlang-inputs (inputs->all-erlang-inputs erlang-inputs))
+ (all-erlang-sources (map input->source all-erlang-inputs)))
+
+ (and (not target) ;XXX: no cross-compilation
+ (bag
+ (name name)
+ (system system)
+ (host-inputs `(,@(if source
+ `(("source" ,source))
+ '())
+ ,@inputs))
+ (build-inputs `(("rebar" ,rebar)
+ ("erlang" ,erlang) ;; for escriptize
+ ,@inputs
+ ,@native-inputs
+ ;; Keep the standard inputs of 'gnu-build-system'.
+ ,@(standard-packages)))
+ (outputs outputs)
+ (build rebar-build)
+ (arguments (append (list #:erlang-sources all-erlang-sources)
+ (strip-keyword-arguments private-keywords arguments)))))))
(define* (rebar-build name inputs
- #:key
- guile source
- (rebar-flags ''("skip_deps=true" "-vv"))
- (tests? #t)
- (test-target "eunit")
- ;; TODO: install-name ; default: based on guix package name
- (install-profile "default")
- (phases '(@ (guix build rebar-build-system)
- %standard-phases))
- (outputs '("out"))
- (search-paths '())
- (native-search-paths '())
- (system (%current-system))
- (imported-modules %rebar-build-system-modules)
- (modules '((guix build rebar-build-system)
- (guix build utils))))
+ #:key
+ guile source
+ (rebar-flags ''("skip_deps=true" "-vv"))
+ (tests? #t)
+ (test-target "eunit")
+ ;; TODO: install-name ; default: based on guix package name
+ (install-profile "default")
+ (phases '(@ (guix build rebar-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (native-search-paths '())
+ (erlang-sources '())
+ (system (%current-system))
+ (imported-modules %rebar-build-system-modules)
+ (modules '((guix build rebar-build-system)
+ (guix build utils))))
"Build SOURCE with INPUTS."
(define builder
@@ -123,21 +233,22 @@ (define* (rebar-build name inputs
#$(with-build-variables inputs outputs
#~(rebar-build #:source #+source
- #:system #$system
- #:name #$name
- #:rebar-flags #$rebar-flags
- #:tests? #$tests?
- #:test-target #$test-target
- ;; TODO: #:install-name #$install-name
- #:install-profile #$install-profile
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:outputs %outputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs %build-inputs)))))
+ #:system #$system
+ #:name #$name
+ #:rebar-flags #$rebar-flags
+ #:tests? #$tests?
+ #:test-target #$test-target
+ ;; TODO: #:install-name #$install-name
+ #:install-profile #$install-profile
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map search-path-specification->sexp
+ search-paths))
+ #:inputs %build-inputs
+ #:erlang-sources '#$erlang-sources)))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))
diff --git a/guix/build/rebar-build-system.scm b/guix/build/rebar-build-system.scm
index fb664228..286e4e1a 100644
--- a/guix/build/rebar-build-system.scm
+++ b/guix/build/rebar-build-system.scm
@@ -28,6 +28,13 @@ (define-module (guix build rebar-build-system)
#:export (rebar-build
%standard-phases))
+;;
+;; Utils
+;;
+
+(define sep file-name-separator-string)
+
+
;;
;; Builder-side code of the standard build procedure for Erlang packages using
;; rebar3.
@@ -37,27 +44,20 @@ (define-module (guix build rebar-build-system)
(define %erlang-libdir "/lib/erlang/lib")
-(define* (erlang-depends #:key inputs #:allow-other-keys)
- (define input-directories
- (match inputs
- (((_ . dir) ...)
- dir)))
- (mkdir-p "_checkouts")
-
- (for-each
- (lambda (input-dir)
- (let ((elibdir (string-append input-dir %erlang-libdir)))
- (when (directory-exists? elibdir)
- (for-each
- (lambda (dirname)
- (let ((dest (string-append elibdir "/" dirname))
- (link (string-append "_checkouts/" dirname)))
- (when (not (file-exists? link))
- ;; RETHINK: Maybe better copy and make writable to avoid some
- ;; error messages e.g. when using with rebar3-git-vsn.
- (symlink dest link))))
- (list-directories elibdir)))))
- input-directories))
+(define (configure-environment . _)
+ (setenv "REBAR_CACHE_DIR" (getcwd)))
+
+(define* (erlang-depends #:key erlang-sources #:allow-other-keys)
+ (let ((checkouts "_checkouts"))
+ (mkdir-p checkouts)
+ (for-each (lambda (source)
+ (match source
+ ((name archive)
+ (let ((libdir (string-append checkouts sep name)))
+ (mkdir-p libdir)
+ (with-directory-excursion libdir
+ (unpack #:source archive))))))
+ erlang-sources)))
(define* (unpack #:key source #:allow-other-keys)
"Unpack SOURCE in the working directory, and change directory within the
@@ -134,6 +134,7 @@ (define* (install #:key name outputs
(define %standard-phases
(modify-phases gnu:%standard-phases
(replace 'unpack unpack)
+ (add-after 'unpack 'configure-environment configure-environment)
(delete 'bootstrap)
(delete 'configure)
(add-before 'build 'erlang-depends erlang-depends)
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 1/5] guix: build-system: rebar: build Erlang packages with dependencies.
2023-11-08 9:22 ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
@ 2023-11-08 20:40 ` Liliana Marie Prikler
2023-11-13 18:58 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-08 20:40 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Mittwoch, dem 08.11.2023 um 10:22 +0100 schrieb Pierre-Henry
Fröhring:
> Change-Id: Ie221d47fd1c9a766c2e2cdf76460ddfdf65e090d
> ---
Missing the ChangeLog :)
Also, don't forget to add me to CC so that I can see the changes more
easily.
> guix/build-system/rebar.scm | 223 ++++++++++++++++++++++------
> --
> guix/build/rebar-build-system.scm | 43 +++---
> 2 files changed, 189 insertions(+), 77 deletions(-)
>
> diff --git a/guix/build-system/rebar.scm b/guix/build-
> system/rebar.scm
> index de1294ec..cdff85a6 100644
> --- a/guix/build-system/rebar.scm
> +++ b/guix/build-system/rebar.scm
> @@ -1,6 +1,7 @@
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
> ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -18,20 +19,120 @@
> ;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
>
> (define-module (guix build-system rebar)
> - #:use-module (guix store)
> - #:use-module (guix utils)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> #:use-module (guix gexp)
> - #:use-module (guix packages)
> #:use-module (guix monads)
> + #:use-module (guix packages)
> #:use-module (guix search-paths)
> - #:use-module (guix build-system)
> - #:use-module (guix build-system gnu)
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> #:export (hexpm-uri
> hexpm-package-url
> %rebar-build-system-modules
> rebar-build
> rebar-build-system))
>
> +
> +;;;
> +;;; Utils
> +;;;
> +
> +(define (flatten lst) (fold append '() lst))
You use this procedure once and you can probably replace it with
append-map from SRFI-1.
> +;;;
> +;;; Packages
> +;;;
> +
> +(define %erlang-package-prefix "erlang-")
> +
> +(define (erlang-package-name? name)
> + "Indicates if NAME is an Erlang package name.
> +If a package name starts with %erlang-package-prefix, then it is an
> Erlang package name.
> +An Erlang package name must start with %erlang-package-prefix."
> + (string-prefix? %erlang-package-prefix name))
> +
> +(define (hexpm-name pkg-name)
> + "Given a package name PKG-NAME, returns the corresponding hex.pm
> package name."
> + (let ((suffix (string-drop pkg-name (string-length %erlang-
> package-prefix))))
> + (string-replace-substring suffix "-" "_")))
> +
> +(define (all-transitive-inputs pkg pred)
> + "Given a package PKG and a predicate PRED, return all transitive
> inputs of PKG
> +that match the predicate PRED."
> + (delete-duplicates
> + (append
> + (filter pred (package-transitive-inputs pkg))
> + (filter pred (package-transitive-native-inputs pkg))
> + (filter pred (package-transitive-propagated-inputs pkg)))
> + input=?))
We already have package-direct-inputs. Instead of matching labels, you
might want to match package names instead anyway.
> +
> +;;;
> +;;; Input
> +;;;
> +
> +(define (input-mk name package)
> + "Build an Input."
> + (list name package))
> +
> +(define (input->name input)
> + "Return the name of INPUT."
> + (car input))
> +
> +(define (input->package input)
> + "Return the package of INPUT."
> + (cadr input))
You shouldn't define such destructuring procedures. Use (ice-9 match)
where needed.
> +(define (input=? i1 i2)
> + "Test whether Inputs I1 and I2 are equal."
> + (string=? (input->name i1) (input->name i2)))
Yeah, don't compare labels.
> +(define (erlang-input? input)
> + "Test whether INPUT is an Erlang Input."
> + (erlang-package-name? (input->name input)))
> +
> +(define (input->all-inputs input pred)
> + "Return the list of implicit satisfying PRED Inputs associated to
> INPUT, including INPUT."
> + (cons input (all-transitive-inputs (input->package input) pred)))
> +
> +(define (inputs->all-erlang-inputs erlang-inputs)
> + "Return a list of implicit Erlang Inputs associated to INPUT,
> including INPUT."
> + (let ((all-inputs (flatten (map (cut input->all-inputs <> erlang-
> package-name?) erlang-inputs))))
> + (delete-duplicates all-inputs input=?)))
The name, arguments, and docstring of this function do not match in any
way. Consider expressing yourself in terms of known Guile functions.
(define (transitive-erlang-inputs inputs)
(define (erlang-inputs inputs)
(filter-map
(match-lambda ((name package . output)
(and (erlang-package-name?)
(cons* name package output))))
inputs))
(delete-duplicates
(append-map erlang-inputs
(append-map
package-transitive-inputs
(map cadr inputs)))))
Note that there's almost certainly a smarter way than nesting two
append-maps, but am currently too lazy to look that up.
> +
> +;;;
> +;;; Source
> +;;;
> +
> +(define (source-mk name origin)
> + "Build a source.
> +NAME is an hex.pm package name.
> +ORIGIN is an Origin."
> + (list name origin))
> +
> +(define (source->name source)
> + "Return the name of SOURCE."
> + (car source))
> +
> +(define (source->origin source)
> + "Return the origin of SOURCE."
> + (cadr source))
> +
> +(define (source=? s1 s2)
> + "Test whether Sources S1 and S2 are equal."
> + (string=? (source->name s1) (source->name s2)))
> +
> +(define (input->source input)
> + "Given an Input INPUT, return its associated Source."
> + (source-mk (hexpm-name (input->name input))
> + (package-source (input->package input))))
Again, use ice-9 match instead of manually defining all those
destructuring procedures.
> +
> ;;;
> ;;; Definitions for the hex.pm repository,
> ;;;
> @@ -44,10 +145,11 @@ (define %hexpm-repo-url
> (define hexpm-package-url
> (string-append (%hexpm-repo-url) "/tarballs/"))
>
> -(define (hexpm-uri name version)
> +(define (hexpm-uri pkg-name version)
> "Return a URI string for the package hosted at hex.pm
> corresponding to NAME
> and VERSION."
> - (string-append hexpm-package-url name "-" version ".tar"))
> + (let ((name (if (erlang-package-name? pkg-name) (hexpm-name pkg-
> name) pkg-name)))
> + (string-append hexpm-package-url name "-" version ".tar")))
>
> ;;
> ;; Standard build procedure for Erlang packages using Rebar.
> @@ -78,42 +180,50 @@ (define* (lower name
> #:rest arguments)
> "Return a bag for NAME from the given arguments."
> (define private-keywords
> - '(#:target #:rebar #:erlang #:inputs #:native-inputs))
> -
> - (and (not target) ;XXX: no cross-
> compilation
> - (bag
> - (name name)
> - (system system)
> - (host-inputs `(,@(if source
> - `(("source" ,source))
> - '())
> - ,@inputs))
> - (build-inputs `(("rebar" ,rebar)
> - ("erlang" ,erlang) ;; for escriptize
> - ,@native-inputs
> - ;; Keep the standard inputs of 'gnu-build-
> system'.
> - ,@(standard-packages)))
> - (outputs outputs)
> - (build rebar-build)
> - (arguments (strip-keyword-arguments private-keywords
> arguments)))))
> + '(#:target #:rebar #:erlang #:inputs #:native-inputs #:erlang-
> sources))
> +
> + (let* ((inputs-all (append inputs native-inputs))
> + (erlang-inputs (filter erlang-input? inputs-all))
> + (all-erlang-inputs (inputs->all-erlang-inputs erlang-
> inputs))
> + (all-erlang-sources (map input->source all-erlang-inputs)))
Instead of let-binding these, you might want to define a procedure
(erlang-sources inputs native-inputs) and then use that for #:erlang-
sources.
> + (and (not target) ;XXX: no cross-compilation
> + (bag
> + (name name)
> + (system system)
> + (host-inputs `(,@(if source
> + `(("source" ,source))
> + '())
> + ,@inputs))
> + (build-inputs `(("rebar" ,rebar)
> + ("erlang" ,erlang) ;; for escriptize
> + ,@inputs
> + ,@native-inputs
> + ;; Keep the standard inputs of 'gnu-
> build-system'.
> + ,@(standard-packages)))
> + (outputs outputs)
> + (build rebar-build)
> + (arguments (append (list #:erlang-sources all-erlang-
> sources)
> + (strip-keyword-arguments private-
> keywords arguments)))))))
>
> (define* (rebar-build name inputs
> - #:key
> - guile source
> - (rebar-flags ''("skip_deps=true" "-vv"))
> - (tests? #t)
> - (test-target "eunit")
> - ;; TODO: install-name ; default: based on
> guix package name
> - (install-profile "default")
> - (phases '(@ (guix build rebar-build-system)
> - %standard-phases))
> - (outputs '("out"))
> - (search-paths '())
> - (native-search-paths '())
> - (system (%current-system))
> - (imported-modules %rebar-build-system-
> modules)
> - (modules '((guix build rebar-build-system)
> - (guix build utils))))
> + #:key
> + guile source
> + (rebar-flags ''("skip_deps=true" "-vv"))
> + (tests? #t)
> + (test-target "eunit")
> + ;; TODO: install-name ; default: based on
> guix package name
> + (install-profile "default")
> + (phases '(@ (guix build rebar-build-system)
> + %standard-phases))
> + (outputs '("out"))
> + (search-paths '())
> + (native-search-paths '())
> + (erlang-sources '())
> + (system (%current-system))
> + (imported-modules %rebar-build-system-modules)
> + (modules '((guix build rebar-build-system)
> + (guix build utils))))
> "Build SOURCE with INPUTS."
>
> (define builder
> @@ -123,21 +233,22 @@ (define* (rebar-build name inputs
>
> #$(with-build-variables inputs outputs
> #~(rebar-build #:source #+source
> - #:system #$system
> - #:name #$name
> - #:rebar-flags #$rebar-flags
> - #:tests? #$tests?
> - #:test-target #$test-target
> - ;; TODO: #:install-name #$install-name
> - #:install-profile #$install-profile
> - #:phases #$(if (pair? phases)
> - (sexp->gexp phases)
> - phases)
> - #:outputs %outputs
> - #:search-paths '#$(sexp->gexp
> - (map search-path-
> specification->sexp
> - search-paths))
> - #:inputs %build-inputs)))))
> + #:system #$system
> + #:name #$name
> + #:rebar-flags #$rebar-flags
> + #:tests? #$tests?
> + #:test-target #$test-target
> + ;; TODO: #:install-name #$install-name
> + #:install-profile #$install-profile
> + #:phases #$(if (pair? phases)
> + (sexp->gexp phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map search-path-
> specification->sexp
> + search-paths))
> + #:inputs %build-inputs
> + #:erlang-sources '#$erlang-sources)))))
>
> (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> system #:graft?
> #f)))
> diff --git a/guix/build/rebar-build-system.scm b/guix/build/rebar-
> build-system.scm
> index fb664228..286e4e1a 100644
> --- a/guix/build/rebar-build-system.scm
> +++ b/guix/build/rebar-build-system.scm
> @@ -28,6 +28,13 @@ (define-module (guix build rebar-build-system)
> #:export (rebar-build
> %standard-phases))
>
> +;;
> +;; Utils
> +;;
> +
> +(define sep file-name-separator-string)
How about no?
> +
> ;;
> ;; Builder-side code of the standard build procedure for Erlang
> packages using
> ;; rebar3.
> @@ -37,27 +44,20 @@ (define-module (guix build rebar-build-system)
>
> (define %erlang-libdir "/lib/erlang/lib")
>
> -(define* (erlang-depends #:key inputs #:allow-other-keys)
> - (define input-directories
> - (match inputs
> - (((_ . dir) ...)
> - dir)))
> - (mkdir-p "_checkouts")
> -
> - (for-each
> - (lambda (input-dir)
> - (let ((elibdir (string-append input-dir %erlang-libdir)))
> - (when (directory-exists? elibdir)
> - (for-each
> - (lambda (dirname)
> - (let ((dest (string-append elibdir "/" dirname))
> - (link (string-append "_checkouts/" dirname)))
> - (when (not (file-exists? link))
> - ;; RETHINK: Maybe better copy and make writable to
> avoid some
> - ;; error messages e.g. when using with rebar3-git-
> vsn.
> - (symlink dest link))))
> - (list-directories elibdir)))))
> - input-directories))
> +(define (configure-environment . _)
> + (setenv "REBAR_CACHE_DIR" (getcwd)))
How about simply naming this configure, so that you can use replace
instead of add-after + delete below?
> +(define* (erlang-depends #:key erlang-sources #:allow-other-keys)
> + (let ((checkouts "_checkouts"))
> + (mkdir-p checkouts)
> + (for-each (lambda (source)
> + (match source
> + ((name archive)
> + (let ((libdir (string-append checkouts sep
> name)))
Alternatively add a slash (/) to checkouts ;)
> + (mkdir-p libdir)
> + (with-directory-excursion libdir
> + (unpack #:source archive))))))
> + erlang-sources)))
This loses the previous erlang-depends logic, which unpackaged the
already compiled packages. I really don't think we should have erlang
be yet another rust that heats up the planet compiling leftpad over and
over again. Can we somehow have that cake?
> (define* (unpack #:key source #:allow-other-keys)
> "Unpack SOURCE in the working directory, and change directory
> within the
> @@ -134,6 +134,7 @@ (define* (install #:key name outputs
> (define %standard-phases
> (modify-phases gnu:%standard-phases
> (replace 'unpack unpack)
> + (add-after 'unpack 'configure-environment configure-environment)
> (delete 'bootstrap)
> (delete 'configure)
> (add-before 'build 'erlang-depends erlang-depends)
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 1/5] guix: build-system: rebar: build Erlang packages with dependencies.
2023-11-08 20:40 ` Liliana Marie Prikler
@ 2023-11-13 18:58 ` Pierre-Henry Fröhring
0 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-13 18:58 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
[-- Attachment #1.1: Type: text/plain, Size: 2004 bytes --]
This loses the previous erlang-depends logic, which unpackaged the
already compiled packages. I really don't think we should have
erlang be
yet another rust that heats up the planet compiling leftpad over and
over
again. Can we somehow have that cake?
Okay, perhaps it would have been better to start working on the Mix
building system
and inform you simultaneously, instead of sending patches all at once. So,
let's
start anew.
I have taken into account all of your suggestions and have crafted this
patch
introducing the mix-build-system. Yes, there are ChangeLogs now. Currently,
the
"Machete" package is compiled and tested without repeatedly compiling
leftpad — i.e.,
considering pure Elixir packages up to transitive dependencies, it works as
expected. This is new.
As I'm learning how all this works, I'm not entirely sure that updating the
rebar
build system is absolutely necessary. I suppose we will understand more as
we add an
increasing number of Elixir packages, especially when incorporating Elixir
packages
with Erlang dependencies.
So, here's what's coming up:
1. A patch that introduces the mix-build-system variable.
2. Several patches that introduce Elixir packages, up to elixir-machete,
which is one
of the few packages that includes tests in the tarball.
I guess the next steps are as follows:
1. To determine if the approach is acceptable. Will we boil the world by
compiling
left-pad endlessly?
2. If the approach is deemed acceptable, the next step is to evaluate the
code. Is
the code riddled with delicious regexes?
3. If the first two points are verified, it might be worthwhile to continue
developing this implementation until Phoenix is successfully compiled
and tested
as expected.
For reference, I have attached a file named `mix-build-system.org'.
This file contains a description of a prototype in Bash that
illustrates the approach taken in this patch.
Cheers.
[-- Attachment #1.2: Type: text/html, Size: 2218 bytes --]
[-- Attachment #2: mix-build-system.org --]
[-- Type: application/octet-stream, Size: 12495 bytes --]
# begin_properties
#+PROPERTY: header-args :noweb yes
# end_properties
#+TITLE: Mix build system
* Introduction
The aim is to introduce a ~mix build system~, a standardized method that enables Guix
to construct Elixir packages. Initially, we establish a Bash procedure for building
Elixir packages. We then explore the adaptation of this procedure to Guix.
* A procedure to build Elixir packages
The build procedure is divided into two steps: ~build_directory~ and
~compile_test_install~. These steps use arguments that mirror the project configuration
options outlined in [[https://hexdocs.pm/mix/1.14/Mix.Project.html][Mix.Project]].
#+begin_src bash
guix shell -D -f guix.scm -- bash build_directory \
--archive <filename> \
--build-per-environment <boolean> \
--log <boolean> \
--out <path> \
--deps-path <path> \
--test <boolean> \
--workdir <path>
guix shell -C -D -f guix.scm -- bash compile_test_install \
--archive <filename> \
--build-per-environment <boolean> \
--log <boolean> \
--out <path> \
--deps-path <path> \
--test <boolean> \
--workdir <path>
#+end_src
- ~archive~ refers to the name of the tarball to be retrieved from [[https://hex.pm/]], for example, ~phoenix-1.7.10.tar~.
- ~build-per-environment~ is a setting detailed in [[https://hexdocs.pm/mix/1.14/Mix.Project.html][Mix.Project]].
- ~log~ indicates whether the execution should be logged.
- ~test~ determines whether to run tests.
- ~out~ specifies the directory path where the package will be installed.
- ~deps~ is a configuration option explained in [[https://hexdocs.pm/mix/1.14/Mix.Project.html][Mix.Project]].
- ~workdir~ is either the absolute or relative path to the current directory where the build process will take place.
** Environment
:PROPERTIES:
:ID: 5f55ed2d-6301-460b-bc78-c4100e95e274
:END:
Except for ~tree~, all native inputs are necessary to execute the build
procedure. These inputs are listed in the ~native-inputs~ property of the package in
~guix.scm~.
#+caption: guix.scm
#+begin_src scheme :tangle guix.scm
(use-modules (guix build-system gnu)
(gnu packages)
(guix packages)
(gnu packages base)
(gnu packages elixir)
(gnu packages erlang)
(gnu packages admin))
(define glibc-utf8-locales
(make-glibc-utf8-locales glibc
#:locales (list "en_US")
#:name "glibc-utf8-locales"))
(package
(name "")
(version "")
(source #f)
(build-system gnu-build-system)
(native-inputs (list
glibc-utf8-locales
coreutils
which
elixir
erlang
rebar3
tree
))
(synopsis "")
(description "")
(home-page "")
(license #f))
#+end_src
** The ~build_directory~ Step
The ~build_directory~ step involves using the network to fetch any external data
required for compiling and testing the package. Each step of the script is detailed
in the following subsections.
#+name: build_directory
#+begin_src bash :shebang "#! /usr/bin/env bash" :tangle build_directory :exports none
<<script-conf>>
<<arguments>>
<<debug>>
<<workdir>>
<<env>>
<<hex>>
<<rebar3>>
<<archive>>
<<unpack>>
<<deps>>
<<show:0>>
#+end_src
*** The Bash script is configured
#+name: script-conf
#+begin_src bash
set -euo pipefail
IFS=$'\n\t'
#+end_src
*** Arguments
#+name: arguments
#+begin_src bash
DEPS_DIR="deps"
LOG="false"
BUILD_PER_ENVIRONMENT="true"
while [ "${1:-}" != "" ]; do
case "$1" in
--archive)
shift
ARCHIVE=$1
;;
--log)
shift
LOG=$1
;;
--build-per-environment)
shift
BUILD_PER_ENVIRONMENT=$1
;;
--out)
shift
OUT=$1
;;
--deps-path)
shift
DEPS_DIR=$1
;;
--test)
shift
TEST=$1
;;
--workdir)
shift
WORKDIR=$1
;;
,*)
echo "Invalid argument: $1"
exit 1
esac
shift
done
#+end_src
*** Debug mode
#+name: debug
#+begin_src bash
[[ $LOG == "true" ]] && set -x
#+end_src
*** Work directory
#+name: workdir
#+begin_src bash
mkdir -p $WORKDIR
cd $WORKDIR
#+end_src
*** Environment variables
#+name: env
#+begin_src bash :exports none
<<env:0>>
<<env:1>>
<<env:2>>
<<env:3>>
<<env:4>>
<<env:5>>
#+end_src
The current locale must be set to a ~UTF-8~ compatible format; otherwise, the Erlang VM
will emit a warning: "Warning: The VM is running with the native name encoding of
latin1, which may cause Elixir to malfunction, as it expects UTF-8. Please ensure
your locale is set to UTF-8 (which can be verified by running 'locale' in your
shell)."
#+name: env:0
#+begin_src bash
export LC_ALL=en_US.UTF-8
#+end_src
~mix~ expects to have access to a few local directories.
#+name: env:1
#+begin_src bash
export MIX_HOME=$PWD/mix-home
export MIX_ARCHIVES=$MIX_HOME/archives
mkdir -p "$MIX_ARCHIVES"
#+end_src
~mix~ expects to install dependencies sources in ~DEPS_DIR~.
#+name: env:2
#+begin_src bash
mkdir -p $DEPS_DIR
#+end_src
~mix~ installs compilations artifacts under the ~BUILD_DIR~ directory.
#+name: env:3
#+begin_src bash
export BUILD_DIR=_build
mkdir -p "$BUILD_DIR"
#+end_src
~mix~ expects to fetch tarballs from ~HEX_PM~.
#+name: env:4
#+begin_src bash
export HEX_PM=https://repo.hex.pm/tarballs
#+end_src
This procedure installs compilation artifacts under ~ELIXIR_LIB~. ~1.14~ is the version
number of the current Elixir used.
#+name: env:5
#+begin_src bash
export ELIXIR_LIB=lib/elixir/1.14
#+end_src
*** Hex is installed
Hex must be installed under ~MIX_ARCHIVES~; otherwise, ~mix~ will refuse to compile.
#+name: hex
#+begin_src bash
mix local.hex --force
[[ $LOG == "true" ]] && tree $MIX_HOME
#+end_src
*** Rebar3 is installed
Rebar3 must be installed under ~MIX_ARCHIVES~; otherwise, ~mix~ will refuse to compile if
Erlang dependencies are present.
#+name: rebar3
#+begin_src bash
mix local.rebar --force rebar3 $(which rebar3)
[[ $LOG == "true" ]] && tree $MIX_HOME
#+end_src
*** The archive is fetched
#+name: archive
#+begin_src bash
if [[ -f "../$ARCHIVE" ]]; then
cp "../$ARCHIVE" ./
else
wget $HEX_PM/$ARCHIVE >/dev/null
cp "$ARCHIVE" ../
fi
ls -al "$ARCHIVE"
#+end_src
*** The archive is unpacked
Sources are unpacked in the current directory.
#+name: unpack
#+begin_src bash
tar xf $ARCHIVE
tar xvf contents.tar.gz
#+end_src
*** Dependencies are installed
:PROPERTIES:
:ID: 9526e510-90cf-4595-bcad-4411ea822c23
:END:
#+name: deps
#+begin_src bash :exports none
<<deps:0>>
<<deps:1>>
<<deps:2>>
#+end_src
~MIX_ENVS~ represents all environments that should be considered for building and
testing the package.
#+name: deps:0
#+begin_src bash
if [[ "$BUILD_PER_ENVIRONMENT" == "true" ]]; then
MIX_ENVS=( "prod" )
if [[ $TEST == "true" ]]; then
MIX_ENVS+=( "test" )
fi
else
MIX_ENVS=( "shared" )
fi
#+end_src
then, for each ~MIX_ENV~, we get the dependencies and compile them. For each
environment ~MIX_ENV~, the result will be installed in ~_build/$MIX_ENV~.
#+name: deps:1
#+begin_src bash
for profile in ${MIX_ENVS[@]}; do
export MIX_ENV=$profile
mix deps.get --only $MIX_ENV
[[ $LOG == "true" ]] && tree $DEPS_DIR
mix deps.compile
[[ $LOG == "true" ]] && tree $BUILD_DIR
done
#+end_src
then, we remove the sources as we only need the compiled dependencies.
#+name: deps:2
#+begin_src bash
rm -rf $DEPS_DIR
#+end_src
*** What has been built is shown
#+name: show:0
#+begin_src bash
tree -L 3 ${BUILD_DIR}
tree -L 3 ${MIX_HOME}
#+end_src
** The ~compile_test_install~ step
The ~compile_test_install~ step compiles, tests, and installs the package within a
container.
#+name: compile_test_install
#+begin_src bash :shebang "#! /usr/bin/env bash" :tangle compile_test_install :exports none
<<script-conf>>
<<arguments>>
<<debug>>
<<workdir>>
<<env>>
<<test>>
<<compile>>
<<install>>
<<show:1>>
#+end_src
*** The package is tested
The compilation environment ~MIX_ENV~ is computed then the package is compiled,
installed in ~_build/$MIX_ENV~ and tested.
#+name: test
#+begin_src bash
if [[ "$TEST" == "true" ]]; then
if [[ "$BUILD_PER_ENVIRONMENT" == "true" ]]; then
export MIX_ENV=test
else
export MIX_ENV=shared
fi
TEST_DIR=$BUILD_DIR/$MIX_ENV
mix test --no-deps-check
[[ $LOG == "true" ]] && tree $TEST_DIR
fi
#+end_src
*** The package is built
The compilation environment ~MIX_ENV~ is computed then the package is compiled and
installed in ~_build/$MIX_ENV~.
#+name: compile
#+begin_src bash
if [[ "$BUILD_PER_ENVIRONMENT" == "true" ]]; then
export MIX_ENV=prod
else
export MIX_ENV=shared
fi
PROD_DIR=$BUILD_DIR/$MIX_ENV
mix compile --no-deps-check
[[ $LOG == "true" ]] && tree $PROD_DIR
#+end_src
*** The package is installed
The Elixir version number ~X.Y~ is computed and the built package is installed under
~$OUT/lib/elixir/X.Y/~.
#+name: install
#+begin_src bash
NAME="${ARCHIVE%%-*}"
INSTALL_DIR=$OUT/${ELIXIR_LIB}/${NAME}
mkdir -p $INSTALL_DIR
# …/* because we don't want to copy hidden files.
cp -vLrf $PROD_DIR/${ELIXIR_LIB%%/*}/${NAME}/* $INSTALL_DIR
#+end_src
*** What has been built is shown
#+name: show:1
#+begin_src bash
tree -L 3 $BUILD_DIR
tree -L 4 $OUT
#+end_src
* A few packages have been built
** ~makeup~
#+begin_src bash
WORKDIR=$PWD/workdir
INSTALLDIR=$WORKDIR/install
rm -rf $WORKDIR $INSTALLDIR
guix shell -D -f guix.scm -- bash build_directory \
--archive makeup-1.1.1.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test false \
--workdir $WORKDIR
guix shell -C -D -f guix.scm -- bash compile_test_install \
--archive makeup-1.1.1.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test false \
--workdir $WORKDIR
#+end_src
** ~machete~
#+begin_src bash
WORKDIR=$PWD/workdir
INSTALLDIR=$WORKDIR/install
rm -rf $WORKDIR $INSTALLDIR
guix shell -D -f guix.scm -- bash build_directory \
--archive machete-0.2.8.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test true \
--workdir $WORKDIR
guix shell -C -D -f guix.scm -- bash compile_test_install \
--archive machete-0.2.8.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test true \
--workdir $WORKDIR
#+end_src
** ~phoenix~
#+begin_src bash
WORKDIR=$PWD/workdir
INSTALLDIR=$WORKDIR/install
rm -rf $WORKDIR $INSTALLDIR
guix shell -D -f guix.scm -- bash build_directory \
--archive phoenix-1.7.10.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test false \
--workdir $WORKDIR
guix shell -C -D -f guix.scm -- bash compile_test_install \
--archive phoenix-1.7.10.tar \
--log true \
--out $INSTALLDIR \
--deps-path deps \
--test false \
--workdir $WORKDIR
#+end_src
* Adapting the procedure to Guix
The goal is to answer the question: given the above procedure, how to adapt it to
Guix? We examine each step and, when necessary, map it to Guix.
1) The build procedure should match the ~mix-build-system~ variable.
2) For all Elixir package, the ~native-inputs~ of ~guix.scm~ except ~tree~ should be in
default native-inputs.
3) The Elixir version number should be computed from the Elixir used to compile.
4) Arguments should be provided: ~#:tests?~, ~#:deps-path~, ~#:build-per-environment~.
5) A phase should install ~Hex~.
6) A phase should install ~Rebar3~.
7) The ~unpack~ phase should be adapted to tarballs and source checkouts.
8) All Erlang and Elixir packages should be deduced from all the inputs of the
package being built and installed in the necessary build directories to mimic the
[[id:9526e510-90cf-4595-bcad-4411ea822c23][Dependencies are installed]].
* Conclusion
A preliminary build procedure for Elixir packages, designed for integration into
Guix, has been presented. The issue of bit reproducibility within the build process
requires further investigation. If the current methodology is deemed satisfactory,
the subsequent step will be to implement this procedure in the Guix build system.
* Annex
** ~build_directory~
#+begin_src bash
<<build_directory>>
#+end_src
** ~compile_test_install~
#+begin_src bash
<<compile_test_install>>
#+end_src
# Local Variables:
# fill-column: 85
# End:
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 2/5] gnu: Add erlang-goldrush.
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 3/5] gnu: Add erlang-lager Pierre-Henry Fröhring
` (2 subsequent siblings)
4 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 2491 bytes --]
Change-Id: If978f3936375c9391f1655402a4504d708cfa67d
---
gnu/packages/erlang-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 gnu/packages/erlang-xyz.scm
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
new file mode 100644
index 00000000..082af121
--- /dev/null
+++ b/gnu/packages/erlang-xyz.scm
@@ -0,0 +1,55 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages erlang-xyz)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system rebar)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix hg-download)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages version-control)
+ #:use-module (srfi srfi-26))
+
+(define-public erlang-goldrush
+ (package
+ (name "erlang-goldrush")
+ (version "0.1.9")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1ssck5yr7rnrfwzm55pbyi1scgs1sl1xim75h5sj5czwrwl43jwr"))))
+ (build-system rebar-build-system)
+ (synopsis "Erlang event stream processor")
+ (description "Erlang event stream processor")
+ (home-page "https://hex.pm/packages/goldrush")
+ (license license:isc)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 3/5] gnu: Add erlang-lager.
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 2/5] gnu: Add erlang-goldrush Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 4/5] gnu: Add erlang-unicode-util-compat Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 5/5] gnu: Add erlang-idna Pierre-Henry Fröhring
4 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Iee1182644d57b7cca08afc6078102cc2409ede18
---
gnu/packages/erlang-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 082af121..4ed8099f 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -48,6 +48,25 @@ (define-public erlang-goldrush
(home-page "https://hex.pm/packages/goldrush")
(license license:isc)))
+(define-public erlang-lager
+ (package
+ (name "erlang-lager")
+ (version "3.9.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0a0c6kvc2jman62vrx2l3nx6xqn8s5l1glvf2mk7xjx8hyg4v43z"))))
+ (build-system rebar-build-system)
+ ;; XXX: tests fail.
+ (arguments (list #:tests? #f))
+ (propagated-inputs (list erlang-goldrush))
+ (synopsis "Erlang logging framework")
+ (description "Erlang logging framework")
+ (home-page "https://hexdocs.pm/lager/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 4/5] gnu: Add erlang-unicode-util-compat.
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-11-08 9:22 ` [bug#66801] [PATCH 3/5] gnu: Add erlang-lager Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 5/5] gnu: Add erlang-idna Pierre-Henry Fröhring
4 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: I15009c5dbe10c48bcdba9a143576122c877974b4
---
gnu/packages/erlang-xyz.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 4ed8099f..0c614542 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -67,6 +67,22 @@ (define-public erlang-lager
(home-page "https://hexdocs.pm/lager/")
(license license:asl2.0)))
+(define-public erlang-unicode-util-compat
+ (package
+ (name "erlang-unicode-util-compat")
+ (version "0.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "08952lw8cjdw8w171lv8wqbrxc4rcmb3jhkrdb7n06gngpbfdvi5"))))
+ (build-system rebar-build-system)
+ (synopsis "Unicode compatibility library for Erlang < 20")
+ (description "Unicode compatibility library for Erlang < 20.")
+ (home-page "https://hex.pm/packages/unicode_util_compat")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 5/5] gnu: Add erlang-idna.
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-11-08 9:22 ` [bug#66801] [PATCH 4/5] gnu: Add erlang-unicode-util-compat Pierre-Henry Fröhring
@ 2023-11-08 9:22 ` Pierre-Henry Fröhring
4 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-08 9:22 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring
Change-Id: Ie747409e9ef1f8a62ebefbc07131fef91e441a67
---
gnu/packages/erlang-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/erlang-xyz.scm b/gnu/packages/erlang-xyz.scm
index 0c614542..fb614505 100644
--- a/gnu/packages/erlang-xyz.scm
+++ b/gnu/packages/erlang-xyz.scm
@@ -83,6 +83,27 @@ (define-public erlang-unicode-util-compat
(home-page "https://hex.pm/packages/unicode_util_compat")
(license license:asl2.0)))
+(define-public erlang-idna
+ (package
+ (name "erlang-idna")
+ (version "6.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1sjcjibl34sprpf1dgdmzfww24xlyy34lpj7mhcys4j4i6vnwdwj"))))
+ (build-system rebar-build-system)
+ (propagated-inputs (list erlang-unicode-util-compat))
+ (synopsis
+ "Erlang Internationalized Domain Names in Applications (IDNA) protocol")
+ (description
+ "Library to register and look up IDNs in a way
+ that does not require changes to the DNS itself. IDNA is only meant for
+processing domain names, not free text. See: RFC 5891.")
+ (home-page "https://hexdocs.pm/idna/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
@ 2023-11-13 20:26 ` Pierre-Henry Fröhring
2023-11-13 21:22 ` Liliana Marie Prikler
2023-11-15 22:51 ` [bug#66801] [PATCH v3 " Pierre-Henry Fröhring
` (8 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-13 20:26 UTC (permalink / raw)
To: 66801; +Cc: liliana.prikler, Pierre-Henry Fröhring
* guix/build-system/mix.scm,
* guix/build/mix-build-system.scm: New modules.
Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
---
guix/build-system/mix.scm | 237 +++++++++++++++++++++++++
guix/build/mix-build-system.scm | 303 ++++++++++++++++++++++++++++++++
2 files changed, 540 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 00000000..ae4407c9
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,237 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages elixir)
+ #:use-module (gnu packages elixir-xyz)
+ #:use-module (gnu packages erlang)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ (string-append "https://repo.hex.pm/tarballs/"
+ (string-replace-substring (strip-elixir-prefix name) "-" "_")
+ "-" version ".tar"))
+
+(define glibc-utf8-locales
+ (make-glibc-utf8-locales glibc
+ #:locales (list "en_US")
+ #:name "glibc-utf8-locales"))
+
+(define (default-elixir)
+ "Return the default Elixir package."
+ ;; Lazily resolve the binding to avoid a circular dependency.
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define imported-modules
+ `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+
+(define modules
+ '((guix build mix-build-system)
+ (guix build utils)))
+
+;; The prefix of Elixir packages.
+(define %elixir-prefix "elixir-")
+
+;; The prefix of Erlang packages.
+(define %erlang-prefix "erlang-")
+
+(define (erlang-package? package)
+ "Tell whether PACKAGE is an Erlang package."
+ (string-prefix? %erlang-prefix (package-name package)))
+
+(define (elixir-package? package)
+ "Tell whether PACKAGE is an Elixir package."
+ (string-prefix? %elixir-prefix (package-name package)))
+
+(define (erlang-or-elixir-pkg? package)
+ "Tell whether PACKAGE is an Elixir or an Erlang package."
+ (or (erlang-package? package)
+ (elixir-package? package)))
+
+(define (erlang-or-elixir-input? input)
+ "Tell whether INPUT is an Elixir or an Erlang input."
+ (match input
+ ((_ package)
+ (erlang-or-elixir-pkg? package))))
+
+(define (input=? input1 input2)
+ "Tell whether inputs INPUT1 and INPUT2 are equal."
+ (define pkg1 (match input1 ((_ pkg) pkg)))
+ (define pkg2 (match input2 ((_ pkg) pkg)))
+ (string=? (package-name pkg1) (package-name pkg2)))
+
+;; A number of environment variables specific to the Mix build system are reflected here.
+;; They are documented here: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
+;; Other parameters located in mix.exs are defined here:
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ elixir-X.Y ;The major and minor of Elixir.
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules imported-modules)
+ (modules modules))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:elixir-X.Y #$elixir-X.Y
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ source
+ (inputs '())
+ (tests? #t)
+ (native-inputs '())
+ (propagated-inputs '())
+ outputs
+ system
+ target
+ (elixir (default-elixir))
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (define private-keywords
+ '(#:inputs #:native-inputs #:outputs #:system #:target #:elixir))
+
+ ;; Libraries are compiled using a given version of Elixir. This fact is
+ ;; encoded by the name of a sub-directory like lib/elixir/X.Y. We compute
+ ;; the value of X.Y here which is valid for the whole build.
+ (define elixir-X.Y (version-major+minor (package-version elixir)))
+
+ ;; Elixir depends on a specific version of Erlang, this one.
+ (define erlang (lookup-package-input elixir "erlang"))
+
+ ;; For mix to compile and test a package, it needs to find all inputs,
+ ;; native-inputs and propagated-inputs (including the transitive ones) under
+ ;; _build directories like _build/prod/lib.
+ ;;
+ ;; Given inputs and native-inputs of the package, we need to compute the
+ ;; transitive closure of all Erlang and Elixir propagated inputs and add
+ ;; them to the build inputs.
+ (define all-propagated-inputs
+ ((compose
+ (cut delete-duplicates <> input=?)
+ (cut filter erlang-or-elixir-input? <>)
+ (cut append-map package-transitive-propagated-inputs <>)
+ (cut map cadr <>))
+ (append inputs native-inputs)))
+
+ (define build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,erlang)
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@all-propagated-inputs
+ ,@inputs
+ ,@native-inputs))
+
+ ;; Some inputs, such as C programs, may be architecture dependent.
+ (define host-inputs (if target inputs '()))
+
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs host-inputs)
+ (outputs outputs)
+ (build mix-build)
+ (arguments (append `(#:elixir-X.Y ,elixir-X.Y)
+ (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 00000000..86a5db51
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,303 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build
+ strip-elixir-prefix
+ %standard-phases))
+
+(define (f-join . paths)
+ "Return a path (a string) formed from joining each component in PATHS (list of strings).
+Example: \"a\" \"b\" \"c\" → \"a/b/c\""
+ (string-join paths file-name-separator-string))
+
+(define (strip-prefix prefix name)
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+;; All Elixir package names start with this prefix. If a package name starts
+;; with this prefix, then it is an Elixir package.
+(define %elixir-prefix "elixir-")
+
+(define (path->elixir-lib path X.Y)
+ "Return the path to the directory within PATH where libraries of an Elixir
+package are installed. Here, X.Y represents the major and minor version
+numbers of Elixir used for compilation."
+ (f-join path "lib" "elixir" X.Y))
+
+(define (elixir-name? name)
+ "Determines if NAME is the name or the label associated to an Elixir
+package."
+ (string-prefix? %elixir-prefix name))
+
+(define (elixir-input? X.Y input)
+ "Determines if the given INPUT is an Elixir input."
+ (match input
+ ((label . path)
+ ;; XXX: The second condition may be enough.
+ (and (elixir-name? label)
+ (directory-exists? (path->elixir-lib path X.Y))))))
+
+(define (strip-elixir-prefix name)
+ "Strip %elixir-prefix from NAME."
+ (strip-prefix %elixir-prefix name))
+
+;; All Erlang package names start with this prefix. If a package name starts
+;; with this prefix, then it is an Erlang package.
+(define %erlang-prefix "erlang-")
+
+(define (path->erlang-lib path)
+ "Return the path of the directory where libraries of an Erlang package are
+installed in the store."
+ (f-join path "lib" "erlang" "lib"))
+
+(define (erlang-name? name)
+ "Determines if NAME is the name or the label associated to an Erlang
+package."
+ (string-prefix? %erlang-prefix name))
+
+(define (erlang-input? input)
+ "Determines if the given INPUT is an Erlang input."
+ (match input
+ ((label . path)
+ ;; XXX: one condition may be enough. Without the first one, the erlang
+ ;; input is considered an input when we just want Erlang packages.
+ (and (erlang-name? label)
+ (directory-exists? (path->erlang-lib path))))))
+
+(define (strip-erlang-prefix name)
+ "Strip %erlang-prefix from NAME."
+ (strip-prefix %erlang-prefix name))
+
+(define (erlang-or-elixir-input? X.Y input)
+ "Determines if the given INPUT is an Erlang or Elixir input."
+ (or (erlang-input? input)
+ (elixir-input? X.Y input)))
+
+(define (snakecase-name name)
+ "Return a snakecase version of NAME."
+ (string-replace-substring (string-downcase name) "-" "_"))
+
+(define (label->library-name label)
+ "Return the library name associated to an input label LABEL."
+ (define stripped-label
+ (cond
+ ((erlang-name? label)
+ (strip-erlang-prefix label))
+ ((elixir-name? label)
+ (strip-elixir-prefix label))
+ (#t (error "Invalid label: expected an Erlang or Elixir label." 'label label))))
+ (snakecase-name stripped-label))
+
+(define (pkg-name->library-name name)
+ "Return the name of the library deduced from the name of the Guix package.
+Example: elixir-a-pkg-1.0.2 → a_pkg
+See: https://www.erlang.org/doc/man/code#code-path"
+ ((compose
+ label->library-name
+ (cut string-join <> "-")
+ (cut drop-right <> 1)
+ (cut string-split <> #\-))
+ name))
+
+;; We fix as many variables as possible.
+;; See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables
+(define MIX_HOME "MIX_HOME")
+
+(define MIX_ARCHIVES "MIX_ARCHIVES")
+(define (%mix-archives mix-home) (f-join mix-home "archives"))
+(define MIX_BUILD_ROOT "MIX_BUILD_ROOT")
+(define %mix-build-root "_build")
+(define MIX_DEPS_PATH "MIX_DEPS_PATH")
+(define %mix-deps-path "deps")
+(define MIX_PATH "MIX_PATH")
+(define MIX_REBAR3 "MIX_REBAR3")
+(define MIX_EXS "MIX_EXS")
+(define %mix-exs "mix.exs")
+;; XXX: if different architecture are needed, then use this variable.
+(define MIX_TARGET "MIX_TARGET")
+(define MIX_ENV "MIX_ENV")
+(define %mix-env-prod "prod")
+(define %mix-env-test "test")
+(define %mix-env-shared "shared")
+
+;; The name of the directory where compiled libraries by mix are stored.
+(define %mix-lib "lib")
+
+;; Useful because Elixir expects a UTF-8 locale.
+(define LC_ALL "LC_ALL")
+
+(define (mix-build-dir mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory."
+ (f-join %mix-build-root mix-env %mix-lib))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (let ((contents "contents.tar.gz"))
+ (when (file-exists? contents)
+ (invoke "tar" "xvf" contents)))))
+
+(define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables."
+ (setenv LC_ALL "en_US.UTF-8")
+ (setenv MIX_HOME (getcwd))
+ (setenv MIX_ARCHIVES (%mix-archives (getenv MIX_HOME)))
+ (setenv MIX_BUILD_ROOT %mix-build-root)
+ (setenv MIX_DEPS_PATH %mix-deps-path)
+ (setenv MIX_PATH (or mix-path ""))
+ (setenv MIX_REBAR3 (f-join (assoc-ref inputs "rebar3") "bin" "rebar3"))
+ (setenv MIX_EXS mix-exs))
+
+(define* (install-hex #:key inputs name elixir-X.Y #:allow-other-keys)
+ "Install Hex."
+ (define hex-name "hex")
+ (define hex-path (assoc-ref inputs "elixir-hex"))
+ (define hex-lib (f-join (path->elixir-lib hex-path elixir-X.Y) hex-name))
+ (define hex-archive-path (f-join (getenv MIX_ARCHIVES) hex-name))
+ (mkdir-p hex-archive-path)
+ (symlink hex-lib (f-join hex-archive-path hex-name)))
+
+(define* (install-dependencies #:key
+ name
+ tests?
+ build-per-environment
+ (inputs '())
+ (native-inputs '())
+ elixir-X.Y
+ mix-environments
+ #:allow-other-keys
+ #:rest rest)
+ "Install dependencies.
+Given an environment mix-env, we define all-inputs(mix-env) as the set of all
+necessary Erlang and Elixir inputs and associated propagated inputs (and
+transitive propagated inputs).
+
+For example, all-inputs(prod) represents all the Erlang and Elixir inputs and
+propagated inputs necessary to compile the Mix project for the prod
+environment.
+
+If dep belongs to all-inputs(mix-env) and its library name is dep-name, then
+it is installed under (f-join (mix-build-dir mix-env) dep-name) as a symbolic
+link."
+ (define (all-inputs mix-env)
+ (define env-inputs
+ (cond
+ ((string=? mix-env %mix-env-prod)
+ inputs)
+ ((member mix-env (list %mix-env-test %mix-env-shared))
+ (append inputs native-inputs))
+ (#t (error "Unexpected Mix environment." 'mix-env mix-env))))
+ (filter (cut erlang-or-elixir-input? elixir-X.Y <>) env-inputs))
+
+ (define (install-input mix-env input)
+ (let ((dir (mix-build-dir mix-env)))
+ (mkdir-p dir)
+ (match input
+ ((label . path)
+ (let ((lib-name (label->library-name label)))
+ (symlink
+ (f-join (path->elixir-lib path elixir-X.Y) lib-name)
+ (f-join dir lib-name)))))))
+
+ (define (install-inputs mix-env)
+ (for-each (cut install-input mix-env <>)
+ (all-inputs mix-env)))
+
+ (for-each install-inputs mix-environments))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (define (compile mix-env)
+ (setenv MIX_ENV mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ (for-each compile mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (define mix-dirs
+ (find-files "."
+ (file-name-predicate "\\.mix$")
+ #:directories? #t))
+ (for-each delete-file-recursively mix-dirs))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ elixir-X.Y
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (define lib-name (pkg-name->library-name name))
+
+ (define dir-build
+ (f-join (mix-build-dir (if build-per-environment %mix-env-prod %mix-env-shared))
+ lib-name))
+
+ (define dir-install
+ (f-join (path->elixir-lib (assoc-ref outputs "out") elixir-X.Y)
+ lib-name))
+ (mkdir-p dir-install)
+
+ (copy-recursively dir-build dir-install
+ #:follow-symlinks? #t))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (replace 'configure configure)
+ (replace 'unpack unpack)
+ (add-after 'patch-generated-file-shebangs 'install-hex install-hex)
+ (add-after 'install-hex 'install-dependencies install-dependencies)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-13 20:26 ` [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-11-13 21:22 ` Liliana Marie Prikler
2023-11-14 10:37 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-13 21:22 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Montag, dem 13.11.2023 um 21:26 +0100 schrieb Pierre-Henry Fröhring:
> * guix/build-system/mix.scm,
> * guix/build/mix-build-system.scm: New modules.
>
> Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
> ---
> guix/build-system/mix.scm | 237 +++++++++++++++++++++++++
> guix/build/mix-build-system.scm | 303
> ++++++++++++++++++++++++++++++++
> 2 files changed, 540 insertions(+)
> create mode 100644 guix/build-system/mix.scm
> create mode 100644 guix/build/mix-build-system.scm
>
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> new file mode 100644
> index 00000000..ae4407c9
> --- /dev/null
> +++ b/guix/build-system/mix.scm
> @@ -0,0 +1,237 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Standard build procedure for Elixir packages using 'mix'. This
> is
> +;; implemented as an extension of 'gnu-build-system'.
> +;;
> +;; Code:
> +
> +(define-module (guix build-system mix)
> + #:use-module (gnu packages base)
> + #:use-module (gnu packages elixir)
> + #:use-module (gnu packages elixir-xyz)
> + #:use-module (gnu packages erlang)
You probably want to resolve those imports rather than use-modules
them.
> + #:use-module (guix build mix-build-system)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> + #:use-module (guix gexp)
> + #:use-module (guix monads)
> + #:use-module (guix packages)
> + #:use-module (guix search-paths)
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (ice-9 match)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build-system hexpm-uri))
> +
> +(define (hexpm-uri name version)
> + "Return the URI where to fetch the sources of a Hex package NAME
> at VERSION.
> +See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
> + (string-append "https://repo.hex.pm/tarballs/"
> + (string-replace-substring (strip-elixir-prefix
> name) "-" "_")
> + "-" version ".tar"))
> +
> +(define glibc-utf8-locales
> + (make-glibc-utf8-locales glibc
> + #:locales (list "en_US")
> + #:name "glibc-utf8-locales"))
> +
> +(define (default-elixir)
> + "Return the default Elixir package."
> + ;; Lazily resolve the binding to avoid a circular dependency.
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir)))
> +
> +(define imported-modules
> + `((guix build mix-build-system)
> + ,@%gnu-build-system-modules))
> +
> +(define modules
> + '((guix build mix-build-system)
> + (guix build utils)))
> +
> +;; The prefix of Elixir packages.
> +(define %elixir-prefix "elixir-")
> +
> +;; The prefix of Erlang packages.
> +(define %erlang-prefix "erlang-")
> +
> +(define (erlang-package? package)
> + "Tell whether PACKAGE is an Erlang package."
> + (string-prefix? %erlang-prefix (package-name package)))
> +
> +(define (elixir-package? package)
> + "Tell whether PACKAGE is an Elixir package."
> + (string-prefix? %elixir-prefix (package-name package)))
> +
> +(define (erlang-or-elixir-pkg? package)
> + "Tell whether PACKAGE is an Elixir or an Erlang package."
> + (or (erlang-package? package)
> + (elixir-package? package)))
You can simplify these five variables into one to three (three being
quite many already depending on whether you'll actually use the smaller
ones).
> +(define (erlang-or-elixir-input? input)
> + "Tell whether INPUT is an Elixir or an Erlang input."
> + (match input
> + ((_ package)
> + (erlang-or-elixir-pkg? package))))
Skip.
> +(define (input=? input1 input2)
> + "Tell whether inputs INPUT1 and INPUT2 are equal."
> + (define pkg1 (match input1 ((_ pkg) pkg)))
> + (define pkg2 (match input2 ((_ pkg) pkg)))
> + (string=? (package-name pkg1) (package-name pkg2)))
Again, checking for label equivalence is a bad idea.
> +;; A number of environment variables specific to the Mix build
> system are reflected here.
> +;; They are documented here:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
> +;; Other parameters located in mix.exs are defined here:
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
> +(define* (mix-build name
> + inputs
> + #:key
> + source
> + elixir-X.Y ;The major and minor of Elixir.
> + (tests? #t)
> + (mix-path #f) ;See MIX_PATH.
> + (mix-exs "mix.exs") ;See MIX_EXS.
> + (build-per-environment #t) ;See
> :build_per_environment.
> + (phases '%standard-phases)
> + (outputs '("out"))
> + (search-paths '())
> + (system (%current-system))
> + (guile #f)
> + (imported-modules imported-modules)
> + (modules modules))
> + "Build SOURCE using Elixir, and with INPUTS."
> +
> + ;; Check the documentation of :build_per_environment here:
> + ;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration A
> nd
> + ;; "Environments" here:
> + ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
> + (define mix-environments
> + (if build-per-environment
> + `("prod" ,@(if tests? '("test") '()))
> + '("shared")))
> +
> + (define builder
> + (with-imported-modules imported-modules
> + #~(begin
> +
> + (use-modules #$@(sexp->gexp modules))
> +
> + #$(with-build-variables inputs outputs
> + #~(mix-build #:name #$name
> + #:source #+source
> + #:system #$system
> + #:tests? #$tests?
> + #:mix-path #$mix-path
> + #:mix-exs #$mix-exs
> + #:elixir-X.Y #$elixir-X.Y
> + #:mix-environments '#$mix-environments
> + #:build-per-environment #$build-per-
> environment
> + #:phases #$(if (pair? phases)
> + (sexp->gexp phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map
> + search-path-
> specification->sexp
> + search-paths))
> + #:inputs
> + %build-inputs)))))
> +
> + (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> + system
> + #:graft? #f)))
> + (gexp->derivation name
> + builder
> + #:system system
> + #:graft? #f ;consistent with 'gnu-build'
> + #:target #f
> + #:guile-for-build guile)))
> +
> +(define* (lower name
> + #:key
> + source
> + (inputs '())
> + (tests? #t)
> + (native-inputs '())
> + (propagated-inputs '())
> + outputs
> + system
> + target
> + (elixir (default-elixir))
> + #:allow-other-keys #:rest arguments)
> + "Return a bag for NAME."
> + (define private-keywords
> + '(#:inputs #:native-inputs #:outputs #:system #:target
> #:elixir))
> +
> + ;; Libraries are compiled using a given version of Elixir. This
> fact is
> + ;; encoded by the name of a sub-directory like lib/elixir/X.Y. We
> compute
> + ;; the value of X.Y here which is valid for the whole build.
> + (define elixir-X.Y (version-major+minor (package-version elixir)))
> +
> + ;; Elixir depends on a specific version of Erlang, this one.
> + (define erlang (lookup-package-input elixir "erlang"))
> +
> + ;; For mix to compile and test a package, it needs to find all
> inputs,
> + ;; native-inputs and propagated-inputs (including the transitive
> ones) under
> + ;; _build directories like _build/prod/lib.
> + ;;
> + ;; Given inputs and native-inputs of the package, we need to
> compute the
> + ;; transitive closure of all Erlang and Elixir propagated inputs
> and add
> + ;; them to the build inputs.
> + (define all-propagated-inputs
> + ((compose
> + (cut delete-duplicates <> input=?)
> + (cut filter erlang-or-elixir-input? <>)
> + (cut append-map package-transitive-propagated-inputs <>)
> + (cut map cadr <>))
> + (append inputs native-inputs)))
> +
> + (define build-inputs
> + `(,@(standard-packages)
> + ("glibc-utf8-locales" ,glibc-utf8-locales)
> + ("erlang" ,erlang)
> + ("rebar3" ,rebar3)
> + ("elixir" ,elixir)
> + ("elixir-hex" ,elixir-hex)
> + ,@all-propagated-inputs
> + ,@inputs
> + ,@native-inputs))
> +
> + ;; Some inputs, such as C programs, may be architecture dependent.
> + (define host-inputs (if target inputs '()))
> +
> + (bag (name name)
> + (system system)
> + (build-inputs build-inputs)
> + (host-inputs host-inputs)
> + (outputs outputs)
> + (build mix-build)
> + (arguments (append `(#:elixir-X.Y ,elixir-X.Y)
> + (strip-keyword-arguments private-keywords
> arguments)))))
> +
> +(define mix-build-system
> + (build-system (name 'mix)
> + (description "The standard Mix build system")
> + (lower lower)))
> +
> +;;; mix.scm ends here
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> new file mode 100644
> index 00000000..86a5db51
> --- /dev/null
> +++ b/guix/build/mix-build-system.scm
> @@ -0,0 +1,303 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Code:
> +
> +(define-module (guix build mix-build-system)
> + #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> + #:use-module (guix build utils)
> + #:use-module (ice-9 ftw)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 regex)
> + #:use-module (ice-9 string-fun)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build
> + strip-elixir-prefix
> + %standard-phases))
> +
> +(define (f-join . paths)
> + "Return a path (a string) formed from joining each component in
> PATHS (list of strings).
> +Example: \"a\" \"b\" \"c\" → \"a/b/c\""
> + (string-join paths file-name-separator-string))
It is wiser to write these out as regular string-appends.
> +(define (strip-prefix prefix name)
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
I'm pretty sure we have a function looking like this somewhere, but I
can't recall its name atm.
> +;; All Elixir package names start with this prefix. If a package
> name starts
> +;; with this prefix, then it is an Elixir package.
> +(define %elixir-prefix "elixir-")
Useless magic constant.
> +
> +(define (path->elixir-lib path X.Y)
> + "Return the path to the directory within PATH where libraries of
> an Elixir
> +package are installed. Here, X.Y represents the major and minor
> version
> +numbers of Elixir used for compilation."
> + (f-join path "lib" "elixir" X.Y))
Is path itself ever useful here or does it simply point to the store?
This can likely be simplified to
(define (elixir-lib version)
(string-append "/lib/elixir/" version))
> +(define (elixir-name? name)
> + "Determines if NAME is the name or the label associated to an
> Elixir
> +package."
> + (string-prefix? %elixir-prefix name))
Useless use of magic constant.
> +
> +(define (elixir-input? X.Y input)
> + "Determines if the given INPUT is an Elixir input."
> + (match input
> + ((label . path)
> + ;; XXX: The second condition may be enough.
> + (and (elixir-name? label)
> + (directory-exists? (path->elixir-lib path X.Y))))))
Ahem, search-path-as-list.
Also, leaking the version is kinda bad, API-wise.
> +(define (strip-elixir-prefix name)
> + "Strip %elixir-prefix from NAME."
> + (strip-prefix %elixir-prefix name))
>
> +;; All Erlang package names start with this prefix. If a package
> name starts
> +;; with this prefix, then it is an Erlang package.
> +(define %erlang-prefix "erlang-")
> +
> +(define (path->erlang-lib path)
> + "Return the path of the directory where libraries of an Erlang
> package are
> +installed in the store."
> + (f-join path "lib" "erlang" "lib"))
> +
> +(define (erlang-name? name)
> + "Determines if NAME is the name or the label associated to an
> Erlang
> +package."
> + (string-prefix? %erlang-prefix name))
> +
> +(define (erlang-input? input)
> + "Determines if the given INPUT is an Erlang input."
> + (match input
> + ((label . path)
> + ;; XXX: one condition may be enough. Without the first one, the
> erlang
> + ;; input is considered an input when we just want Erlang
> packages.
> + (and (erlang-name? label)
> + (directory-exists? (path->erlang-lib path))))))
> +
> +(define (strip-erlang-prefix name)
> + "Strip %erlang-prefix from NAME."
> + (strip-prefix %erlang-prefix name))
Duplicated boilerplate for neither fun nor profit.
> +(define (erlang-or-elixir-input? X.Y input)
> + "Determines if the given INPUT is an Erlang or Elixir input."
> + (or (erlang-input? input)
> + (elixir-input? X.Y input)))
Leak, leak, leak.
> +
> +(define (snakecase-name name)
> + "Return a snakecase version of NAME."
> + (string-replace-substring (string-downcase name) "-" "_"))
> +
> +(define (label->library-name label)
> + "Return the library name associated to an input label LABEL."
> + (define stripped-label
> + (cond
> + ((erlang-name? label)
> + (strip-erlang-prefix label))
> + ((elixir-name? label)
> + (strip-elixir-prefix label))
> + (#t (error "Invalid label: expected an Erlang or Elixir label."
> 'label label))))
> + (snakecase-name stripped-label))
Don't rely on labels.
> +(define (pkg-name->library-name name)
> + "Return the name of the library deduced from the name of the Guix
> package.
> +Example: elixir-a-pkg-1.0.2 → a_pkg
> +See: https://www.erlang.org/doc/man/code#code-path"
> + ((compose
> + label->library-name
> + (cut string-join <> "-")
> + (cut drop-right <> 1)
> + (cut string-split <> #\-))
> + name))
> +
> +;; We fix as many variables as possible.
> +;; See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables
> +(define MIX_HOME "MIX_HOME")
> +
> +(define MIX_ARCHIVES "MIX_ARCHIVES")
> +(define (%mix-archives mix-home) (f-join mix-home "archives"))
> +(define MIX_BUILD_ROOT "MIX_BUILD_ROOT")
> +(define %mix-build-root "_build")
> +(define MIX_DEPS_PATH "MIX_DEPS_PATH")
> +(define %mix-deps-path "deps")
> +(define MIX_PATH "MIX_PATH")
> +(define MIX_REBAR3 "MIX_REBAR3")
> +(define MIX_EXS "MIX_EXS")
> +(define %mix-exs "mix.exs")
> +;; XXX: if different architecture are needed, then use this
> variable.
> +(define MIX_TARGET "MIX_TARGET")
> +(define MIX_ENV "MIX_ENV")
> +(define %mix-env-prod "prod")
> +(define %mix-env-test "test")
> +(define %mix-env-shared "shared")
Gratuitous definitions are gratuitous.
> +;; The name of the directory where compiled libraries by mix are
> stored.
> +(define %mix-lib "lib")
> +
> +;; Useful because Elixir expects a UTF-8 locale.
> +(define LC_ALL "LC_ALL")
> +
> +(define (mix-build-dir mix-env)
> + "Return the directory where build artifacts are to be installed
> according to
> +en environment MIX-ENV in the current directory."
> + (f-join %mix-build-root mix-env %mix-lib))
> +
> +(define* (unpack #:key source mix-path #:allow-other-keys)
> + "Unpack SOURCE in the working directory, and change directory
> within the
> +source. When SOURCE is a directory, copy it in a sub-directory of
> the current
> +working directory."
> + (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> + (gnu-unpack #:source source)
> + (let ((contents "contents.tar.gz"))
> + (when (file-exists? contents)
> + (invoke "tar" "xvf" contents)))))
> +
> +(define* (configure #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables."
> + (setenv LC_ALL "en_US.UTF-8")
> + (setenv MIX_HOME (getcwd))
> + (setenv MIX_ARCHIVES (%mix-archives (getenv MIX_HOME)))
> + (setenv MIX_BUILD_ROOT %mix-build-root)
> + (setenv MIX_DEPS_PATH %mix-deps-path)
> + (setenv MIX_PATH (or mix-path ""))
> + (setenv MIX_REBAR3 (f-join (assoc-ref inputs "rebar3") "bin"
> "rebar3"))
> + (setenv MIX_EXS mix-exs))
> +
> +(define* (install-hex #:key inputs name elixir-X.Y #:allow-other-
> keys)
> + "Install Hex."
> + (define hex-name "hex")
> + (define hex-path (assoc-ref inputs "elixir-hex"))
> + (define hex-lib (f-join (path->elixir-lib hex-path elixir-X.Y)
> hex-name))
> + (define hex-archive-path (f-join (getenv MIX_ARCHIVES) hex-name))
> + (mkdir-p hex-archive-path)
> + (symlink hex-lib (f-join hex-archive-path hex-name)))
> +
> +(define* (install-dependencies #:key
> + name
> + tests?
> + build-per-environment
> + (inputs '())
> + (native-inputs '())
> + elixir-X.Y
> + mix-environments
> + #:allow-other-keys
> + #:rest rest)
> + "Install dependencies.
> +Given an environment mix-env, we define all-inputs(mix-env) as the
> set of all
> +necessary Erlang and Elixir inputs and associated propagated inputs
> (and
> +transitive propagated inputs).
> +
> +For example, all-inputs(prod) represents all the Erlang and Elixir
> inputs and
> +propagated inputs necessary to compile the Mix project for the prod
> +environment.
> +
> +If dep belongs to all-inputs(mix-env) and its library name is dep-
> name, then
> +it is installed under (f-join (mix-build-dir mix-env) dep-name) as a
> symbolic
> +link."
The docstring divulges implementation details without really explaining
what the function itself does.
> + (define (all-inputs mix-env)
> + (define env-inputs
> + (cond
> + ((string=? mix-env %mix-env-prod)
> + inputs)
> + ((member mix-env (list %mix-env-test %mix-env-shared))
> + (append inputs native-inputs))
> + (#t (error "Unexpected Mix environment." 'mix-env mix-env))))
You probably want and ice-9 match here, which has an implicit error on
failed matches.
> + (filter (cut erlang-or-elixir-input? elixir-X.Y <>) env-inputs))
> +
> + (define (install-input mix-env input)
> + (let ((dir (mix-build-dir mix-env)))
> + (mkdir-p dir)
> + (match input
> + ((label . path)
> + (let ((lib-name (label->library-name label)))
> + (symlink
> + (f-join (path->elixir-lib path elixir-X.Y) lib-name)
> + (f-join dir lib-name)))))))
> +
> + (define (install-inputs mix-env)
> + (for-each (cut install-input mix-env <>)
> + (all-inputs mix-env)))
> +
> + (for-each install-inputs mix-environments))
> +
> +(define* (build #:key mix-environments #:allow-other-keys)
> + "Builds the Mix project."
> + (define (compile mix-env)
> + (setenv MIX_ENV mix-env)
> + (invoke "mix" "compile" "--no-deps-check"))
> + (for-each compile mix-environments))
> +
> +(define* (check #:key (tests? #t) #:allow-other-keys)
> + "Test the Mix project."
> + (if tests?
> + (invoke "mix" "test" "--no-deps-check")
> + (format #t "tests? = ~a~%" tests?)))
> +
> +(define* (remove-mix-dirs . _)
> + "Remove all .mix/ directories.
> +We do not want to copy them to the installation directory."
> + (define mix-dirs
> + (find-files "."
> + (file-name-predicate "\\.mix$")
> + #:directories? #t))
> + (for-each delete-file-recursively mix-dirs))
> +
> +(define* (install #:key
> + inputs
> + outputs
> + name
> + build-per-environment
> + elixir-X.Y
> + #:allow-other-keys)
> + "Install build artifacts in the store."
> + (define lib-name (pkg-name->library-name name))
> +
> + (define dir-build
> + (f-join (mix-build-dir (if build-per-environment %mix-env-prod
> %mix-env-shared))
> + lib-name))
> +
> + (define dir-install
> + (f-join (path->elixir-lib (assoc-ref outputs "out") elixir-X.Y)
> + lib-name))
> + (mkdir-p dir-install)
> +
> + (copy-recursively dir-build dir-install
> + #:follow-symlinks? #t))
> +
> +(define %standard-phases
> + (modify-phases gnu:%standard-phases
> + (delete 'bootstrap)
> + (replace 'configure configure)
> + (replace 'unpack unpack)
> + (add-after 'patch-generated-file-shebangs 'install-hex install-
> hex)
> + (add-after 'install-hex 'install-dependencies install-
> dependencies)
> + (replace 'build build)
> + (replace 'check check)
> + (add-before 'install 'remove-mix-dirs remove-mix-dirs)
> + (replace 'install install)))
> +
> +(define* (mix-build #:key inputs (phases %standard-phases)
> + #:allow-other-keys #:rest args)
> + "Build the given Mix package, applying all of PHASES in order."
> + (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; mix-build-system.scm ends here
>
> base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
I probably missed some, but I think you get the gist. While this isn't
exactly code golf, try to express yourself in terms of the least
verbose primitives and don't add meaningless layers of indirection – we
already have enough actual meaningful ones.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-13 21:22 ` Liliana Marie Prikler
@ 2023-11-14 10:37 ` Pierre-Henry Fröhring
2023-11-14 17:53 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-14 10:37 UTC (permalink / raw)
To: 66801; +Cc: Liliana Marie Prikler
[-- Attachment #1: Type: text/plain, Size: 1964 bytes --]
> > +(define-module (guix build-system mix)
> > + #:use-module (gnu packages base)
> > + #:use-module (gnu packages elixir)
> > + #:use-module (gnu packages elixir-xyz)
> > + #:use-module (gnu packages erlang)
> You probably want to resolve those imports rather than use-modules
> them.
You mean something like this?
#+begin_src scheme
(define-module (guix build-system mix)
#:use-module ((gnu packages base) #:select (glibc
make-glibc-utf8-locales))
#:use-module ((gnu packages elixir) #:select (elixir elixir-hex))
#:use-module ((gnu packages erlang) #:select (rebar3))
#+end_src
I have moved `elixir-hex' to elixir.scm to avoid a circular dependency.
> > +(define (input=? input1 input2)
> > + "Tell whether inputs INPUT1 and INPUT2 are equal."
> > + (define pkg1 (match input1 ((_ pkg) pkg)))
> > + (define pkg2 (match input2 ((_ pkg) pkg)))
> > + (string=? (package-name pkg1) (package-name pkg2)))
> Again, checking for label equivalence is a bad idea.
OK, after reading a bit more about Guile, I understand that `equal?'
is what should be used here, right? The intent is to remove duplicated
inputs in the code below:
#+begin_src scheme
(define all-propagated-inputs
((compose
(cut delete-duplicates <> equal?) ;<-- Here
(cut filter erlang-or-elixir-input? <>)
(cut append-map package-transitive-propagated-inputs <>)
(cut map cadr <>))
(append inputs native-inputs)))
#+end_src
> > +(define (elixir-input? X.Y input)
> > + "Determines if the given INPUT is an Elixir input."
> > + (match input
> > + ((label . path)
> > + ;; XXX: The second condition may be enough.
> > + (and (elixir-name? label)
> > + (directory-exists? (path->elixir-lib path X.Y))))))
> Ahem, search-path-as-list.
> Also, leaking the version is kinda bad, API-wise.
Does this mean that build artifacts should be installed under
`$out/lib/elixir/$libname` instead of `$out/lib/elixir/X.Y/$libname`?
Cheers
[-- Attachment #2: Type: text/html, Size: 2385 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-14 10:37 ` Pierre-Henry Fröhring
@ 2023-11-14 17:53 ` Liliana Marie Prikler
2023-11-15 9:57 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-14 17:53 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Dienstag, dem 14.11.2023 um 11:37 +0100 schrieb Pierre-Henry
Fröhring:
> > > +(define-module (guix build-system mix)
> > > + #:use-module (gnu packages base)
> > > + #:use-module (gnu packages elixir)
> > > + #:use-module (gnu packages elixir-xyz)
> > > + #:use-module (gnu packages erlang)
> > You probably want to resolve those imports rather than use-modules
> > them.
>
> You mean something like this?
> #+begin_src scheme
> (define-module (guix build-system mix)
> #:use-module ((gnu packages base) #:select (glibc make-glibc-utf8-
> locales))
> #:use-module ((gnu packages elixir) #:select (elixir elixir-hex))
> #:use-module ((gnu packages erlang) #:select (rebar3))
> #+end_src
>
> I have moved `elixir-hex' to elixir.scm to avoid a circular
> dependency.
No. Look at all the other build systems. None of them use submodules
of (gnu packages), for a good reason.
> > > +(define (input=? input1 input2)
> > > + "Tell whether inputs INPUT1 and INPUT2 are equal."
> > > + (define pkg1 (match input1 ((_ pkg) pkg)))
> > > + (define pkg2 (match input2 ((_ pkg) pkg)))
> > > + (string=? (package-name pkg1) (package-name pkg2)))
> > Again, checking for label equivalence is a bad idea.
>
> OK, after reading a bit more about Guile, I understand that `equal?'
> is what should be used here, right? The intent is to remove
> duplicated inputs in the code below:
>
> #+begin_src scheme
> (define all-propagated-inputs
> ((compose
> (cut delete-duplicates <> equal?) ;<-- Here
> (cut filter erlang-or-elixir-input? <>)
> (cut append-map package-transitive-propagated-inputs <>)
> (cut map cadr <>))
> (append inputs native-inputs)))
> #+end_src
Yep, that would work. Note that delete-duplicates is O(n^2), though.
We have a little bit of code where it's done in (I assume) O(n*log(n))
with vhashes.
>
> > > +(define (elixir-input? X.Y input)
> > > + "Determines if the given INPUT is an Elixir input."
> > > + (match input
> > > + ((label . path)
> > > + ;; XXX: The second condition may be enough.
> > > + (and (elixir-name? label)
> > > + (directory-exists? (path->elixir-lib path X.Y))))))
> > Ahem, search-path-as-list.
> > Also, leaking the version is kinda bad, API-wise.
>
> Does this mean that build artifacts should be installed under
> `$out/lib/elixir/$libname` instead of `$out/lib/elixir/X.Y/$libname`?
Not necessarily, but you want a different way of building
$out/lib/elixir/X.Y/ that doesn't leak through the function signature.
Btw. I think that you're resolving transitive inputs twice; once on the
build system code and once by fattening the outputs. You probably only
need either of those, not both.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-14 17:53 ` Liliana Marie Prikler
@ 2023-11-15 9:57 ` Pierre-Henry Fröhring
2023-11-15 9:59 ` Pierre-Henry Fröhring
` (2 more replies)
0 siblings, 3 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-15 9:57 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
[-- Attachment #1: Type: text/plain, Size: 3143 bytes --]
> No. Look at all the other build systems. None of them use submodules of
(gnu
> packages), for a good reason.
Ok, I see. It would introduce circular dependencies. By "resolve," you
mean something like: ~(resolve-interface '(gnu packages yyy))~. So, in
our case it means:
#+begin_src scheme
(define (default-glibc-utf8-locales)
(let* ((base (resolve-interface '(gnu packages base)))
(glibc (module-ref base 'glibc))
(make-glibc-utf8-locales (module-ref base
'make-glibc-utf8-locales)))
(make-glibc-utf8-locales glibc #:locales (list "en_US"))))
(define (default-elixir-hex)
(let ((elixir (resolve-interface '(gnu packages elixir))))
(module-ref elixir 'elixir-hex)))
(define (default-rebar3)
(let ((erlang (resolve-interface '(gnu packages erlang))))
(module-ref erlang 'rebar3)))
#+end_src
Then:
#+begin_src scheme
(define* (lower name
#:key
(elixir (default-elixir))
(elixir-hex (default-elixir-hex))
(glibc-utf8-locales (default-glibc-utf8-locales))
(rebar3 (default-rebar3))
…
#:allow-other-keys #:rest arguments)
…)
#+end_src
Is this correct?
> Not necessarily, but you want a different way of building
$out/lib/elixir/X.Y/
> that doesn't leak through the function signature.
Following ~python-build-system.scm~, it means something like:
#+begin_src scheme
(define (elixir-version elixir)
(let* ((version (last (string-split elixir #\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
(define (install-dir inputs outputs)
"Return the path of the current output's Elixir library."
(let ((out (assoc-ref outputs "out"))
(elixir (assoc-ref inputs "elixir")))
(string-append out "/lib/elixir/" (elixir-version elixir)
"/site-packages")))
#+end_src
Is this correct?
> Btw. I think that you're resolving transitive inputs twice; once on the
build
> system code and once by fattening the outputs. You probably only need
either
> of those, not both.
Ah. Propagated inputs are propagated. Who would have thought? So, this is
not necessary:
#+begin_src scheme
(define* (lower …)
…
(define all-propagated-inputs
((compose
(cut delete-duplicates <> equal?)
(cut filter erlang-or-elixir-input? <>)
(cut append-map package-transitive-propagated-inputs <>)
(cut map cadr <>))
(append inputs native-inputs)))
(define build-inputs
`(…
,@all-propagated-inputs
,@inputs
,@native-inputs))
(bag …
(build-inputs build-inputs)
…))
#+end_src
I've just removed ~all-propagated-inputs~ and all packages build just fine.
Is this what you meant?
> Yep, that would work. Note that delete-duplicates is O(n^2), though. We
have
> a little bit of code where it's done in (I assume) O(n*log(n)) with
vhashes.
If ~all-propagated-inputs~ is removed, then the discussion of this comment
is
closed.
[-- Attachment #2: Type: text/html, Size: 3798 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-15 9:57 ` Pierre-Henry Fröhring
@ 2023-11-15 9:59 ` Pierre-Henry Fröhring
2023-11-15 12:40 ` [bug#66801] Fwd: " Pierre-Henry Fröhring
2023-11-15 18:36 ` [bug#66801] " Liliana Marie Prikler
2 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-15 9:59 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
[-- Attachment #1: Type: text/plain, Size: 150 bytes --]
Correction: (string-append out "/lib/elixir/" (elixir-version elixir)
"/site-packages") -> (string-append out "/lib/elixir/" (elixir-version
elixir))
[-- Attachment #2: Type: text/html, Size: 293 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] Fwd: ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-15 9:57 ` Pierre-Henry Fröhring
2023-11-15 9:59 ` Pierre-Henry Fröhring
@ 2023-11-15 12:40 ` Pierre-Henry Fröhring
2023-11-15 18:36 ` [bug#66801] " Liliana Marie Prikler
2 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-15 12:40 UTC (permalink / raw)
To: 66801
[-- Attachment #1: Type: text/plain, Size: 3125 bytes --]
> No. Look at all the other build systems. None of them use submodules of
(gnu
> packages), for a good reason.
Ok, I see. It would introduce circular dependencies. By "resolve," you
mean something like: ~(resolve-interface '(gnu packages yyy))~. So, in
our case it means:
#+begin_src scheme
(define (default-glibc-utf8-locales)
(let* ((base (resolve-interface '(gnu packages base)))
(glibc (module-ref base 'glibc))
(make-glibc-utf8-locales (module-ref base
'make-glibc-utf8-locales)))
(make-glibc-utf8-locales glibc #:locales (list "en_US"))))
(define (default-elixir-hex)
(let ((elixir (resolve-interface '(gnu packages elixir))))
(module-ref elixir 'elixir-hex)))
(define (default-rebar3)
(let ((erlang (resolve-interface '(gnu packages erlang))))
(module-ref erlang 'rebar3)))
#+end_src
Then:
#+begin_src scheme
(define* (lower name
#:key
(elixir (default-elixir))
(elixir-hex (default-elixir-hex))
(glibc-utf8-locales (default-glibc-utf8-locales))
(rebar3 (default-rebar3))
…
#:allow-other-keys #:rest arguments)
…)
#+end_src
Is this correct?
> Not necessarily, but you want a different way of building
$out/lib/elixir/X.Y/
> that doesn't leak through the function signature.
Following ~python-build-system.scm~, it means something like:
#+begin_src scheme
(define (elixir-version elixir)
(let* ((version (last (string-split elixir #\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
(define (install-dir inputs outputs)
"Return the path of the current output's Elixir library."
(let ((out (assoc-ref outputs "out"))
(elixir (assoc-ref inputs "elixir")))
(string-append out "/lib/elixir/" (elixir-version elixir))))
#+end_src
Is this correct?
> Btw. I think that you're resolving transitive inputs twice; once on the
build
> system code and once by fattening the outputs. You probably only need
either
> of those, not both.
Ah. Propagated inputs are propagated. Who would have thought? So, this is
not necessary:
#+begin_src scheme
(define* (lower …)
…
(define all-propagated-inputs
((compose
(cut delete-duplicates <> equal?)
(cut filter erlang-or-elixir-input? <>)
(cut append-map package-transitive-propagated-inputs <>)
(cut map cadr <>))
(append inputs native-inputs)))
(define build-inputs
`(…
,@all-propagated-inputs
,@inputs
,@native-inputs))
(bag …
(build-inputs build-inputs)
…))
#+end_src
I've just removed ~all-propagated-inputs~ and all packages build just fine.
Is this what you meant?
> Yep, that would work. Note that delete-duplicates is O(n^2), though. We
have
> a little bit of code where it's done in (I assume) O(n*log(n)) with
vhashes.
If ~all-propagated-inputs~ is removed, then the discussion of this comment
is
closed.
[-- Attachment #2: Type: text/html, Size: 3825 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-15 9:57 ` Pierre-Henry Fröhring
2023-11-15 9:59 ` Pierre-Henry Fröhring
2023-11-15 12:40 ` [bug#66801] Fwd: " Pierre-Henry Fröhring
@ 2023-11-15 18:36 ` Liliana Marie Prikler
2023-11-15 22:49 ` Pierre-Henry Fröhring
2 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-15 18:36 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Mittwoch, dem 15.11.2023 um 10:57 +0100 schrieb Pierre-Henry
Fröhring:
> > No. Look at all the other build systems. None of them use
> > submodules of (gnu
> > packages), for a good reason.
>
> Ok, I see. It would introduce circular dependencies. By "resolve,"
> you
> mean something like: ~(resolve-interface '(gnu packages yyy))~. So,
> in
> our case it means:
> #+begin_src scheme
> (define (default-glibc-utf8-locales)
> (let* ((base (resolve-interface '(gnu packages base)))
> (glibc (module-ref base 'glibc))
> (make-glibc-utf8-locales (module-ref base 'make-glibc-utf8-
> locales)))
> (make-glibc-utf8-locales glibc #:locales (list "en_US"))))
>
> (define (default-elixir-hex)
> (let ((elixir (resolve-interface '(gnu packages elixir))))
> (module-ref elixir 'elixir-hex)))
>
> (define (default-rebar3)
> (let ((erlang (resolve-interface '(gnu packages erlang))))
> (module-ref erlang 'rebar3)))
> #+end_src
>
> Then:
> #+begin_src scheme
> (define* (lower name
> #:key
> (elixir (default-elixir))
> (elixir-hex (default-elixir-hex))
> (glibc-utf8-locales (default-glibc-utf8-locales))
> (rebar3 (default-rebar3))
> …
> #:allow-other-keys #:rest arguments)
> …)
> #+end_src
>
> Is this correct?
You shouldn't need to provide glibc-utf8-locales this way (there's
already a variable for it IIRC), but yeah.
> > Not necessarily, but you want a different way of building
> > $out/lib/elixir/X.Y/
> > that doesn't leak through the function signature.
>
> Following ~python-build-system.scm~, it means something like:
> #+begin_src scheme
> (define (elixir-version elixir)
> (let* ((version (last (string-split elixir #\-)))
> (components (string-split version #\.))
> (major+minor (take components 2)))
> (string-join major+minor ".")))
>
> (define (install-dir inputs outputs)
> "Return the path of the current output's Elixir library."
> (let ((out (assoc-ref outputs "out"))
> (elixir (assoc-ref inputs "elixir")))
> (string-append out "/lib/elixir/" (elixir-version elixir) "/site-
> packages")))
> #+end_src
>
> Is this correct?
LGTM.
> > Btw. I think that you're resolving transitive inputs twice; once on
> > the build system code and once by fattening the outputs. You
> > probably only need either of those, not both.
>
> Ah. Propagated inputs are propagated. Who would have thought? So,
> this is not necessary:
> #+begin_src scheme
> (define* (lower …)
> …
> (define all-propagated-inputs
> ((compose
> (cut delete-duplicates <> equal?)
> (cut filter erlang-or-elixir-input? <>)
> (cut append-map package-transitive-propagated-inputs <>)
> (cut map cadr <>))
> (append inputs native-inputs)))
>
> (define build-inputs
> `(…
> ,@all-propagated-inputs
> ,@inputs
> ,@native-inputs))
>
> (bag …
> (build-inputs build-inputs)
> …))
> #+end_src
> I've just removed ~all-propagated-inputs~ and all packages build just
> fine.
>
> Is this what you meant?
Yep. I assume this makes your packages way lighter.
Note that propagated inputs have become a (not great) default for
interpreted languages such as Python or Emacs Lisp.
> > Yep, that would work. Note that delete-duplicates is O(n^2),
> > though. We have a little bit of code where it's done in (I assume)
> > O(n*log(n)) with vhashes.
>
> If ~all-propagated-inputs~ is removed, then the discussion of this
> comment is closed.
Sure.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
2023-11-15 18:36 ` [bug#66801] " Liliana Marie Prikler
@ 2023-11-15 22:49 ` Pierre-Henry Fröhring
0 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-15 22:49 UTC (permalink / raw)
To: 66801; +Cc: Liliana Marie Prikler
[-- Attachment #1.1: Type: text/plain, Size: 154 bytes --]
So, the attached file `review.org' contains all the discussions so far on
the first patch 01/14.
The following email is the patch itself.
Thanks.
Cheers.
[-- Attachment #1.2: Type: text/html, Size: 243 bytes --]
[-- Attachment #2: review.org --]
[-- Type: application/octet-stream, Size: 10888 bytes --]
* DONE Comment
** lilyp
> +
> +(define-module (guix build-system mix)
> + #:use-module (gnu packages base)
> + #:use-module (gnu packages elixir)
> + #:use-module (gnu packages elixir-xyz)
> + #:use-module (gnu packages erlang)
You probably want to resolve those imports rather than use-modules
them.
You can simplify these five variables into one to three (three being
quite many already depending on whether you'll actually use the smaller
ones).
** phf
You mean something like this?
#+begin_src scheme
(define-module (guix build-system mix)
#:use-module ((gnu packages base) #:select (glibc make-glibc-utf8-locales))
#:use-module ((gnu packages elixir) #:select (elixir elixir-hex))
#:use-module ((gnu packages erlang) #:select (rebar3))
#+end_src
I have moved `elixir-hex' to elixir.scm to avoid a circular dependency.
** lilyp
No. Look at all the other build systems. None of them use submodules of (gnu
packages), for a good reason.
** phf
Ok, I see. It would introduce circular dependencies. By "resolve" you mean
something like: ~(resolve-interface '(gnu packages yyy))~. So, in our case it
means:
#+begin_src scheme
(define (default-glibc-utf8-locales)
(let* ((base (resolve-interface '(gnu packages base)))
(glibc (module-ref base 'glibc))
(make-glibc-utf8-locales (module-ref base 'make-glibc-utf8-locales)))
(make-glibc-utf8-locales glibc #:locales (list "en_US"))))
(define (default-elixir-hex)
(let ((elixir (resolve-interface '(gnu packages elixir))))
(module-ref elixir 'elixir-hex)))
(define (default-rebar3)
(let ((erlang (resolve-interface '(gnu packages erlang))))
(module-ref erlang 'rebar3)))
#+end_src
Then:
#+begin_src scheme
(define* (lower name
#:key
(elixir (default-elixir))
(elixir-hex (default-elixir-hex))
(glibc-utf8-locales (default-glibc-utf8-locales))
(rebar3 (default-rebar3))
…
#:allow-other-keys #:rest arguments)
…)
#+end_src
Is this correct?
** lilyp
You shouldn't need to provide glibc-utf8-locales this way (there's already a
variable for it IIRC), but yeah.
** phf
Yes! It is a "hiden package" in ~(gnu packages base)~. I've replaced it.
* DONE Comment
:PROPERTIES:
:ID: 49813ce3-3c7c-47e5-bb95-ca849aaac558
:END:
** lilyp
> +(define (elixir-name? name)
> + "Determines if NAME is the name or the label associated to an
> Elixir
> +package."
> + (string-prefix? %elixir-prefix name))
Useless use of magic constant.
> +
> +(define (elixir-input? X.Y input)
> + "Determines if the given INPUT is an Elixir input."
> + (match input
> + ((label . path)
> + ;; XXX: The second condition may be enough.
> + (and (elixir-name? label)
> + (directory-exists? (path->elixir-lib path X.Y))))))
Also, leaking the version is kinda bad, API-wise.
** phf
Does this mean that build artifacts should be installed under
`$out/lib/elixir/$libname` instead of `$out/lib/elixir/X.Y/$libname`?
** lilyp
Not necessarily, but you want a different way of building $out/lib/elixir/X.Y/
that doesn't leak through the function signature.
** phf
Following ~python-build-system.scm~, it means something like:
#+begin_src scheme
(define (elixir-version elixir)
(let* ((version (last (string-split elixir #\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
(define (install-dir inputs outputs)
"Return the path of the current output's Elixir library."
(let ((out (assoc-ref outputs "out"))
(elixir (assoc-ref inputs "elixir")))
(string-append out "/lib/elixir/" (elixir-version elixir))))
#+end_src
Is this correct?
** lilyp
LGTM.
* DONE Comment
** lilyp
Btw. I think that you're resolving transitive inputs twice; once on the build
system code and once by fattening the outputs. You probably only need either
of those, not both.
** phf
Ah. Propagated inputs are propagated. Who would have thought? So, this is not necessary:
#+begin_src scheme
(define* (lower …)
…
(define all-propagated-inputs
((compose
(cut delete-duplicates <> equal?)
(cut filter erlang-or-elixir-input? <>)
(cut append-map package-transitive-propagated-inputs <>)
(cut map cadr <>))
(append inputs native-inputs)))
(define build-inputs
`(…
,@all-propagated-inputs
,@inputs
,@native-inputs))
(bag …
(build-inputs build-inputs)
…))
#+end_src
I've just removed ~all-propagated-inputs~ and all packages build just fine.
Is this what you meant?
** lilyp
Yep. I assume this makes your packages way lighter.
Note that propagated inputs have become a (not great) default for interpreted
languages such as Python or Emacs Lisp.
* DONE Comment
** lilyp
> +(define (input=? input1 input2)
> + "Tell whether inputs INPUT1 and INPUT2 are equal."
> + (define pkg1 (match input1 ((_ pkg) pkg)))
> + (define pkg2 (match input2 ((_ pkg) pkg)))
> + (string=? (package-name pkg1) (package-name pkg2)))
Again, checking for label equivalence is a bad idea.
** phf
OK, after reading a bit more about Guile, I understand that `equal?' is what
should be used here, right? The intent is to remove duplicated inputs in the
code below:
#+begin_src scheme
(define all-propagated-inputs
((compose
(cut delete-duplicates <> equal?) ;<-- Here
(cut filter erlang-or-elixir-input? <>)
(cut append-map package-transitive-propagated-inputs <>)
(cut map cadr <>))
(append inputs native-inputs)))
#+end_src
** lilyp
Yep, that would work. Note that delete-duplicates is O(n^2), though. We have
a little bit of code where it's done in (I assume) O(n*log(n)) with vhashes.
** phf
If ~all-propagated-inputs~ is removed, then the discussion of this comment is
closed.
** lilyp
Sure.
* DONE Comment
** lilyp
> +(define (elixir-name? name)
> + "Determines if NAME is the name or the label associated to an
> Elixir
> +package."
> + (string-prefix? %elixir-prefix name))
Useless use of magic constant.
** phf
I've removed all occurrances of ~%elixir-prefix~ and ~%erlang-prefix~.
* DONE Comment
:LOGBOOK:
- State "DONE" from "TODO" [2023-11-15 Wed 16:25]
:END:
** lilyp
> +(define (elixir-input? X.Y input)
> + "Determines if the given INPUT is an Elixir input."
> + (match input
> + ((label . path)
> + ;; XXX: The second condition may be enough.
> + (and (elixir-name? label)
> + (directory-exists? (path->elixir-lib path X.Y))))))
Ahem, search-path-as-list.
** phf
~elixir-input?~ has been removed.
* DONE Comment
** lilyp
> +(define (elixir-input? X.Y input)
> + "Determines if the given INPUT is an Elixir input."
> + (match input
> + ((label . path)
> + ;; XXX: The second condition may be enough.
> + (and (elixir-name? label)
> + (directory-exists? (path->elixir-lib path X.Y))))))
Duplicated boilerplate for neither fun nor profit.
** phf
~elixir-input?~ has been removed.
* DONE Comment
** lilyp
> +(define (erlang-or-elixir-input? input)
> + "Tell whether INPUT is an Elixir or an Erlang input."
> + (match input
> + ((_ package)
> + (erlang-or-elixir-pkg? package))))
Skip.
** phf
~erlang-or-elixir-input~ has been removed.
* DONE Comment
** lilyp
It is wiser to write these out as regular string-appends.
** phf
Replaced ~f-join~ by ~string-append~.
* DONE Comment
** lilyp
> +(define (strip-prefix prefix name)
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
I'm pretty sure we have a function looking like this somewhere, but I
can't recall its name atm.
** phf
- I've manualy search for something similar in the interfaces of modules ~(guix
utils)~ and ~(guix build utils)~ without success.
- I've search from ~strip.*prefix~ in the whole code base without success.
* DONE Comment
** lilyp
> +(define (path->elixir-lib path X.Y)
> + "Return the path to the directory within PATH where libraries of
> an Elixir
> +package are installed. Here, X.Y represents the major and minor
> version
> +numbers of Elixir used for compilation."
> + (f-join path "lib" "elixir" X.Y))
Is path itself ever useful here or does it simply point to the store?
This can likely be simplified to
(define (elixir-lib version)
(string-append "/lib/elixir/" version))
** phf
This comment is addressed in an other [[id:49813ce3-3c7c-47e5-bb95-ca849aaac558][comment]]. Essentially, ~install-dir~
function is suggested to be used instead.
* DONE Comment
** lilyp
> +(define (erlang-or-elixir-input? X.Y input)
> + "Determines if the given INPUT is an Erlang or Elixir input."
> + (or (erlang-input? input)
> + (elixir-input? X.Y input)))
Leak, leak, leak.
** phf
This comment is addressed in an other [[id:49813ce3-3c7c-47e5-bb95-ca849aaac558][comment]].
* DONE Comment
** lilyp
> +(define (snakecase-name name)
> + "Return a snakecase version of NAME."
> + (string-replace-substring (string-downcase name) "-" "_"))
> +
> +(define (label->library-name label)
> + "Return the library name associated to an input label LABEL."
> + (define stripped-label
> + (cond
> + ((erlang-name? label)
> + (strip-erlang-prefix label))
> + ((elixir-name? label)
> + (strip-elixir-prefix label))
> + (#t (error "Invalid label: expected an Erlang or Elixir label."
> 'label label))))
> + (snakecase-name stripped-label))
Don't rely on labels.
Gratuitous definitions are gratuitous.
The docstring divulges implementation details without really explaining
what the function itself does.
** phf
Much of the code has been deleted and replaced by something smaller.
* DONE Comment
** lilyp
> + (define (all-inputs mix-env)
> + (define env-inputs
> + (cond
> + ((string=? mix-env %mix-env-prod)
> + inputs)
> + ((member mix-env (list %mix-env-test %mix-env-shared))
> + (append inputs native-inputs))
> + (#t (error "Unexpected Mix environment." 'mix-env mix-env))))
You probably want and ice-9 match here, which has an implicit error on
failed matches.
** phf
This code has been deleted.
* DONE Comment
** lilyp
> + #:allow-other-keys #:rest args)
> + "Build the given Mix package, applying all of PHASES in order."
> + (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; mix-build-system.scm ends here
>
> base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
I probably missed some, but I think you get the gist. While this isn't
exactly code golf, try to express yourself in terms of the least
verbose primitives and don't add meaningless layers of indirection – we
already have enough actual meaningful ones.
** phf
The code has been reviewed in this regard.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (4 preceding siblings ...)
2023-11-13 20:26 ` [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-11-15 22:51 ` Pierre-Henry Fröhring
2023-11-16 2:05 ` Liliana Marie Prikler
2023-11-17 8:03 ` Pierre-Henry Fröhring
` (7 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-15 22:51 UTC (permalink / raw)
To: 66801; +Cc: liliana.prikler, Pierre-Henry Fröhring
* guix/build-system/mix.scm,
* guix/build/mix-build-system.scm: New modules.
Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
---
guix/build-system/mix.scm | 181 ++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 205 ++++++++++++++++++++++++++++++++
2 files changed, 386 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 00000000..ae80679b
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,181 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve the bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ "Return the default Elixir package."
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cut string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cut string-replace-substring <> "-" "_")
+ strip-elixir-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 00000000..0a1fcb5c
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,205 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build
+ strip-elixir-prefix
+ %standard-phases))
+
+(define (elixir-version elixir)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of ELIXIR.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cut string-join <> ".")
+ (cut take <> 2)
+ (cut string-split <> #\.)
+ last)
+ (string-split elixir #\-)))
+
+(define (elixir-libdir elixir path)
+ "Return the path where all libraries for a specified ELIXIR version are installed."
+ (string-append path "/lib/elixir/" (elixir-version elixir)))
+
+(define (erlang-libdir path)
+ "Return the path of the directory where libraries of an Erlang package are
+installed in the store."
+ (string-append path "/lib/erlang/lib"))
+
+(define (install-dir inputs outputs)
+ "Return the path of the current output's Elixir library.
+Example: /gnu/store/…/lib/elixir/1.14"
+ (elixir-libdir (assoc-ref inputs "elixir")
+ (assoc-ref outputs "out")))
+
+(define (strip-prefix prefix name)
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (strip-elixir-prefix name)
+ "Strip elixir- from NAME."
+ (strip-prefix "elixir-" name))
+
+(define (mix-build-dir mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory."
+ (string-append "_build/" mix-env "/lib"))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cut string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "LC_ALL" "en_US.UTF-8")
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3"))
+ (setenv "MIX_EXS" mix-exs))
+
+(define* (install-hex #:key name inputs outputs #:allow-other-keys)
+ "Install Hex."
+ (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES") "/hex")))
+ (mkdir-p hex-archive-path)
+ (symlink (car (list-directories (elixir-libdir (assoc-ref inputs "elixir")
+ (assoc-ref inputs "elixir-hex"))))
+ (string-append hex-archive-path "/hex"))))
+
+(define* (install-dependencies #:key
+ name
+ inputs
+ outputs
+ tests?
+ build-per-environment
+ (native-inputs '())
+ mix-environments
+ #:allow-other-keys
+ #:rest rest)
+ "Install dependencies."
+ (define (install-lib lib dir)
+ (let ((lib-name (last (string-split lib #\/))))
+ (symlink lib (string-append dir "/" lib-name))))
+
+ (define (install-input mix-env input)
+ (let ((dir (mix-build-dir mix-env)))
+ (mkdir-p dir)
+ (match input
+ ((_ . path)
+ ((compose
+ (cut for-each (cut install-lib <> dir) <>)
+ (cut append-map list-directories <>)
+ (cut filter directory-exists? <>))
+ (list (elixir-libdir (assoc-ref inputs "elixir") path)
+ (erlang-libdir path)))))))
+
+ (define (install-inputs mix-env)
+ (for-each (cut install-input mix-env <>)
+ (append inputs native-inputs)))
+
+ (for-each install-inputs mix-environments))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (library-name pkg-name)
+ "Return the library name deduced from PKG-NAME.
+A package should be named: elixir-lib-name-X.Y.Z from which the library name
+lib_name is deduced."
+ ((compose
+ (cut string-join <> "_")
+ (cut drop-right <> 1)
+ (cut string-split <> #\-))
+ (strip-elixir-prefix pkg-name)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (library-name name))
+ (lib-dir (string-append (install-dir inputs outputs) "/" lib-name)))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir (if build-per-environment "prod" "shared")) "/" lib-name)
+ lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (replace 'configure configure)
+ (replace 'unpack unpack)
+ (add-after 'patch-generated-file-shebangs 'install-hex install-hex)
+ (add-after 'install-hex 'install-dependencies install-dependencies)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-15 22:51 ` [bug#66801] [PATCH v3 " Pierre-Henry Fröhring
@ 2023-11-16 2:05 ` Liliana Marie Prikler
2023-11-16 13:01 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-16 2:05 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Mittwoch, dem 15.11.2023 um 23:51 +0100 schrieb Pierre-Henry
Fröhring:
> * guix/build-system/mix.scm,
> * guix/build/mix-build-system.scm: New modules.
>
> Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
> ---
> guix/build-system/mix.scm | 181 ++++++++++++++++++++++++++++
> guix/build/mix-build-system.scm | 205
> ++++++++++++++++++++++++++++++++
> 2 files changed, 386 insertions(+)
> create mode 100644 guix/build-system/mix.scm
> create mode 100644 guix/build/mix-build-system.scm
>
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> new file mode 100644
> index 00000000..ae80679b
> --- /dev/null
> +++ b/guix/build-system/mix.scm
> @@ -0,0 +1,181 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Standard build procedure for Elixir packages using 'mix'. This
> is
> +;; implemented as an extension of 'gnu-build-system'.
> +;;
> +;; Code:
> +
> +(define-module (guix build-system mix)
> + #:use-module (guix build mix-build-system)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> + #:use-module (guix gexp)
> + #:use-module (guix monads)
> + #:use-module (guix packages)
> + #:use-module (guix search-paths)
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (ice-9 match)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build-system hexpm-uri))
> +
> +;; Lazily resolve the bindings to avoid circular dependencies.
> +(define (default-glibc-utf8-locales)
> + (let* ((base (resolve-interface '(gnu packages base))))
> + (module-ref base 'glibc-utf8-locales)))
> +
> +(define (default-elixir-hex)
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir-hex)))
> +
> +(define (default-rebar3)
> + (let ((erlang (resolve-interface '(gnu packages erlang))))
> + (module-ref erlang 'rebar3)))
> +
> +(define (default-elixir)
> + "Return the default Elixir package."
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir)))
> +
> +(define (hexpm-uri name version)
> + "Return the URI where to fetch the sources of a Hex package NAME
> at VERSION.
> +NAME is the name of the package which should look like: elixir-pkg-
> name-X.Y.Z
> +See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
> + ((compose
> + (cut string-append "https://repo.hex.pm/tarballs/" <> "-"
> version ".tar")
> + (cut string-replace-substring <> "-" "_")
> + strip-elixir-prefix)
> + name))
> +
> +;; A number of environment variables specific to the Mix build
> system are
> +;; reflected here. They are documented at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
> Other
> +;; parameters located in mix.exs are defined at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
> +(define* (mix-build name
> + inputs
> + #:key
> + source
> + (tests? #t)
> + (mix-path #f) ;See MIX_PATH.
> + (mix-exs "mix.exs") ;See MIX_EXS.
> + (build-per-environment #t) ;See
> :build_per_environment.
> + (phases '%standard-phases)
> + (outputs '("out"))
> + (search-paths '())
> + (system (%current-system))
> + (guile #f)
> + (imported-modules `((guix build mix-build-
> system)
> + ,@%gnu-build-system-
> modules))
> + (modules '((guix build mix-build-system)
> + (guix build utils))))
> + "Build SOURCE using Elixir, and with INPUTS."
> +
> + ;; Check the documentation of :build_per_environment here:
> + ;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration A
> nd
> + ;; "Environments" here:
> + ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
> + (define mix-environments
> + (if build-per-environment
> + `("prod" ,@(if tests? '("test") '()))
> + '("shared")))
> +
> + (define builder
> + (with-imported-modules imported-modules
> + #~(begin
> +
> + (use-modules #$@(sexp->gexp modules))
> +
> + #$(with-build-variables inputs outputs
> + #~(mix-build #:name #$name
> + #:source #+source
> + #:system #$system
> + #:tests? #$tests?
> + #:mix-path #$mix-path
> + #:mix-exs #$mix-exs
> + #:mix-environments '#$mix-environments
> + #:build-per-environment #$build-per-
> environment
> + #:phases #$(if (pair? phases)
> + (sexp->gexp phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map
> + search-path-
> specification->sexp
> + search-paths))
> + #:inputs
> + %build-inputs)))))
> +
> + (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> + system
> + #:graft? #f)))
> + (gexp->derivation name
> + builder
> + #:system system
> + #:graft? #f ;consistent with 'gnu-build'
> + #:target #f
> + #:guile-for-build guile)))
> +
> +(define* (lower name
> + #:key
> + (elixir (default-elixir))
> + (elixir-hex (default-elixir-hex))
> + (glibc-utf8-locales (default-glibc-utf8-locales))
> + (inputs '())
> + (native-inputs '())
> + (propagated-inputs '())
> + (rebar3 (default-rebar3))
> + (tests? #t)
> + outputs
> + source
> + system
> + target
> + #:allow-other-keys #:rest arguments)
> + "Return a bag for NAME."
> + (let ((private-keywords
> + '(#:inputs #:native-inputs
> + #:outputs #:system #:target
> + #:elixir #:elixir-hex #:glibc-utf8-locales
> + #:rebar3 #:erlang))
> + (build-inputs
> + `(,@(standard-packages)
> + ("glibc-utf8-locales" ,glibc-utf8-locales)
> + ("erlang" ,(lookup-package-input elixir "erlang"))
> + ("rebar3" ,rebar3)
> + ("elixir" ,elixir)
> + ("elixir-hex" ,elixir-hex)
> + ,@inputs
> + ,@native-inputs)))
> + (bag (name name)
> + (system system)
> + (build-inputs build-inputs)
> + (host-inputs (if target inputs '()))
> + (outputs outputs)
> + (build mix-build)
> + (arguments (strip-keyword-arguments private-keywords
> arguments)))))
> +
> +(define mix-build-system
> + (build-system (name 'mix)
> + (description "The standard Mix build system")
> + (lower lower)))
> +
> +;;; mix.scm ends here
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> new file mode 100644
> index 00000000..0a1fcb5c
> --- /dev/null
> +++ b/guix/build/mix-build-system.scm
> @@ -0,0 +1,205 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Code:
> +
> +(define-module (guix build mix-build-system)
> + #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> + #:use-module (guix build utils)
> + #:use-module (ice-9 ftw)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 regex)
> + #:use-module (ice-9 string-fun)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build
> + strip-elixir-prefix
> + %standard-phases))
> +
> +(define (elixir-version elixir)
> + "Return an X.Y string where X and Y are respectively the major and
> minor version number of ELIXIR.
> +Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> + ((compose
> + (cut string-join <> ".")
> + (cut take <> 2)
> + (cut string-split <> #\.)
> + last)
> + (string-split elixir #\-)))
I don't think we need to be overly cute here. The let-binding version
from python-build-system is less surprising to the uninitiated reader.
See also strip-store-file-name and package-name->name+version.
> +(define (elixir-libdir elixir path)
> + "Return the path where all libraries for a specified ELIXIR
> version are installed."
> + (string-append path "/lib/elixir/" (elixir-version elixir)))
You probably want to swap path and elixir and perhaps also find a way
to implicitly parameterize the latter so as to make it optional.
> +
> +(define (erlang-libdir path)
> + "Return the path of the directory where libraries of an Erlang
> package are
> +installed in the store."
> + (string-append path "/lib/erlang/lib"))
> +
> +(define (install-dir inputs outputs)
> + "Return the path of the current output's Elixir library.
> +Example: /gnu/store/…/lib/elixir/1.14"
> + (elixir-libdir (assoc-ref inputs "elixir")
> + (assoc-ref outputs "out")))
> +
> +(define (strip-prefix prefix name)
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
You might want to consider
(define* (strip-prefix name #:optional (prefix "elixir-")
…)
> +(define (mix-build-dir mix-env)
> + "Return the directory where build artifacts are to be installed
> according to
> +en environment MIX-ENV in the current directory."
> + (string-append "_build/" mix-env "/lib"))
> +
> +(define* (unpack #:key source mix-path #:allow-other-keys)
> + "Unpack SOURCE in the working directory, and change directory
> within the
> +source. When SOURCE is a directory, copy it in a sub-directory of
> the current
> +working directory."
> + (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> + (gnu-unpack #:source source)
> + (when (file-exists? "contents.tar.gz")
> + (invoke "tar" "xvf" "contents.tar.gz"))))
> +
> +(define (list-directories dir)
> + "List absolute paths of directories directly under the directory
> DIR."
> + (map (cut string-append dir "/" <>)
> + (scandir dir (lambda (filename)
> + (and (not (member filename '("." "..")))
> + (directory-exists? (string-append dir "/"
> filename)))))))
> +
> +(define* (configure #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables.
> +See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
> + (setenv "LC_ALL" "en_US.UTF-8")
> + (setenv "MIX_HOME" (getcwd))
> + (setenv "MIX_ARCHIVES" "archives")
> + (setenv "MIX_BUILD_ROOT" "_build")
> + (setenv "MIX_DEPS_PATH" "deps")
> + (setenv "MIX_PATH" (or mix-path ""))
> + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3"))
> + (setenv "MIX_EXS" mix-exs))
This does not appear to be a configure phase in the traditional sense
of the wording. Instead, it should be a post 'set-paths' 'set-mix-env'
imho.
> +(define* (install-hex #:key name inputs outputs #:allow-other-keys)
> + "Install Hex."
> + (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES")
> "/hex")))
> + (mkdir-p hex-archive-path)
> + (symlink (car (list-directories (elixir-libdir (assoc-ref inputs
> "elixir")
> + (assoc-ref inputs
> "elixir-hex"))))
> + (string-append hex-archive-path "/hex"))))
Why do we need this? It looks like we'll be pasting the same (native?)
input all over the store, which imho would be bad.
> +(define* (install-dependencies #:key
> + name
> + inputs
> + outputs
> + tests?
> + build-per-environment
> + (native-inputs '())
> + mix-environments
> + #:allow-other-keys
> + #:rest rest)
> + "Install dependencies."
> + (define (install-lib lib dir)
> + (let ((lib-name (last (string-split lib #\/))))
> + (symlink lib (string-append dir "/" lib-name))))
> +
> + (define (install-input mix-env input)
> + (let ((dir (mix-build-dir mix-env)))
> + (mkdir-p dir)
> + (match input
> + ((_ . path)
> + ((compose
> + (cut for-each (cut install-lib <> dir) <>)
> + (cut append-map list-directories <>)
> + (cut filter directory-exists? <>))
> + (list (elixir-libdir (assoc-ref inputs "elixir") path)
> + (erlang-libdir path)))))))
I think you're at the wrong layer of abstraction here.
(match input
((_ . prefix)
(begin
(install-subdirectories (elixir-libdir path))
(install-subdirectories (erlang-libdir path)))))
where (install-subdirectories PATH) is basically
(when (directory-exists? PATH)
(for-each (cute install-lib <> (mix-build-dir mix-env))
(list-directories PATH)))
> + (define (install-inputs mix-env)
> + (for-each (cut install-input mix-env <>)
> + (append inputs native-inputs)))
Installing native inputs: probably a bad idea (inhibits cross-
compilation).
> + (for-each install-inputs mix-environments))
> +
> +(define* (build #:key mix-environments #:allow-other-keys)
> + "Builds the Mix project."
> + (for-each (lambda (mix-env)
> + (setenv "MIX_ENV" mix-env)
> + (invoke "mix" "compile" "--no-deps-check"))
> + mix-environments))
> +
> +(define* (check #:key (tests? #t) #:allow-other-keys)
> + "Test the Mix project."
> + (if tests?
> + (invoke "mix" "test" "--no-deps-check")
> + (format #t "tests? = ~a~%" tests?)))
> +
> +(define* (remove-mix-dirs . _)
> + "Remove all .mix/ directories.
> +We do not want to copy them to the installation directory."
> + (for-each delete-file-recursively
> + (find-files "." (file-name-predicate "\\.mix$")
> #:directories? #t)))
> +
> +(define (library-name pkg-name)
> + "Return the library name deduced from PKG-NAME.
> +A package should be named: elixir-lib-name-X.Y.Z from which the
> library name
> +lib_name is deduced."
> + ((compose
> + (cut string-join <> "_")
> + (cut drop-right <> 1)
> + (cut string-split <> #\-))
> + (strip-elixir-prefix pkg-name)))
Consider defining (package-name-version->elixir-name) analogous to
(package-name-version->erlang-name) in rebar-build-system. Also allow
overriding it through a build system argument. The thing you currently
have will blow up with git-version.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-16 2:05 ` Liliana Marie Prikler
@ 2023-11-16 13:01 ` Pierre-Henry Fröhring
2023-11-16 15:11 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-16 13:01 UTC (permalink / raw)
To: 66801; +Cc: Liliana Marie Prikler
[-- Attachment #1: Type: text/plain, Size: 9273 bytes --]
Do you mind if I paste the conversation using the following org format?
* Comment
** lilyp
> +(define (elixir-version elixir)
> + "Return an X.Y string where X and Y are respectively the major and
> minor version number of ELIXIR.
> +Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> + ((compose
> + (cut string-join <> ".")
> + (cut take <> 2)
> + (cut string-split <> #\.)
> + last)
> + (string-split elixir #\-)))
I don't think we need to be overly cute here. The let-binding version
from python-build-system is less surprising to the uninitiated reader.
See also strip-store-file-name and package-name->name+version.
** phf
Maybe:
#+begin_src scheme
(define (elixir-version elixir)
"Return an X.Y string where X and Y are respectively the major and minor
version number of ELIXIR.
Example: /gnu/store/…-elixir-1.14.0 → 1.14"
(receive (_ version) (package-name->name+version (strip-store-file-name
elixir))
(let* ((components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor "."))))
#+end_src
or:
#+begin_src scheme
(define (elixir-version elixir)
"Return an X.Y string where X and Y are respectively the major and minor
version number of ELIXIR.
Example: /gnu/store/…-elixir-1.14.0 → 1.14"
(let* ((version (last (string-split elixir #\-)))
(components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))
#+end_src
or: just inline the code as it is used just once. See
[[id:76abe0e4-a0e2-4176-bdc0-9ff241e8ba42][next comment]].
* Comment
:PROPERTIES:
:ID: 76abe0e4-a0e2-4176-bdc0-9ff241e8ba42
:END:
** lilyp
> +(define (elixir-libdir elixir path)
> + "Return the path where all libraries for a specified ELIXIR
> version are installed."
> + (string-append path "/lib/elixir/" (elixir-version elixir)))
You probably want to swap path and elixir and perhaps also find a way
to implicitly parameterize the latter so as to make it optional.
** phf
Is this what you mean?
#+begin_src scheme
;; The Elixir version is constant as soon as it is computable from the
current
;; execution. It is a X.Y string where X and Y are respectively the major
and
;; minor version number of the Elixir used in the build.
(define elixir-version (make-parameter "X.Y"))
(define* (elixir-libdir path #:optional (version (elixir-version)))
"Return the path where all libraries for a specified ELIXIR version are
installed."
(string-append path "/lib/elixir/" version))
(define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
…
(elixir-version
(receive (_ version) (package-name->name+version (strip-store-file-name
(assoc-ref inputs "elixir")))
(let* ((components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))))
#+end_src
* Comment
** lilyp
> +(define* (configure #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables.
> +See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
> + (setenv "LC_ALL" "en_US.UTF-8")
> + (setenv "MIX_HOME" (getcwd))
> + (setenv "MIX_ARCHIVES" "archives")
> + (setenv "MIX_BUILD_ROOT" "_build")
> + (setenv "MIX_DEPS_PATH" "deps")
> + (setenv "MIX_PATH" (or mix-path ""))
> + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3"))
> + (setenv "MIX_EXS" mix-exs))
This does not appear to be a configure phase in the traditional sense
of the wording. Instead, it should be a post 'set-paths' 'set-mix-env'
imho.
** phf
After ~install-locale~ since ~(setenv "LC_ALL" "en_US.UTF-8")~ is called in
this
phase.
#+begin_src scheme
(define %standard-phases
(modify-phases gnu:%standard-phases
…
(delete 'configure)
(add-after 'install-locale 'set-mix-env set-mix-env)
(replace 'unpack unpack)
…))
#+end_src
* Comment
** lilyp
> +(define* (install-hex #:key name inputs outputs #:allow-other-keys)
> + "Install Hex."
> + (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES")
> "/hex")))
> + (mkdir-p hex-archive-path)
> + (symlink (car (list-directories (elixir-libdir (assoc-ref inputs
> "elixir")
> + (assoc-ref inputs
> "elixir-hex"))))
> + (string-append hex-archive-path "/hex"))))
Why do we need this? It looks like we'll be pasting the same (native?)
input all over the store, which imho would be bad.
** phf
Without ~Hex~, you get this error:
#+begin_example
starting phase `build'
Could not find Hex, which is needed to build dependency :ex_doc
Shall I install Hex? (if running non-interactively, use "mix local.hex
--force") [Yn]
#+end_example
This message is called from ~handle_rebar_not_found~ in
~lib/mix/lib/mix/tasks/deps.compile.ex~ ; which is called from ~rebar_cmd~
because
a ~manager~ (~Hex~) could not be found. Hex must be present => install-hex
must be
executed.
I thought that this should not be a problem since Hex is needed at build
time,
and just symlinked. Maybe should it be copied instead?
* Comment
** lilyp
> + (define (install-input mix-env input)
> + (let ((dir (mix-build-dir mix-env)))
> + (mkdir-p dir)
> + (match input
> + ((_ . path)
> + ((compose
> + (cut for-each (cut install-lib <> dir) <>)
> + (cut append-map list-directories <>)
> + (cut filter directory-exists? <>))
> + (list (elixir-libdir (assoc-ref inputs "elixir") path)
> + (erlang-libdir path)))))))
I think you're at the wrong layer of abstraction here.
(match input
((_ . prefix)
(begin
(install-subdirectories (elixir-libdir path))
(install-subdirectories (erlang-libdir path)))))
where (install-subdirectories PATH) is basically
(when (directory-exists? PATH)
(for-each (cute install-lib <> (mix-build-dir mix-env))
(list-directories PATH)))
** phf
Does this work?
#+begin_src scheme
(define (install-lib lib dir)
(let ((lib-name (last (string-split lib #\/))))
(symlink lib (string-append dir "/" lib-name))))
(define (install-subdirectories mix-env path)
(let ((build-dir (mix-build-dir mix-env)))
(mkdir-p build-dir)
(when (directory-exists? path)
(for-each (cute install-lib <> build-dir)
(list-directories path)))))
(define (install-input mix-env input)
(match input
((_ . path)
(begin
(install-subdirectories mix-env (elixir-libdir path))
(install-subdirectories mix-env (erlang-libdir path))))))
#+end_src
* Comment
** lilyp
> + (define (install-inputs mix-env)
> + (for-each (cut install-input mix-env <>)
> + (append inputs native-inputs)))
Installing native inputs: probably a bad idea (inhibits cross-
compilation).
** phf
A slight variant that does not link things when it should not:
#+begin_src scheme
(define (install-inputs mix-env)
(for-each (cut install-input mix-env <>)
(cond
((string=? mix-env "prod") inputs)
((member mix-env '("shared" "test")) (append inputs
native-inputs))
(else (error (format #f "Unexpected Mix env: ~a~%"
mix-env))))))
#+end_src
I did not consider cross-compilation yet. The following might be wrong be
here
we go. I far as I understand, Erlang applications are largely platform
independent. Once the code is compiled to BEAM bytecode, it can run on any
platform that has the Erlang VM installed. If an Erlang library uses native
extensions, then cross-compilation might be required. For a build to succeed
in a given environment (one of "prod", "test", "shared"), the BEAM files of
all dependencies should be present on the build machine. So, all
dependencies
must be installed
* Comment
** lilyp
> +(define (library-name pkg-name)
> + "Return the library name deduced from PKG-NAME.
> +A package should be named: elixir-lib-name-X.Y.Z from which the
> library name
> +lib_name is deduced."
> + ((compose
> + (cut string-join <> "_")
> + (cut drop-right <> 1)
> + (cut string-split <> #\-))
> + (strip-elixir-prefix pkg-name)))
Consider defining (package-name-version->elixir-name) analogous to
(package-name-version->erlang-name) in rebar-build-system. Also allow
overriding it through a build system argument. The thing you currently
have will blow up with git-version.
** phf
Faily close to the ~rebar-build-system~ version.
#+begin_src scheme
(define (package-name-version->elixir-name name+ver)
"Convert the Guix package NAME-VER to the corresponding Elixir
name-version
format. Essentially drop the prefix used in Guix and replace dashes by
underscores."
(let* ((name- (package-name->name+version name+ver)))
(string-join
(string-split
(if (string-prefix? "elixir-" name-)
(string-drop name- (string-length "elixir-"))
name-)
#\-)
"_")))
#+end_src
[-- Attachment #2: Type: text/html, Size: 11116 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-16 13:01 ` Pierre-Henry Fröhring
@ 2023-11-16 15:11 ` Liliana Marie Prikler
2023-11-16 18:12 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-16 15:11 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Donnerstag, dem 16.11.2023 um 14:01 +0100 schrieb Pierre-Henry
Fröhring:
> Do you mind if I paste the conversation using the following org
> format?
I do mind you pasting it in HTML format :P
> * Comment
> ** lilyp
> > +(define (elixir-version elixir)
> > + "Return an X.Y string where X and Y are respectively the major
> > and
> > minor version number of ELIXIR.
> > +Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> > + ((compose
> > + (cut string-join <> ".")
> > + (cut take <> 2)
> > + (cut string-split <> #\.)
> > + last)
> > + (string-split elixir #\-)))
>
> I don't think we need to be overly cute here. The let-binding
> version from python-build-system is less surprising to the
> uninitiated reader.
>
> See also strip-store-file-name and package-name->name+version.
>
>
> ** phf
> Maybe:
> #+begin_src scheme
> (define (elixir-version elixir)
> "Return an X.Y string where X and Y are respectively the major and
> minor version number of ELIXIR.
> Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> (receive (_ version) (package-name->name+version (strip-store-file-
> name elixir))
> (let* ((components (string-split version #\.))
> (major+minor (take components 2)))
> (string-join major+minor "."))))
> #+end_src
>
> or:
> #+begin_src scheme
> (define (elixir-version elixir)
> "Return an X.Y string where X and Y are respectively the major and
> minor version number of ELIXIR.
> Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> (let* ((version (last (string-split elixir #\-)))
> (components (string-split version #\.))
> (major+minor (take components 2)))
> (string-join major+minor ".")))
> #+end_src
>
> or: just inline the code as it is used just once. See [[id:76abe0e4-
> a0e2-4176-bdc0-9ff241e8ba42][next comment]].
Note that you can use SRFI-71 let and let* to bind multiple values at
once. So you can write the first one without receive.
>
> * Comment
> :PROPERTIES:
> :ID: 76abe0e4-a0e2-4176-bdc0-9ff241e8ba42
> :END:
>
> ** lilyp
> > +(define (elixir-libdir elixir path)
> > + "Return the path where all libraries for a specified ELIXIR
> > version are installed."
> > + (string-append path "/lib/elixir/" (elixir-version elixir)))
>
> You probably want to swap path and elixir and perhaps also find a way
> to implicitly parameterize the latter so as to make it optional.
>
>
> ** phf
> Is this what you mean?
> #+begin_src scheme
> ;; The Elixir version is constant as soon as it is computable from
> the current
> ;; execution. It is a X.Y string where X and Y are respectively the
> major and
> ;; minor version number of the Elixir used in the build.
> (define elixir-version (make-parameter "X.Y"))
>
> (define* (elixir-libdir path #:optional (version (elixir-version)))
> "Return the path where all libraries for a specified ELIXIR version
> are installed."
> (string-append path "/lib/elixir/" version))
>
> (define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
> …
> (elixir-version
> (receive (_ version) (package-name->name+version (strip-store-
> file-name (assoc-ref inputs "elixir")))
> (let* ((components (string-split version #\.))
> (major+minor (take components 2)))
> (string-join major+minor ".")))))
> #+end_src
I'd use %elixir-version and perhaps make it a fluent rather than a
parameter (not quite sure whether parameters get reset when a function
goes out of scope).
> * Comment
> ** lilyp
> > +(define* (configure #:key inputs mix-path mix-exs #:allow-other-
> > keys)
> > + "Set environment variables.
> > +See:
> > https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables
> > "
> > + (setenv "LC_ALL" "en_US.UTF-8")
> > + (setenv "MIX_HOME" (getcwd))
> > + (setenv "MIX_ARCHIVES" "archives")
> > + (setenv "MIX_BUILD_ROOT" "_build")
> > + (setenv "MIX_DEPS_PATH" "deps")
> > + (setenv "MIX_PATH" (or mix-path ""))
> > + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> > "/bin/rebar3"))
> > + (setenv "MIX_EXS" mix-exs))
>
> This does not appear to be a configure phase in the traditional sense
> of the wording. Instead, it should be a post 'set-paths' 'set-mix-
> env' imho.
>
>
> ** phf
> After ~install-locale~ since ~(setenv "LC_ALL" "en_US.UTF-8")~ is
> called in this phase.
> #+begin_src scheme
> (define %standard-phases
> (modify-phases gnu:%standard-phases
> …
> (delete 'configure)
> (add-after 'install-locale 'set-mix-env set-mix-env)
> (replace 'unpack unpack)
> …))
> #+end_src
Good point: you shouldn't be setting LC_ALL anyway, that's already done
by install-locale.
> * Comment
> ** lilyp
> > +(define* (install-hex #:key name inputs outputs #:allow-other-
> > keys)
> > + "Install Hex."
> > + (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES")
> > "/hex")))
> > + (mkdir-p hex-archive-path)
> > + (symlink (car (list-directories (elixir-libdir (assoc-ref
> > inputs
> > "elixir")
> > + (assoc-ref
> > inputs
> > "elixir-hex"))))
> > + (string-append hex-archive-path "/hex"))))
>
> Why do we need this? It looks like we'll be pasting the same
> (native?) input all over the store, which imho would be bad.
>
>
> ** phf
> Without ~Hex~, you get this error:
> #+begin_example
> starting phase `build'
> Could not find Hex, which is needed to build dependency :ex_doc
> Shall I install Hex? (if running non-interactively, use "mix
> local.hex --force") [Yn]
> #+end_example
> This message is called from ~handle_rebar_not_found~ in
> ~lib/mix/lib/mix/tasks/deps.compile.ex~ ; which is called from
> ~rebar_cmd~ because
> a ~manager~ (~Hex~) could not be found. Hex must be present =>
> install-hex must be executed.
>
> I thought that this should not be a problem since Hex is needed at
> build time, and just symlinked. Maybe should it be copied instead?
Is hex not an (implicit) native-input in your build system? Anything
that keeps it from functioning is a packaging bug imho.
> * Comment
> ** lilyp
> > + (define (install-input mix-env input)
> > + (let ((dir (mix-build-dir mix-env)))
> > + (mkdir-p dir)
> > + (match input
> > + ((_ . path)
> > + ((compose
> > + (cut for-each (cut install-lib <> dir) <>)
> > + (cut append-map list-directories <>)
> > + (cut filter directory-exists? <>))
> > + (list (elixir-libdir (assoc-ref inputs "elixir") path)
> > + (erlang-libdir path)))))))
>
> I think you're at the wrong layer of abstraction here.
>
> (match input
> ((_ . prefix)
> (begin
> (install-subdirectories (elixir-libdir path))
> (install-subdirectories (erlang-libdir path)))))
>
> where (install-subdirectories PATH) is basically
> (when (directory-exists? PATH)
> (for-each (cute install-lib <> (mix-build-dir mix-env))
> (list-directories PATH)))
>
>
> ** phf
> Does this work?
> #+begin_src scheme
> (define (install-lib lib dir)
> (let ((lib-name (last (string-split lib #\/))))
> (symlink lib (string-append dir "/" lib-name))))
>
> (define (install-subdirectories mix-env path)
> (let ((build-dir (mix-build-dir mix-env)))
> (mkdir-p build-dir)
> (when (directory-exists? path)
> (for-each (cute install-lib <> build-dir)
> (list-directories path)))))
Maybe move the mkdir-p into the when or at the start of install-lib.
> (define (install-input mix-env input)
> (match input
> ((_ . path)
> (begin
> (install-subdirectories mix-env (elixir-libdir path))
> (install-subdirectories mix-env (erlang-libdir path))))))
> #+end_src
>
>
> * Comment
> ** lilyp
> > + (define (install-inputs mix-env)
> > + (for-each (cut install-input mix-env <>)
> > + (append inputs native-inputs)))
>
> Installing native inputs: probably a bad idea (inhibits cross-
> compilation).
>
>
> ** phf
> A slight variant that does not link things when it should not:
> #+begin_src scheme
> (define (install-inputs mix-env)
> (for-each (cut install-input mix-env <>)
> (cond
> ((string=? mix-env "prod") inputs)
> ((member mix-env '("shared" "test")) (append inputs
> native-inputs))
> (else (error (format #f "Unexpected Mix env: ~a~%"
> mix-env))))))
> #+end_src
>
> I did not consider cross-compilation yet. The following might be
> wrong be here we go. I far as I understand, Erlang applications are
> largely platform independent. Once the code is compiled to BEAM
> bytecode, it can run on any platform that has the Erlang VM
> installed. If an Erlang library uses native extensions, then cross-
> compilation might be required. For a build to succeed
> in a given environment (one of "prod", "test", "shared"), the BEAM
> files of all dependencies should be present on the build machine. So,
> all dependencies must be installed
Not an expert on elixir, but that sounds borked. You might get around
this with propagated-inputs maybe? That being said, native-inputs
shouldn't blow up a build if missing.
> * Comment
> ** lilyp
> > +(define (library-name pkg-name)
> > + "Return the library name deduced from PKG-NAME.
> > +A package should be named: elixir-lib-name-X.Y.Z from which the
> > library name
> > +lib_name is deduced."
> > + ((compose
> > + (cut string-join <> "_")
> > + (cut drop-right <> 1)
> > + (cut string-split <> #\-))
> > + (strip-elixir-prefix pkg-name)))
>
> Consider defining (package-name-version->elixir-name) analogous to
> (package-name-version->erlang-name) in rebar-build-system. Also
> allow overriding it through a build system argument. The thing you
> currently have will blow up with git-version.
>
>
> ** phf
> Faily close to the ~rebar-build-system~ version.
> #+begin_src scheme
> (define (package-name-version->elixir-name name+ver)
> "Convert the Guix package NAME-VER to the corresponding Elixir
> name-version format. Essentially drop the prefix used in Guix and
> replace dashes by underscores."
> (let* ((name- (package-name->name+version name+ver)))
> (string-join
> (string-split
> (if (string-prefix? "elixir-" name-)
> (string-drop name- (string-length "elixir-"))
> name-)
> #\-)
> "_")))
> #+end_src
Looks okay.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-16 15:11 ` Liliana Marie Prikler
@ 2023-11-16 18:12 ` Pierre-Henry Fröhring
2023-11-16 19:34 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-16 18:12 UTC (permalink / raw)
To: 66801; +Cc: Liliana Marie Prikler
[-- Attachment #1: Type: text/plain, Size: 5046 bytes --]
I should really configure mu4e or something like that.
I'm curious to know if you have a pointer to an efficient setup for working
through emails like this.
Below the last three comments:
* WAITING Comment
:PROPERTIES:
:ID: 76abe0e4-a0e2-4176-bdc0-9ff241e8ba42
:END:
** lilyp
> +(define (elixir-libdir elixir path)
> + "Return the path where all libraries for a specified ELIXIR
> version are installed."
> + (string-append path "/lib/elixir/" (elixir-version elixir)))
You probably want to swap path and elixir and perhaps also find a way
to implicitly parameterize the latter so as to make it optional.
** phf
Is this what you mean?
#+begin_src scheme
;; The Elixir version is constant as soon as it is computable from the
current
;; execution. It is a X.Y string where X and Y are respectively the major
and
;; minor version number of the Elixir used in the build.
(define elixir-version (make-parameter "X.Y"))
(define* (elixir-libdir path #:optional (version (elixir-version)))
"Return the path where all libraries for a specified ELIXIR version are
installed."
(string-append path "/lib/elixir/" version))
(define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
…
(elixir-version
(receive (_ version) (package-name->name+version (strip-store-file-name
(assoc-ref inputs "elixir")))
(let* ((components (string-split version #\.))
(major+minor (take components 2)))
(string-join major+minor ".")))))
#+end_src
** lilyp
I'd use %elixir-version and perhaps make it a fluent rather than a parameter
(not quite sure whether parameters get reset when a function goes out of
scope).
** phf
Parameters do not get reset when a function goes out of scope:
#+begin_src scheme
(define x (make-parameter 1))
(define (set-x-to-2) (x 2))
(format #t "~a~%" (x))
(set-x-to-2)
(format #t "~a~%" (x))
#+end_src
#+begin_example
1
2
#+end_example
The [[
https://www.gnu.org/software/guile/manual/html_node/Parameters.html][documentation]]
seems to indicate that it's an appropriate replacement for a
global variable.
* WAITING Comment
** lilyp
Is hex not an (implicit) native-input in your build system? Anything that
keeps it from functioning is a packaging bug imho.
** phf
If ~mix~ finds ~Hex~ under ~$MIX_ARCHIVES/hex/hex~, then ~mix compile~ does
not emit
the message above. I'm not sure how could this be changed. I've tried to set
~MIX_PATH~ to ~/gnu/store/…-elixir-hex-2.0.5/lib/elixir/1.14~ without
success. So,
this is the reason why ~install-hex~ phase installs Hex like it does.
* WAITING Comment
** lilyp
> + (define (install-inputs mix-env)
> + (for-each (cut install-input mix-env <>)
> + (append inputs native-inputs)))
Installing native inputs: probably a bad idea (inhibits cross-
compilation).
** phf
A slight variant that does not link things when it should not:
#+begin_src scheme
(define (install-inputs mix-env)
(for-each (cut install-input mix-env <>)
(cond
((string=? mix-env "prod") inputs)
((member mix-env '("shared" "test")) (append inputs
native-inputs))
(else (error (format #f "Unexpected Mix env: ~a~%"
mix-env))))))
#+end_src
I did not consider cross-compilation yet. The following might be wrong be
here
we go. I far as I understand, Erlang applications are largely platform
independent. Once the code is compiled to BEAM bytecode, it can run on any
platform that has the Erlang VM installed. If an Erlang library uses native
extensions, then cross-compilation might be required. For a build to succeed
in a given environment (one of "prod", "test", "shared"), the BEAM files of
all dependencies should be present on the build machine. So, all
dependencies
must be installed
** lilyp
Not an expert on elixir, but that sounds borked.
** phf
Yes. Did not have time to look into it as of now.
** lilyp
You might get around this with propagated-inputs maybe? That being said,
native-inputs shouldn't blow up a build if missing.
** phf
If ~native-inputs~ are missing, it's fine. But wait, maybe there is a
misunderstanding here. Please, check the reasoning: in a cross-compilation
context, we have two machines A and B, and:
- native-inputs: dependencies that must be built on A for A ;
- inputs: dependencies that must be built on A for B ;
- propagated-inputs: like inputs but installed in the profile.
If installing Elixir (like Python) gathers all libraries in the profile
with a
variable like ~GUIX_ERL_LIBS~, then, it would be enough to list
dependencies (in
packages) in ~propagated-inputs~ instead of ~inputs~ and make them
available to
Elixir through ~ERL_LIBS~ (like ~GUIX_PYTHONPATH~ and ~PYTHONPATH~). As a
consequence, the ~install-dependencies~ phase would be reduced to
~ERL_LIBS=$GUIX_ERL_LIBS~.
Is this an answer to: "You might get around this with propagated-inputs
maybe?"
[-- Attachment #2: Type: text/html, Size: 6770 bytes --]
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-16 18:12 ` Pierre-Henry Fröhring
@ 2023-11-16 19:34 ` Liliana Marie Prikler
2023-11-17 7:36 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-16 19:34 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Donnerstag, dem 16.11.2023 um 19:12 +0100 schrieb Pierre-Henry
Fröhring:
> I should really configure mu4e or something like that.
> I'm curious to know if you have a pointer to an efficient setup for
> working through emails like this.
> Below the last three comments:
>
> * WAITING Comment
> :PROPERTIES:
> :ID: 76abe0e4-a0e2-4176-bdc0-9ff241e8ba42
> :END:
>
> ** lilyp
> > +(define (elixir-libdir elixir path)
> > + "Return the path where all libraries for a specified ELIXIR
> > version are installed."
> > + (string-append path "/lib/elixir/" (elixir-version elixir)))
>
> You probably want to swap path and elixir and perhaps also find a way
> to implicitly parameterize the latter so as to make it optional.
>
>
> ** phf
> Is this what you mean?
> #+begin_src scheme
> ;; The Elixir version is constant as soon as it is computable from
> the current
> ;; execution. It is a X.Y string where X and Y are respectively the
> major and
> ;; minor version number of the Elixir used in the build.
> (define elixir-version (make-parameter "X.Y"))
>
> (define* (elixir-libdir path #:optional (version (elixir-version)))
> "Return the path where all libraries for a specified ELIXIR version
> are installed."
> (string-append path "/lib/elixir/" version))
>
> (define* (configure #:key inputs mix-path mix-exs #:allow-other-keys)
> …
> (elixir-version
> (receive (_ version) (package-name->name+version (strip-store-
> file-name (assoc-ref inputs "elixir")))
> (let* ((components (string-split version #\.))
> (major+minor (take components 2)))
> (string-join major+minor ".")))))
> #+end_src
>
>
> ** lilyp
> I'd use %elixir-version.
>
>
> ** phf
> Parameters do not get reset when a function goes out of scope:
> #+begin_src scheme
> (define x (make-parameter 1))
> (define (set-x-to-2) (x 2))
> (format #t "~a~%" (x))
> (set-x-to-2)
> (format #t "~a~%" (x))
> #+end_src
>
> #+begin_example
> 1
> 2
> #+end_example
>
> The documentation seems to indicate that it's an appropriate
> replacement for a global variable.
It also uses the special parameterize thing to scope values. That
being said, if parameters work for you, then parameters are fine.
>
> * WAITING Comment** lilyp
> Is hex not an (implicit) native-input in your build system? Anything
> that keeps it from functioning is a packaging bug imho.
>
>
> ** phf
> If ~mix~ finds ~Hex~ under ~$MIX_ARCHIVES/hex/hex~, then ~mix
> compile~ does not emit the message above. I'm not sure how could this
> be changed. I've tried to set ~MIX_PATH~ to ~/gnu/store/…-elixir-hex-
> 2.0.5/lib/elixir/1.14~ without
> success. So, this is the reason why ~install-hex~ phase installs Hex
> like it does.
Look into mix and how it invokes hex. There's hardcoding potential,
I'm sure of it.
> * WAITING Comment
> ** lilyp
> > + (define (install-inputs mix-env)
> > + (for-each (cut install-input mix-env <>)
> > + (append inputs native-inputs)))
>
> Installing native inputs: probably a bad idea (inhibits cross-
> compilation).
>
>
> ** phf
> A slight variant that does not link things when it should not:
> #+begin_src scheme
> (define (install-inputs mix-env)
> (for-each (cut install-input mix-env <>)
> (cond
> ((string=? mix-env "prod") inputs)
> ((member mix-env '("shared" "test")) (append inputs
> native-inputs))
> (else (error (format #f "Unexpected Mix env: ~a~%"
> mix-env))))))
> #+end_src
>
> I did not consider cross-compilation yet. The following might be
> wrong be here we go. I far as I understand, Erlang applications are
> largely platform independent. Once the code is compiled to BEAM
> bytecode, it can run on any platform that has the Erlang VM
> installed. If an Erlang library uses native extensions, then cross-
> compilation might be required. For a build to succeed
> in a given environment (one of "prod", "test", "shared"), the BEAM
> files of all dependencies should be present on the build machine. So,
> all dependencies must be installed
>
>
> ** lilyp
> Not an expert on elixir, but that sounds borked.
>
>
> ** phf
> Yes. Did not have time to look into it as of now.
>
>
> ** lilyp
> You might get around this with propagated-inputs maybe? That being
> said, native-inputs shouldn't blow up a build if missing.
>
>
> ** phf
> If ~native-inputs~ are missing, it's fine. But wait, maybe there is a
> misunderstanding here. Please, check the reasoning: in a cross-
> compilation context, we have two machines A and B, and:
> - native-inputs: dependencies that must be built on A for A ;
> - inputs: dependencies that must be built on A for B ;
> - propagated-inputs: like inputs but installed in the profile.
>
>
> If installing Elixir (like Python) gathers all libraries in the
> profile with a variable like ~GUIX_ERL_LIBS~, then, it would be
> enough to list dependencies (in packages) in ~propagated-inputs~
> instead of ~inputs~ and make them available to Elixir through
> ~ERL_LIBS~ (like ~GUIX_PYTHONPATH~ and ~PYTHONPATH~).
> As a consequence, the ~install-dependencies~ phase would be reduced
> to ~ERL_LIBS=$GUIX_ERL_LIBS~.
>
> Is this an answer to: "You might get around this with propagated-
> inputs maybe?"
If environment variables work, that is clearly to be preferred over any
other magic we've considered so far. My hunch is that rebar-build-
system was written this way because environment variables didn't work,
however. Same with Rust and Node, which are kinda yucky in this
regard.
Other than that, yes, (ab)using propagated-inputs like that is the way
to go when there's no smarter alternative available.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-16 19:34 ` Liliana Marie Prikler
@ 2023-11-17 7:36 ` Pierre-Henry Fröhring
0 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-17 7:36 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
* WAITING Comment
** lilyp
> +(define* (install-hex #:key name inputs outputs #:allow-other-keys)
> + "Install Hex."
> + (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES")
> "/hex")))
> + (mkdir-p hex-archive-path)
> + (symlink (car (list-directories (elixir-libdir (assoc-ref inputs
> "elixir")
> + (assoc-ref inputs
> "elixir-hex"))))
> + (string-append hex-archive-path "/hex"))))
Why do we need this? It looks like we'll be pasting the same (native?)
input all over the store, which imho would be bad.
** phf
Without ~Hex~, you get this error:
#+begin_example
starting phase `build'
Could not find Hex, which is needed to build dependency :ex_doc
Shall I install Hex? (if running non-interactively, use "mix local.hex
--force") [Yn]
#+end_example
This message is called from ~handle_rebar_not_found~ in
~lib/mix/lib/mix/tasks/deps.compile.ex~ ; which is called from
~rebar_cmd~ because
a ~manager~ (~Hex~) could not be found. Hex must be present =>
install-hex must be
executed.
I thought that this should not be a problem since Hex is needed at build time,
and just symlinked. Maybe should it be copied instead?
** lilyp
Is hex not an (implicit) native-input in your build system? Anything that
keeps it from functioning is a packaging bug imho.
** phf
If ~mix~ finds ~Hex~ under ~$MIX_ARCHIVES/hex/hex~, then ~mix compile~
does not emit
the message above. I'm not sure how could this be changed. I've tried to set
~MIX_PATH~ to ~/gnu/store/…-elixir-hex-2.0.5/lib/elixir/1.14~ without
success. So,
this is the reason why ~install-hex~ phase installs Hex like it does.
** lilyp
Look into mix and how it invokes hex. There's hardcoding potential, I'm sure
of it.
** phf
:PROPERTIES:
:ID: d9ffbbfa-3cd3-4a44-9acb-04a0627b90d7
:END:
- Observation: ~mix compile~ ⇒ "Could not find Hex, which is needed to
build dependency :ex_doc".
- We have the source
- guix build --source
- We found from where this message is emitted.
- lib/mix/lib/mix/hex.ex
- We now why the message was emitted.
- Code.ensure_loaded?(Hex) failed.
- https://hexdocs.pm/elixir/1.14.0/Code.html#ensure_loaded/1
Well, adding the store path of Hex to ~ERL_LIBS~ solves the problem. The
~install-hex~ phase can be deleted in favor of manipulating ~ERL_LIBS~ as
suggested with propagated inputs
[[id:d7cd6e3d-9802-499f-a157-7698aca942d4][below]].
* WAITING Comment
:PROPERTIES:
:ID: d7cd6e3d-9802-499f-a157-7698aca942d4
:END:
** lilyp
> + (define (install-inputs mix-env)
> + (for-each (cut install-input mix-env <>)
> + (append inputs native-inputs)))
Installing native inputs: probably a bad idea (inhibits cross-
compilation).
** phf
A slight variant that does not link things when it should not:
#+begin_src scheme
(define (install-inputs mix-env)
(for-each (cut install-input mix-env <>)
(cond
((string=? mix-env "prod") inputs)
((member mix-env '("shared" "test")) (append inputs
native-inputs))
(else (error (format #f "Unexpected Mix env: ~a~%" mix-env))))))
#+end_src
I did not consider cross-compilation yet. The following might be wrong be here
we go. As far as I understand, Erlang applications are largely platform
independent. Once the code is compiled to BEAM bytecode, it can run on any
platform that has the Erlang VM installed. If an Erlang library uses native
extensions, then cross-compilation might be required. For a build to succeed
in a given environment (one of "prod", "test", "shared"), the BEAM files of
all dependencies should be present on the build machine. So, all dependencies
must be installed
** lilyp
Not an expert on elixir, but that sounds borked.
** phf
Yes. Did not have time to look into it as of now.
** lilyp
You might get around this with propagated-inputs maybe? That being said,
native-inputs shouldn't blow up a build if missing.
** phf
If ~native-inputs~ are missing, it's fine. But wait, maybe there is a
misunderstanding here. Please, check the reasoning: in a cross-compilation
context, we have two machines A and B, and:
- native-inputs: dependencies that must be built on A for A ;
- inputs: dependencies that must be built on A for B ;
- propagated-inputs: like inputs but installed in the profile.
If installing Elixir (like Python) gathers all libraries in the profile with a
variable like ~GUIX_ERL_LIBS~, then, it would be enough to list dependencies (in
packages) in ~propagated-inputs~ instead of ~inputs~ and make them available to
Elixir through ~ERL_LIBS~ (like ~GUIX_PYTHONPATH~ and ~PYTHONPATH~). As a
consequence, the ~install-dependencies~ phase would be reduced to
~ERL_LIBS=$GUIX_ERL_LIBS~.
Is this an answer to: "You might get around this with propagated-inputs
maybe?"
** lilyp
If environment variables work, that is clearly to be preferred over any other
magic we've considered so far. My hunch is that rebar-build- system was
written this way because environment variables didn't work, however. Same
with Rust and Node, which are kinda yucky in this regard.
Other than that, yes, (ab)using propagated-inputs like that is the way to go
when there's no smarter alternative available.
** phf
As hinted [[id:d9ffbbfa-3cd3-4a44-9acb-04a0627b90d7][above]], abusing
propagated inputs works up to the ~elixir-machete~
package. Essentially, it is enough to add the code below to the
~elixir~ package:
#+begin_src scheme
(native-search-paths
(list (search-path-specification
(variable "GUIX_ERL_LIBS")
(files (list "lib/erlang/lib"
(string-append "lib/elixir/" (version-major+minor
version)))))))
#+end_src
~install-dependencies~ has been deleted altogether for a single line added to
~set-mix-env~.
#+begin_src scheme
(setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS"))
#+end_src
So, if Erlang and Elixir dependencies are added to propagated inputs, then it
seems to work as expected.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (5 preceding siblings ...)
2023-11-15 22:51 ` [bug#66801] [PATCH v3 " Pierre-Henry Fröhring
@ 2023-11-17 8:03 ` Pierre-Henry Fröhring
2023-11-17 19:24 ` Liliana Marie Prikler
2023-12-07 22:34 ` [bug#66801] [PATCH] " Pierre-Henry Fröhring
` (6 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-17 8:03 UTC (permalink / raw)
To: 66801; +Cc: liliana.prikler, Pierre-Henry Fröhring
* guix/build-system/mix.scm,
* guix/build/mix-build-system.scm: New modules.
Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
---
gnu/packages/elixir.scm | 62 ++++++++++-
guix/build-system/mix.scm | 187 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 171 +++++++++++++++++++++++++++++
3 files changed, 417 insertions(+), 3 deletions(-)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b4251..6f779afb 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -96,9 +97,21 @@ (define-public elixir
(lambda* (#:key inputs #:allow-other-keys)
;; Some tests require access to a home directory.
(setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" prefix ("${GUIX_ERL_LIBS}"))))
+ programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ERL_LIBS")
+ (files (list "lib/erlang/lib"
+ (string-append "lib/elixir/" (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
(description "Elixir is a dynamic, functional language used to build
@@ -106,3 +119,46 @@ (define-public elixir
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public elixir-hex
+ (package
+ (name "elixir-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hexpm/hex.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+ ;; The mix-build-system assumes that Hex exists.
+ ;; We build Hex using the gnu-build-system.
+ ;; Other Elixir packages use the mix-build-system.
+ (build-system gnu-build-system)
+ (inputs (list elixir))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "MIX_ENV" "prod")
+ (invoke "mix" "compile")))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define X.Y #$(version-major+minor (package-version elixir)))
+ (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+ (mkdir-p out)
+ (copy-recursively "_build/prod/lib/hex" out))))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 00000000..7ddedea9
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,187 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve the bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ "Return the default Elixir package."
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cut string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cut string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 00000000..ca649582
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,171 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries for a specified ELIXIR version are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define (erlang-libdir path)
+ "Return the path of the directory where libraries of an Erlang package are
+installed in the store."
+ (string-append path "/lib/erlang/lib"))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory."
+ (string-append "_build/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of ELIXIR.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ (let* ((_ version (package-name->name+version
+ (strip-store-file-name (assoc-ref inputs "elixir"))))
+ (components (string-split version #\.))
+ (major+minor (take components 2)))
+ (string-join major+minor ".")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cut string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3"))
+ (setenv "MIX_EXS" mix-exs)
+ (%elixir-version (elixir-version inputs)))
+
+(define* (install-hex #:key name inputs outputs #:allow-other-keys)
+ "Install Hex."
+ (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES") "/hex")))
+ (mkdir-p hex-archive-path)
+ (symlink (car (list-directories (elixir-libdir (assoc-ref inputs "elixir-hex"))))
+ (string-append hex-archive-path "/hex"))))
+
+(define* (install-dependencies . _)
+ "Install dependencies."
+ (setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS")))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name-version->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Essentially drop the prefix used in Guix and replace dashes by
+underscores."
+ (let* ((name- (package-name->name+version name+ver)))
+ (string-join
+ (string-split
+ (if (string-prefix? "elixir-" name-)
+ (string-drop name- (string-length "elixir-"))
+ name-)
+ #\-)
+ "_")))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name-version->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name)))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir (if build-per-environment "prod" "shared")) "/" lib-name)
+ lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-17 8:03 ` Pierre-Henry Fröhring
@ 2023-11-17 19:24 ` Liliana Marie Prikler
2023-11-18 4:44 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-17 19:24 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Freitag, dem 17.11.2023 um 09:03 +0100 schrieb Pierre-Henry
Fröhring:
> * guix/build-system/mix.scm,
> * guix/build/mix-build-system.scm: New modules.
Avoid spanning a change across multiple files. Use
file: Change.
file2: Likewise.
> Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
> ---
> gnu/packages/elixir.scm | 62 ++++++++++-
> guix/build-system/mix.scm | 187
> ++++++++++++++++++++++++++++++++
> guix/build/mix-build-system.scm | 171 +++++++++++++++++++++++++++++
You committed two changes at once here. Split them.
> 3 files changed, 417 insertions(+), 3 deletions(-)
> create mode 100644 guix/build-system/mix.scm
> create mode 100644 guix/build/mix-build-system.scm
>
> diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
> index 724b4251..6f779afb 100644
> --- a/gnu/packages/elixir.scm
> +++ b/gnu/packages/elixir.scm
> @@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
> #:use-module ((guix licenses) #:prefix license:)
> #:use-module (guix build-system gnu)
> #:use-module (guix gexp)
> + #:use-module (guix utils)
> #:use-module (guix git-download)
> #:use-module (guix packages)
> #:use-module (gnu packages)
> @@ -96,9 +97,21 @@ (define-public elixir
> (lambda* (#:key inputs #:allow-other-keys)
> ;; Some tests require access to a home directory.
> (setenv "HOME" "/tmp")))
> - (delete 'configure))))
> - (inputs
> - (list erlang git))
> + (delete 'configure)
> + (add-after 'install 'wrap-programs
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (programs '("elixir" "elixirc" "iex" "mix")))
> + (for-each (lambda (program)
> + (wrap-program (string-append out "/bin/"
> program)
> + '("ERL_LIBS" prefix
> ("${GUIX_ERL_LIBS}"))))
> + programs)))))))
> + (inputs (list erlang git))
> + (native-search-paths
> + (list (search-path-specification
> + (variable "GUIX_ERL_LIBS")
> + (files (list "lib/erlang/lib"
> + (string-append "lib/elixir/" (version-
> major+minor version)))))))
I suppose ERL is for erlang? What do we use for elixir then?
> (home-page "https://elixir-lang.org/")
> (synopsis "Elixir programming language")
> (description "Elixir is a dynamic, functional language used to
> build
> @@ -106,3 +119,46 @@ (define-public elixir
> for running low-latency, distributed and fault-tolerant systems,
> while also
> being successfully used in web development and the embedded software
> domain.")
> (license license:asl2.0)))
> +
> +(define-public elixir-hex
> + (package
> + (name "elixir-hex")
> + (version "2.0.5")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/hexpm/hex.git")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
> + ;; The mix-build-system assumes that Hex exists.
> + ;; We build Hex using the gnu-build-system.
> + ;; Other Elixir packages use the mix-build-system.
> + (build-system gnu-build-system)
> + (inputs (list elixir))
> + (arguments
> + (list
> + #:phases
> + #~(modify-phases %standard-phases
> + (delete 'bootstrap)
> + (delete 'configure)
> + (replace 'build
> + (lambda* (#:key inputs #:allow-other-keys)
> + (setenv "MIX_ENV" "prod")
> + (invoke "mix" "compile")))
> + (delete 'check)
> + (replace 'install
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (define X.Y #$(version-major+minor (package-version
> elixir)))
> + (define out (string-append (assoc-ref outputs "out")
> "/lib/elixir/" X.Y "/hex"))
> + (mkdir-p out)
> + (copy-recursively "_build/prod/lib/hex" out))))))
> + (synopsis "Package manager for the Erlang VM")
> + (description
> + "This project provides tasks that integrate with Mix, Elixir's
> build
> +tool.")
> + (home-page "https://hexdocs.pm/makeup_elixir/")
> + (license license:bsd-2)))
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> new file mode 100644
> index 00000000..7ddedea9
> --- /dev/null
> +++ b/guix/build-system/mix.scm
> @@ -0,0 +1,187 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Standard build procedure for Elixir packages using 'mix'. This
> is
> +;; implemented as an extension of 'gnu-build-system'.
> +;;
> +;; Code:
> +
> +(define-module (guix build-system mix)
> + #:use-module (guix build mix-build-system)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> + #:use-module (guix gexp)
> + #:use-module (guix monads)
> + #:use-module (guix packages)
> + #:use-module (guix search-paths)
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (ice-9 match)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build-system hexpm-uri))
> +
> +;; Lazily resolve the bindings to avoid circular dependencies.
> +(define (default-glibc-utf8-locales)
> + (let* ((base (resolve-interface '(gnu packages base))))
> + (module-ref base 'glibc-utf8-locales)))
> +
> +(define (default-elixir-hex)
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir-hex)))
> +
> +(define (default-rebar3)
> + (let ((erlang (resolve-interface '(gnu packages erlang))))
> + (module-ref erlang 'rebar3)))
> +
> +(define (default-elixir)
> + "Return the default Elixir package."
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir)))
> +
> +(define* (strip-prefix name #:optional (prefix "elixir-"))
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
> +
> +(define (hexpm-uri name version)
> + "Return the URI where to fetch the sources of a Hex package NAME
> at VERSION.
> +NAME is the name of the package which should look like: elixir-pkg-
> name-X.Y.Z
> +See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
> + ((compose
> + (cut string-append "https://repo.hex.pm/tarballs/" <> "-"
> version ".tar")
> + (cut string-replace-substring <> "-" "_")
> + strip-prefix)
> + name))
> +
> +;; A number of environment variables specific to the Mix build
> system are
> +;; reflected here. They are documented at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
> Other
> +;; parameters located in mix.exs are defined at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
> +(define* (mix-build name
> + inputs
> + #:key
> + source
> + (tests? #t)
> + (mix-path #f) ;See MIX_PATH.
> + (mix-exs "mix.exs") ;See MIX_EXS.
> + (build-per-environment #t) ;See
> :build_per_environment.
> + (phases '%standard-phases)
> + (outputs '("out"))
> + (search-paths '())
> + (system (%current-system))
> + (guile #f)
> + (imported-modules `((guix build mix-build-
> system)
> + ,@%gnu-build-system-
> modules))
> + (modules '((guix build mix-build-system)
> + (guix build utils))))
> + "Build SOURCE using Elixir, and with INPUTS."
> +
> + ;; Check the documentation of :build_per_environment here:
> + ;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration A
> nd
> + ;; "Environments" here:
> + ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
> + (define mix-environments
> + (if build-per-environment
> + `("prod" ,@(if tests? '("test") '()))
> + '("shared")))
> +
> + (define builder
> + (with-imported-modules imported-modules
> + #~(begin
> +
> + (use-modules #$@(sexp->gexp modules))
> +
> + #$(with-build-variables inputs outputs
> + #~(mix-build #:name #$name
> + #:source #+source
> + #:system #$system
> + #:tests? #$tests?
> + #:mix-path #$mix-path
> + #:mix-exs #$mix-exs
> + #:mix-environments '#$mix-environments
> + #:build-per-environment #$build-per-
> environment
> + #:phases #$(if (pair? phases)
> + (sexp->gexp phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map
> + search-path-
> specification->sexp
> + search-paths))
> + #:inputs
> + %build-inputs)))))
> +
> + (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> + system
> + #:graft? #f)))
> + (gexp->derivation name
> + builder
> + #:system system
> + #:graft? #f ;consistent with 'gnu-build'
> + #:target #f
> + #:guile-for-build guile)))
> +
> +(define* (lower name
> + #:key
> + (elixir (default-elixir))
> + (elixir-hex (default-elixir-hex))
> + (glibc-utf8-locales (default-glibc-utf8-locales))
> + (inputs '())
> + (native-inputs '())
> + (propagated-inputs '())
> + (rebar3 (default-rebar3))
> + (tests? #t)
> + outputs
> + source
> + system
> + target
> + #:allow-other-keys #:rest arguments)
> + "Return a bag for NAME."
> + (let ((private-keywords
> + '(#:inputs #:native-inputs
> + #:outputs #:system #:target
> + #:elixir #:elixir-hex #:glibc-utf8-locales
> + #:rebar3 #:erlang))
> + (build-inputs
> + `(,@(standard-packages)
> + ("glibc-utf8-locales" ,glibc-utf8-locales)
> + ("erlang" ,(lookup-package-input elixir "erlang"))
> + ("rebar3" ,rebar3)
> + ("elixir" ,elixir)
> + ("elixir-hex" ,elixir-hex)
> + ,@inputs
> + ,@native-inputs)))
> + (bag (name name)
> + (system system)
> + (build-inputs build-inputs)
> + (host-inputs (if target inputs '()))
> + (outputs outputs)
> + (build mix-build)
> + (arguments (strip-keyword-arguments private-keywords
> arguments)))))
> +
> +(define mix-build-system
> + (build-system (name 'mix)
> + (description "The standard Mix build system")
> + (lower lower)))
> +
> +;;; mix.scm ends here
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> new file mode 100644
> index 00000000..ca649582
> --- /dev/null
> +++ b/guix/build/mix-build-system.scm
> @@ -0,0 +1,171 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Code:
> +
> +(define-module (guix build mix-build-system)
> + #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> + #:use-module (guix build utils)
> + #:use-module (ice-9 ftw)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 regex)
> + #:use-module (ice-9 string-fun)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:use-module (srfi srfi-71)
> + #:export (mix-build
> + %standard-phases))
> +
> +;; The Elixir version is constant as soon as it is computable from
> the current
> +;; execution. It is a X.Y string where X and Y are respectively the
> major and
> +;; minor version number of the Elixir used in the build.
> +(define %elixir-version (make-parameter "X.Y"))
> +
> +(define* (elixir-libdir path #:optional (version (%elixir-version)))
> + "Return the path where all libraries for a specified ELIXIR
> version are installed."
> + (string-append path "/lib/elixir/" version))
> +
> +(define (erlang-libdir path)
> + "Return the path of the directory where libraries of an Erlang
> package are
> +installed in the store."
> + (string-append path "/lib/erlang/lib"))
> +
> +(define* (strip-prefix name #:optional (prefix "elixir-"))
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
> +
> +(define (mix-build-dir mix-env)
> + "Return the directory where build artifacts are to be installed
> according to
> +en environment MIX-ENV in the current directory."
> + (string-append "_build/" mix-env "/lib"))
> +
> +(define (elixir-version inputs)
> + "Return an X.Y string where X and Y are respectively the major and
> minor version number of ELIXIR.
> +Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> + (let* ((_ version (package-name->name+version
> + (strip-store-file-name (assoc-ref inputs
> "elixir"))))
> + (components (string-split version #\.))
> + (major+minor (take components 2)))
> + (string-join major+minor ".")))
> +
> +(define* (unpack #:key source mix-path #:allow-other-keys)
> + "Unpack SOURCE in the working directory, and change directory
> within the
> +source. When SOURCE is a directory, copy it in a sub-directory of
> the current
> +working directory."
> + (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> + (gnu-unpack #:source source)
> + (when (file-exists? "contents.tar.gz")
> + (invoke "tar" "xvf" "contents.tar.gz"))))
> +
> +(define (list-directories dir)
> + "List absolute paths of directories directly under the directory
> DIR."
> + (map (cut string-append dir "/" <>)
> + (scandir dir (lambda (filename)
> + (and (not (member filename '("." "..")))
> + (directory-exists? (string-append dir "/"
> filename)))))))
> +
> +(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables.
> +See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
> + (setenv "MIX_HOME" (getcwd))
> + (setenv "MIX_ARCHIVES" "archives")
> + (setenv "MIX_BUILD_ROOT" "_build")
> + (setenv "MIX_DEPS_PATH" "deps")
> + (setenv "MIX_PATH" (or mix-path ""))
> + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3"))
> + (setenv "MIX_EXS" mix-exs)
> + (%elixir-version (elixir-version inputs)))
%elixir-version is not an environment variable. You should set this up
separately or at the very least add a big fat comment explaining what
you're doing here :)
> +
> +(define* (install-hex #:key name inputs outputs #:allow-other-keys)
> + "Install Hex."
> + (let ((hex-archive-path (string-append (getenv "MIX_ARCHIVES")
> "/hex")))
> + (mkdir-p hex-archive-path)
> + (symlink (car (list-directories (elixir-libdir (assoc-ref inputs
> "elixir-hex"))))
> + (string-append hex-archive-path "/hex"))))
Is this still needed?
> +(define* (install-dependencies . _)
> + "Install dependencies."
> + (setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS")))
Why not do this as part of setting up mix-env?
> +(define* (build #:key mix-environments #:allow-other-keys)
> + "Builds the Mix project."
> + (for-each (lambda (mix-env)
> + (setenv "MIX_ENV" mix-env)
> + (invoke "mix" "compile" "--no-deps-check"))
> + mix-environments))
> +
> +(define* (check #:key (tests? #t) #:allow-other-keys)
> + "Test the Mix project."
> + (if tests?
> + (invoke "mix" "test" "--no-deps-check")
> + (format #t "tests? = ~a~%" tests?)))
> +
> +(define* (remove-mix-dirs . _)
> + "Remove all .mix/ directories.
> +We do not want to copy them to the installation directory."
> + (for-each delete-file-recursively
> + (find-files "." (file-name-predicate "\\.mix$")
> #:directories? #t)))
> +
> +(define (package-name-version->elixir-name name+ver)
> + "Convert the Guix package NAME-VER to the corresponding Elixir
> name-version
> +format. Essentially drop the prefix used in Guix and replace dashes
> by
> +underscores."
> + (let* ((name- (package-name->name+version name+ver)))
> + (string-join
> + (string-split
> + (if (string-prefix? "elixir-" name-)
> + (string-drop name- (string-length "elixir-"))
> + name-)
> + #\-)
> + "_")))
> +
> +(define* (install #:key
> + inputs
> + outputs
> + name
> + build-per-environment
> + #:allow-other-keys)
> + "Install build artifacts in the store."
> + (let* ((lib-name (package-name-version->elixir-name name))
> + (lib-dir (string-append (elixir-libdir (assoc-ref outputs
> "out")) "/" lib-name)))
> + (mkdir-p lib-dir)
> + (copy-recursively (string-append (mix-build-dir (if build-per-
> environment "prod" "shared")) "/" lib-name)
> + lib-dir
> + #:follow-symlinks? #t)))
> +
> +(define %standard-phases
> + (modify-phases gnu:%standard-phases
> + (delete 'bootstrap)
> + (delete 'configure)
> + (add-after 'install-locale 'set-mix-env set-mix-env)
> + (replace 'unpack unpack)
> + (replace 'build build)
> + (replace 'check check)
> + (add-before 'install 'remove-mix-dirs remove-mix-dirs)
> + (replace 'install install)))
> +
> +(define* (mix-build #:key inputs (phases %standard-phases)
> + #:allow-other-keys #:rest args)
> + "Build the given Mix package, applying all of PHASES in order."
> + (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; mix-build-system.scm ends here
>
> base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-17 19:24 ` Liliana Marie Prikler
@ 2023-11-18 4:44 ` Pierre-Henry Fröhring
2023-11-18 7:12 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-18 4:44 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
* WAITING Comment
** lilyp
> * guix/build-system/mix.scm,
> * guix/build/mix-build-system.scm: New modules.
Avoid spanning a change across multiple files. Use
file: Change.
file2: Likewise.
> gnu/packages/elixir.scm | 62 ++++++++++-
> guix/build-system/mix.scm | 187
> ++++++++++++++++++++++++++++++++
> guix/build/mix-build-system.scm | 171 +++++++++++++++++++++++++++++
You committed two changes at once here. Split them.
** phf
How are changes counted? I've counted one because all of these changes
are needed
to introduce the ~mix-build-system~. Should it be:
#+begin_example
,* gnu/packages/elixir.scm (elixir): Search path GUIX_ELIXIR_LIBS added.
,* gnu/packages/elixir.scm (elixir): Wrap programs with
ERL_LIBS=${GUIX_ELIXIR_LIBS}.
,* guix/build-system/mix.scm: New modules.
,* guix/build/mix-build-system.scm: New modules.
#+end_example
or something else?
* WAITING Comment
** lilyp
> +(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables.
> +See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
> + (setenv "MIX_HOME" (getcwd))
> + (setenv "MIX_ARCHIVES" "archives")
> + (setenv "MIX_BUILD_ROOT" "_build")
> + (setenv "MIX_DEPS_PATH" "deps")
> + (setenv "MIX_PATH" (or mix-path ""))
> + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3"))
> + (setenv "MIX_EXS" mix-exs)
> + (%elixir-version (elixir-version inputs)))
%elixir-version is not an environment variable. You should set this up
separately or at the very least add a big fat comment explaining what
you're doing here :)
** phf
What about both?
#+begin_src scheme
(define* (set-elixir-version #:key inputs #:allow-other-keys)
"Set Elixir version.
Compiled libraries are specific to each Elixir version. If a library is intended
to be used with multiple Elixir versions, it needs to be compiled separately for
each version. The parameter %elixir-version, set for the current build, is used
to differentiate between the compiled versions of libraries corresponding to
different Elixir versions."
(%elixir-version (elixir-version inputs))
(format #t "Elixir version: ~a~%" (%elixir-version)))
#+end_src
* WAITING Comment
** lilyp
> + (list (search-path-specification
> + (variable "GUIX_ERL_LIBS")
> + (files (list "lib/erlang/lib"
> + (string-append "lib/elixir/" (version-
> major+minor version)))))))
I suppose ERL is for erlang? What do we use for elixir then?
** phf
Changed for ~GUIX_ELIXIR_LIBS~. Is that OK?
* WAITING Comment
** lilyp
> +(define* (install-dependencies . _)
> + "Install dependencies."
> + (setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS")))
Why not do this as part of setting up mix-env?
** phf
If we have this phase in the ~elixir~ package:
#+begin_src scheme
(add-after 'install 'wrap-programs
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(programs '("elixir" "elixirc" "iex" "mix")))
(for-each (lambda (program)
(wrap-program (string-append out "/bin/" program)
'("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
programs))))
#+end_src
and this native search path:
#+begin_src scheme
(search-path-specification
(variable "GUIX_ELIXIR_LIBS")
(files (list "lib/erlang/lib"
(string-append "lib/elixir/"
(version-major+minor version)))))
#+end_src
then, ~(setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS"))~ is not needed anymore.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-18 4:44 ` Pierre-Henry Fröhring
@ 2023-11-18 7:12 ` Liliana Marie Prikler
2023-11-18 10:19 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-18 7:12 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Samstag, dem 18.11.2023 um 05:44 +0100 schrieb Pierre-Henry
Fröhring:
> * WAITING Comment
> ** lilyp
> > * guix/build-system/mix.scm,
> > * guix/build/mix-build-system.scm: New modules.
> Avoid spanning a change across multiple files. Use
> file: Change.
> file2: Likewise.
>
> > gnu/packages/elixir.scm | 62 ++++++++++-
> > guix/build-system/mix.scm | 187
> > ++++++++++++++++++++++++++++++++
> > guix/build/mix-build-system.scm | 171
> > +++++++++++++++++++++++++++++
> You committed two changes at once here. Split them.
>
>
> ** phf
> How are changes counted? I've counted one because all of these
> changes
> are needed
> to introduce the ~mix-build-system~. Should it be:
> #+begin_example
> ,* gnu/packages/elixir.scm (elixir): Search path GUIX_ELIXIR_LIBS
> added.
> ,* gnu/packages/elixir.scm (elixir): Wrap programs with
> ERL_LIBS=${GUIX_ELIXIR_LIBS}.
> ,* guix/build-system/mix.scm: New modules.
> ,* guix/build/mix-build-system.scm: New modules.
> #+end_example
> or something else?
You can add the two build-system files in one go. The changes to
elixir and the new elixir-hex package are one patch each.
> * WAITING Comment
> ** lilyp
> > +(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-
> > keys)
> > + "Set environment variables.
> > +See:
> > https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables
> > "
> > + (setenv "MIX_HOME" (getcwd))
> > + (setenv "MIX_ARCHIVES" "archives")
> > + (setenv "MIX_BUILD_ROOT" "_build")
> > + (setenv "MIX_DEPS_PATH" "deps")
> > + (setenv "MIX_PATH" (or mix-path ""))
> > + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> > "/bin/rebar3"))
> > + (setenv "MIX_EXS" mix-exs)
> > + (%elixir-version (elixir-version inputs)))
> %elixir-version is not an environment variable. You should set this
> up
> separately or at the very least add a big fat comment explaining what
> you're doing here :)
>
>
> ** phf
> What about both?
> #+begin_src scheme
> (define* (set-elixir-version #:key inputs #:allow-other-keys)
> "Set Elixir version.
> Compiled libraries are specific to each Elixir version. If a library
> is intended
> to be used with multiple Elixir versions, it needs to be compiled
> separately for
> each version. The parameter %elixir-version, set for the current
> build, is used
> to differentiate between the compiled versions of libraries
> corresponding to
> different Elixir versions."
> (%elixir-version (elixir-version inputs))
> (format #t "Elixir version: ~a~%" (%elixir-version)))
> #+end_src
I just noticed that, but do prefer to spaces after sentence ending
periods. For the docstring, I think you should make clear what is
going on from the beginning, e.g.
"Store the version number of the elixir input in a parameter."
> * WAITING Comment
> ** lilyp
> > + (list (search-path-specification
> > + (variable "GUIX_ERL_LIBS")
> > + (files (list "lib/erlang/lib"
> > + (string-append "lib/elixir/" (version-
> > major+minor version)))))))
> I suppose ERL is for erlang? What do we use for elixir then?
>
>
> ** phf
> Changed for ~GUIX_ELIXIR_LIBS~. Is that OK?
No, because it's still ERL on the other side. A quick web search
reveals that this belongs to erlang.
>
> * WAITING Comment
> ** lilyp
> > +(define* (install-dependencies . _)
> > + "Install dependencies."
> > + (setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS")))
> Why not do this as part of setting up mix-env?
>
>
> ** phf
> If we have this phase in the ~elixir~ package:
> #+begin_src scheme
> (add-after 'install 'wrap-programs
> (lambda* (#:key inputs outputs #:allow-other-keys)
> (let* ((out (assoc-ref outputs "out"))
> (programs '("elixir" "elixirc" "iex" "mix")))
> (for-each (lambda (program)
> (wrap-program (string-append out "/bin/"
> program)
> '("ERL_LIBS" prefix
> ("${GUIX_ELIXIR_LIBS}"))))
> programs))))
> #+end_src
>
> and this native search path:
> #+begin_src scheme
> (search-path-specification
> (variable "GUIX_ELIXIR_LIBS")
> (files (list "lib/erlang/lib"
> (string-append "lib/elixir/"
> (version-major+minor version)))))
> #+end_src
>
> then, ~(setenv "ERL_LIBS" (getenv "GUIX_ERL_LIBS"))~ is not needed
> anymore.
True, but it's still given in the source files. :)
So you can delete it of course (if it's already done by the native-
search-path and package as you claim), or you can make it part of the
environment setup (if it's not).
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-18 7:12 ` Liliana Marie Prikler
@ 2023-11-18 10:19 ` Pierre-Henry Fröhring
2023-11-18 11:11 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-18 10:19 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
> > Changed for ~GUIX_ELIXIR_LIBS~. Is that OK?
> No, because it's still ERL on the other side. A quick web search
> reveals that this belongs to erlang.
Yes, ERL_LIBS is valid for both Erlang and Elixir.
So, GUIX_ERL_LIBS for both, right?
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-18 10:19 ` Pierre-Henry Fröhring
@ 2023-11-18 11:11 ` Liliana Marie Prikler
2023-11-18 12:02 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-11-18 11:11 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Samstag, dem 18.11.2023 um 11:19 +0100 schrieb Pierre-Henry
Fröhring:
> > > Changed for ~GUIX_ELIXIR_LIBS~. Is that OK?
> > No, because it's still ERL on the other side. A quick web search
> > reveals that this belongs to erlang.
> Yes, ERL_LIBS is valid for both Erlang and Elixir.
> So, GUIX_ERL_LIBS for both, right?
I'm not sure whether we really need the GUIX_ prefix here; you'd have
to check whether the justification for GUIX_PYTHONPATH also holds for
erlang and elixir.
Anyhow, assuming that elixir and erlang code can be used interchangedly
by each once compiled, you should use a single (GUIX_)?ERL_LIBS in both
packages. You might also see whether we could use a single path
instead of needing the lib/erlang and lib/elixir split, but I leave
that up to you.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/14] build-system: Add mix-build-system.
2023-11-18 11:11 ` Liliana Marie Prikler
@ 2023-11-18 12:02 ` Pierre-Henry Fröhring
0 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-11-18 12:02 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
** lilyp
I'm not sure whether we really need the GUIX_ prefix here; you'd have to check
whether the justification for GUIX_PYTHONPATH also holds for erlang and
elixir.
*** phf
Replacing "Python" by "Elixir" in
https://guix.gnu.org/manual/en/html_node/Build-Systems.html, we have:
#+begin_quote
For packages that install stand-alone Elixir programs under bin/, it takes
care of wrapping these programs so that their GUIX_ERL_LIBS environment
variable points to all the compiled Elixir and Erlang libraries they depend
on.
#+end_quote
This seems reasonable for Elixir stand-alone programs.
#+begin_quote
Which Elixir package is used to perform the build can be specified with the
#:elixir parameter. This is a useful way to force a package to be built for a
specific version of the Elixir interpreter, which might be necessary if the
package is only compatible with a single interpreter version.
#+end_quote
Reading: https://hexdocs.pm/elixir/1.15.7/compatibility-and-deprecations.html,
this seems reasonable too.
This seems to point to GUIX_ERL_LIBS rather than ERL_LIBS.
** lilyp
Anyhow, assuming that elixir and erlang code can be used interchangeably by
each once compiled, you should use a single (GUIX_)?ERL_LIBS in both packages.
You might also see whether we could use a single path instead of needing the
lib/erlang and lib/elixir split, but I leave that up to you.
*** phf
"elixir and erlang code can be used interchangeably by each once compiled" is
true because: "Elixir compiles into BEAM byte code (via Erlang Abstract
Format). This means that Elixir code can be called from Erlang and vice versa,
without the need to write any bindings." See:
https://elixir-lang.org/crash-course.html#adding-elixir-to-existing-erlang-programs
Ha… finally, we see that things should change on the Erlang side too.
According to
https://hexdocs.pm/elixir/1.15.7/compatibility-and-deprecations.html, to a
version of Elixir are associated with a few versions of compatible
Erlang/OTP. Since the Elixir package mentions a particular version of Erlang,
then it means that we have X.Y version of Elixir and U.V version for Erlang.
If we have a single path like lib/beam/A.B, then A.B is rather ambiguous. If
instead we have lib/erlang/U.V and lib/elixir/X.Y, then no ambiguities.
This seems to point to lib/erlang/U.V and lib/elixir/X.Y.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (6 preceding siblings ...)
2023-11-17 8:03 ` Pierre-Henry Fröhring
@ 2023-12-07 22:34 ` Pierre-Henry Fröhring
2023-12-08 7:25 ` Liliana Marie Prikler
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
` (5 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-07 22:34 UTC (permalink / raw)
To: 66801; +Cc: Pierre-Henry Fröhring, liliana.prikler
* guix/build-system/mix.scm: New file.
* guix/build/mix-build-system.scm: New file.
Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
---
guix/build-system/mix.scm | 186 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
2 files changed, 347 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 000000000..1b04053d7
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,186 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cute string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cute string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 000000000..fe2e36d18
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,161 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries under PATH for a specified Elixir
+VERSION are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-build-root mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory. MIX-BUILD-ROOT depends on the
+package arguments. See: https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
+ (string-append mix-build-root "/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of PACKAGE.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cute string-join <> ".")
+ (cute take <> 2)
+ (cute string-split <> #\.)
+ strip-prefix
+ strip-store-file-name)
+ (assoc-ref inputs "elixir")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cute string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_EXS" mix-exs)
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3")))
+
+(define* (set-elixir-version #:key inputs #:allow-other-keys)
+ "Store the version number of the Elixir input in a parameter."
+ (%elixir-version (elixir-version inputs))
+ (format #t "Elixir version: ~a~%" (%elixir-version)))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
+ ((compose
+ (cute string-join <> "_")
+ (cute drop-right <> 1)
+ (cute string-split <> #\-))
+ (strip-prefix name+ver)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name))
+ (root (getenv "MIX_BUILD_ROOT"))
+ (env (if build-per-environment "prod" "shared")))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir root env) "/" lib-name) lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-07 22:34 ` [bug#66801] [PATCH] " Pierre-Henry Fröhring
@ 2023-12-08 7:25 ` Liliana Marie Prikler
2023-12-08 8:01 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 7:25 UTC (permalink / raw)
To: Pierre-Henry Fröhring, 66801
Am Donnerstag, dem 07.12.2023 um 23:34 +0100 schrieb Pierre-Henry
Fröhring:
> * guix/build-system/mix.scm: New file.
> * guix/build/mix-build-system.scm: New file.
>
> Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
> ---
Pretty sure you forgot the reroll-count in the header. Please don't :)
> guix/build-system/mix.scm | 186
> ++++++++++++++++++++++++++++++++
> guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
> 2 files changed, 347 insertions(+)
> create mode 100644 guix/build-system/mix.scm
> create mode 100644 guix/build/mix-build-system.scm
>
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> new file mode 100644
> index 000000000..1b04053d7
> --- /dev/null
> +++ b/guix/build-system/mix.scm
> @@ -0,0 +1,186 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Standard build procedure for Elixir packages using 'mix'. This
> is
> +;; implemented as an extension of 'gnu-build-system'.
> +;;
> +;; Code:
> +
> +(define-module (guix build-system mix)
> + #:use-module (guix build mix-build-system)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system)
> + #:use-module (guix gexp)
> + #:use-module (guix monads)
> + #:use-module (guix packages)
> + #:use-module (guix search-paths)
> + #:use-module (guix store)
> + #:use-module (guix utils)
> + #:use-module (ice-9 match)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:export (mix-build-system hexpm-uri))
> +
> +;; Lazily resolve bindings to avoid circular dependencies.
> +(define (default-glibc-utf8-locales)
> + (let* ((base (resolve-interface '(gnu packages base))))
> + (module-ref base 'glibc-utf8-locales)))
> +
> +(define (default-elixir-hex)
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir-hex)))
> +
> +(define (default-rebar3)
> + (let ((erlang (resolve-interface '(gnu packages erlang))))
> + (module-ref erlang 'rebar3)))
> +
> +(define (default-elixir)
> + (let ((elixir (resolve-interface '(gnu packages elixir))))
> + (module-ref elixir 'elixir)))
> +
> +(define* (strip-prefix name #:optional (prefix "elixir-"))
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
> +
> +(define (hexpm-uri name version)
> + "Return the URI where to fetch the sources of a Hex package NAME
> at VERSION.
> +NAME is the name of the package which should look like: elixir-pkg-
> name-X.Y.Z
> +See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
> + ((compose
> + (cute string-append "https://repo.hex.pm/tarballs/" <> "-"
> version ".tar")
> + (cute string-replace-substring <> "-" "_")
> + strip-prefix)
> + name))
> +
> +;; A number of environment variables specific to the Mix build
> system are
> +;; reflected here. They are documented at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
> Other
> +;; parameters located in mix.exs are defined at
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
> +(define* (mix-build name
> + inputs
> + #:key
> + source
> + (tests? #t)
> + (mix-path #f) ;See MIX_PATH.
> + (mix-exs "mix.exs") ;See MIX_EXS.
> + (build-per-environment #t) ;See
> :build_per_environment.
> + (phases '%standard-phases)
> + (outputs '("out"))
> + (search-paths '())
> + (system (%current-system))
> + (guile #f)
> + (imported-modules `((guix build mix-build-
> system)
> + ,@%gnu-build-system-
> modules))
> + (modules '((guix build mix-build-system)
> + (guix build utils))))
> + "Build SOURCE using Elixir, and with INPUTS."
> +
> + ;; Check the documentation of :build_per_environment here:
> + ;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration A
> nd
> + ;; "Environments" here:
> + ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
> + (define mix-environments
> + (if build-per-environment
> + `("prod" ,@(if tests? '("test") '()))
> + '("shared")))
> +
> + (define builder
> + (with-imported-modules imported-modules
> + #~(begin
> +
> + (use-modules #$@(sexp->gexp modules))
> +
> + #$(with-build-variables inputs outputs
> + #~(mix-build #:name #$name
> + #:source #+source
> + #:system #$system
> + #:tests? #$tests?
> + #:mix-path #$mix-path
> + #:mix-exs #$mix-exs
> + #:mix-environments '#$mix-environments
> + #:build-per-environment #$build-per-
> environment
> + #:phases #$(if (pair? phases)
> + (sexp->gexp phases)
> + phases)
> + #:outputs %outputs
> + #:search-paths '#$(sexp->gexp
> + (map
> + search-path-
> specification->sexp
> + search-paths))
> + #:inputs
> + %build-inputs)))))
> +
> + (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> + system
> + #:graft? #f)))
> + (gexp->derivation name
> + builder
> + #:system system
> + #:graft? #f ;consistent with 'gnu-build'
> + #:target #f
> + #:guile-for-build guile)))
> +
> +(define* (lower name
> + #:key
> + (elixir (default-elixir))
> + (elixir-hex (default-elixir-hex))
> + (glibc-utf8-locales (default-glibc-utf8-locales))
> + (inputs '())
> + (native-inputs '())
> + (propagated-inputs '())
> + (rebar3 (default-rebar3))
> + (tests? #t)
> + outputs
> + source
> + system
> + target
> + #:allow-other-keys #:rest arguments)
> + "Return a bag for NAME."
> + (let ((private-keywords
> + '(#:inputs #:native-inputs
> + #:outputs #:system #:target
> + #:elixir #:elixir-hex #:glibc-utf8-locales
> + #:rebar3 #:erlang))
> + (build-inputs
> + `(,@(standard-packages)
> + ("glibc-utf8-locales" ,glibc-utf8-locales)
> + ("erlang" ,(lookup-package-input elixir "erlang"))
> + ("rebar3" ,rebar3)
> + ("elixir" ,elixir)
> + ("elixir-hex" ,elixir-hex)
> + ,@inputs
> + ,@native-inputs)))
> + (bag (name name)
> + (system system)
> + (build-inputs build-inputs)
> + (host-inputs (if target inputs '()))
> + (outputs outputs)
> + (build mix-build)
> + (arguments (strip-keyword-arguments private-keywords
> arguments)))))
> +
> +(define mix-build-system
> + (build-system (name 'mix)
> + (description "The standard Mix build system")
> + (lower lower)))
> +
> +;;; mix.scm ends here
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> new file mode 100644
> index 000000000..fe2e36d18
> --- /dev/null
> +++ b/guix/build/mix-build-system.scm
> @@ -0,0 +1,161 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Code:
> +
> +(define-module (guix build mix-build-system)
> + #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> + #:use-module (guix build utils)
> + #:use-module (ice-9 ftw)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 regex)
> + #:use-module (ice-9 string-fun)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26)
> + #:use-module (srfi srfi-71)
> + #:export (mix-build
> + %standard-phases))
> +
> +;; The Elixir version is constant as soon as it is computable from
> the current
> +;; execution. It is a X.Y string where X and Y are respectively the
> major and
> +;; minor version number of the Elixir used in the build.
> +(define %elixir-version (make-parameter "X.Y"))
> +
> +(define* (elixir-libdir path #:optional (version (%elixir-version)))
> + "Return the path where all libraries under PATH for a specified
> Elixir
> +VERSION are installed."
> + (string-append path "/lib/elixir/" version))
> +
> +(define* (strip-prefix name #:optional (prefix "elixir-"))
> + "Return NAME without the prefix PREFIX."
> + (if (string-prefix? prefix name)
> + (string-drop name (string-length prefix))
> + name))
> +
> +(define (mix-build-dir mix-build-root mix-env)
> + "Return the directory where build artifacts are to be installed
> according to
> +en environment MIX-ENV in the current directory. MIX-BUILD-ROOT
> depends on the
> +package arguments. See:
> https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
> + (string-append mix-build-root "/" mix-env "/lib"))
> +
> +(define (elixir-version inputs)
> + "Return an X.Y string where X and Y are respectively the major and
> minor version number of PACKAGE.
> +Example: /gnu/store/…-elixir-1.14.0 → 1.14"
> + ((compose
> + (cute string-join <> ".")
> + (cute take <> 2)
> + (cute string-split <> #\.)
> + strip-prefix
> + strip-store-file-name)
> + (assoc-ref inputs "elixir")))
Note that when cross-compiling, elixir would likely be a native-input
rather than an input. Neither this procedure nor its callers appear to
be aware of that.
You can keep the compose intact if you do
(and=> (assoc-ref inputs "elixir")
(compose ...))
Then you can call it as
(or (elixir-version native-inputs) (elixir-version inputs))
> +(define* (unpack #:key source mix-path #:allow-other-keys)
> + "Unpack SOURCE in the working directory, and change directory
> within the
> +source. When SOURCE is a directory, copy it in a sub-directory of
> the current
> +working directory."
> + (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> + (gnu-unpack #:source source)
> + (when (file-exists? "contents.tar.gz")
> + (invoke "tar" "xvf" "contents.tar.gz"))))
> +
> +(define (list-directories dir)
> + "List absolute paths of directories directly under the directory
> DIR."
> + (map (cute string-append dir "/" <>)
> + (scandir dir (lambda (filename)
> + (and (not (member filename '("." "..")))
> + (directory-exists? (string-append dir "/"
> filename)))))))
> +
> +(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-
> keys)
> + "Set environment variables.
> +See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
> + (setenv "MIX_ARCHIVES" "archives")
> + (setenv "MIX_BUILD_ROOT" "_build")
> + (setenv "MIX_DEPS_PATH" "deps")
> + (setenv "MIX_EXS" mix-exs)
> + (setenv "MIX_HOME" (getcwd))
> + (setenv "MIX_PATH" (or mix-path ""))
> + (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3")
> "/bin/rebar3")))
> +
> +(define* (set-elixir-version #:key inputs #:allow-other-keys)
> + "Store the version number of the Elixir input in a parameter."
> + (%elixir-version (elixir-version inputs))
> + (format #t "Elixir version: ~a~%" (%elixir-version)))
> +
> +(define* (build #:key mix-environments #:allow-other-keys)
> + "Builds the Mix project."
> + (for-each (lambda (mix-env)
> + (setenv "MIX_ENV" mix-env)
> + (invoke "mix" "compile" "--no-deps-check"))
> + mix-environments))
> +
> +(define* (check #:key (tests? #t) #:allow-other-keys)
> + "Test the Mix project."
> + (if tests?
> + (invoke "mix" "test" "--no-deps-check")
> + (format #t "tests? = ~a~%" tests?)))
> +
> +(define* (remove-mix-dirs . _)
> + "Remove all .mix/ directories.
> +We do not want to copy them to the installation directory."
> + (for-each delete-file-recursively
> + (find-files "." (file-name-predicate "\\.mix$")
> #:directories? #t)))
> +
> +(define (package-name->elixir-name name+ver)
> + "Convert the Guix package NAME-VER to the corresponding Elixir
> name-version
> +format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
> + ((compose
> + (cute string-join <> "_")
> + (cute drop-right <> 1)
> + (cute string-split <> #\-))
> + (strip-prefix name+ver)))
> +
> +(define* (install #:key
> + inputs
> + outputs
> + name
> + build-per-environment
> + #:allow-other-keys)
> + "Install build artifacts in the store."
> + (let* ((lib-name (package-name->elixir-name name))
> + (lib-dir (string-append (elixir-libdir (assoc-ref outputs
> "out")) "/" lib-name))
> + (root (getenv "MIX_BUILD_ROOT"))
> + (env (if build-per-environment "prod" "shared")))
> + (mkdir-p lib-dir)
> + (copy-recursively (string-append (mix-build-dir root env) "/"
> lib-name) lib-dir
> + #:follow-symlinks? #t)))
> +
> +(define %standard-phases
> + (modify-phases gnu:%standard-phases
> + (delete 'bootstrap)
> + (delete 'configure)
> + (add-after 'install-locale 'set-mix-env set-mix-env)
> + (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
> + (replace 'unpack unpack)
> + (replace 'build build)
> + (replace 'check check)
> + (add-before 'install 'remove-mix-dirs remove-mix-dirs)
> + (replace 'install install)))
> +
> +(define* (mix-build #:key inputs (phases %standard-phases)
> + #:allow-other-keys #:rest args)
> + "Build the given Mix package, applying all of PHASES in order."
> + (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; mix-build-system.scm ends here
>
> base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
Would you be so nice as to send a complete series as a revision? We
have focused quite a lot on the intricacies of rebar-build-system and
mix-build-system in the past review, but for testing purposes, it would
be nice to have some (minimal set of) packages that we can build with
those improvements.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 7:25 ` Liliana Marie Prikler
@ 2023-12-08 8:01 ` Pierre-Henry Fröhring
2023-12-08 9:52 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 8:01 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
Hello lilyp,
Would you be so nice as to send a complete series as a revision? We
have focused quite a lot on the intricacies of rebar-build-system and
mix-build-system in the past review, but for testing purposes, it would
be nice to have some (minimal set of) packages that we can build with
those improvements.
All of them will be sent. I cannot send you all the patches at once — /i.e./ those
linked to Erlang and Elixir — as it has proved to be too time-consuming given my
inexperience in the Guix code base among other things.
Thanks to your patient feedback, I hope to be able to send all the patches — more
that 70 of them — but let us agree on the sequence before end as I do not want to
bother you with contingent errors.
Please, tell me if these sequences of patches work with you:
1. Send patches linked to Elixir, independently of Erlang.
2. Send patches linked to Erlang, independently of Elixir.
3. Send remaining patches where Elixir packages rely on Erlang packages.
For completeness, the case where Erlang packages rely on Elixir packages should be
addressed too, but I do not have code testing that case so far. We will probably
take care of this case afterward.
The first sequence of commits allows to build the elixir-machete package which is one
of the few packages that have tests. This sequence of commits does not need any
modification to the rebar build system or the Erlang package. These commits are on a
local branch at the moment:
┌────
│ f50ed258f * gnu: Add elixir-machete.
│ 8b1cd4584 * gnu: Add elixir-dialyxir.
│ 04f1a0488 * gnu: Add elixir-erlex.
│ 51f3ea964 * gnu: Add elixir-credo.
│ c635210a2 * gnu: Add elixir-excoveralls.
│ 2ed400127 * gnu: Add elixir-castore.
│ fa45db5f6 * gnu: Add elixir-inch-ex.
│ 780e57c56 * gnu: Add elixir-bunt.
│ 52c57d6a7 * gnu: Add elixir-file-system.
│ 6b1f61851 * gnu: Add elixir-jason.
│ 283d647cf * gnu: Add elixir-makeup.
│ a2dd3114c * gnu: Add elixir-nimble-parsec.
│ 0e6d80e9d * gnu: Add elixir-hex.
│ 9e842f9c9 * gnu: elixir: Wrap binaries.
│ 5b40ab6fd * build-system: Add mix-build-system.
└────
So, is it OK if we manage this sequence of patches above before proceeding further?
If it is the case, then I will send them one by one so that your suggestions on one patch will
help me fix the next before sending it.
Cheers.
P.S. My last message that you received yesterday does not appear in this
thread <https://issues.guix.gnu.org/66801>.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 8:01 ` Pierre-Henry Fröhring
@ 2023-12-08 9:52 ` Liliana Marie Prikler
2023-12-08 10:17 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 9:52 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 09:01 +0100 schrieb Pierre-Henry
Fröhring:
> Please, tell me if these sequences of patches work with you:
> 1. Send patches linked to Elixir, independently of Erlang.
> 2. Send patches linked to Erlang, independently of Elixir.
> 3. Send remaining patches where Elixir packages rely on Erlang
> packages.
If this series works for you, it ought to work for us as well. The
important thing is that immediate results can be verified to build.
> For completeness, the case where Erlang packages rely on Elixir
> packages should be addressed too, but I do not have code testing that
> case so far. We will probably take care of this case afterward.
Yeah, that sounds like a premature optimization otherwise.
> The first sequence of commits allows to build the elixir-machete
> package which is one of the few packages that have tests. This
> sequence of commits does not need any modification to the rebar build
> system or the Erlang package. These commits are on a local branch at
> the moment:
>
> ┌────
> │ f50ed258f * gnu: Add elixir-machete.
> │ 8b1cd4584 * gnu: Add elixir-dialyxir.
> │ 04f1a0488 * gnu: Add elixir-erlex.
> │ 51f3ea964 * gnu: Add elixir-credo.
> │ c635210a2 * gnu: Add elixir-excoveralls.
> │ 2ed400127 * gnu: Add elixir-castore.
> │ fa45db5f6 * gnu: Add elixir-inch-ex.
> │ 780e57c56 * gnu: Add elixir-bunt.
> │ 52c57d6a7 * gnu: Add elixir-file-system.
> │ 6b1f61851 * gnu: Add elixir-jason.
> │ 283d647cf * gnu: Add elixir-makeup.
> │ a2dd3114c * gnu: Add elixir-nimble-parsec.
> │ 0e6d80e9d * gnu: Add elixir-hex.
> │ 9e842f9c9 * gnu: elixir: Wrap binaries.
> │ 5b40ab6fd * build-system: Add mix-build-system.
> └────
LGTM, but I prefer the order that's given in the cover-letter produced
by format-patch, with the first patch applied being first :)
> So, is it OK if we manage this sequence of patches above before
> proceeding further?
> If it is the case, then I will send them one by one so that your
> suggestions on one patch will help me fix the next before sending it.
SGTM. If you're unfamiliar with git send-email, at least use git
format-patch and an appropriate reroll-count (IIRC, we're at 3, but I
could be misremembering), then send each of the resulting mboxes
individually or bundle them up as attachments.
> P.S. My last message that you received yesterday does not appear in
> this thread <https://issues.guix.gnu.org/66801>.
Yeah, mumi is currently slow on the uptake – dunno what's wrong there.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 9:52 ` Liliana Marie Prikler
@ 2023-12-08 10:17 ` Pierre-Henry Fröhring
2023-12-08 11:50 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 10:17 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
If this series works for you, it ought to work for us as well. The important thing
is that immediate results can be verified to build.
Great. So here comes the series of patches. The list of all patches is:
┌────
│ 0001-build-system-Add-mix-build-system.patch
│ 0002-gnu-elixir-Wrap-binaries.patch
│ 0003-gnu-Add-elixir-hex.patch
│ 0004-gnu-Add-elixir-nimble-parsec.patch
│ 0005-gnu-Add-elixir-makeup.patch
│ 0006-gnu-Add-elixir-jason.patch
│ 0007-gnu-Add-elixir-file-system.patch
│ 0008-gnu-Add-elixir-bunt.patch
│ 0009-gnu-Add-elixir-inch-ex.patch
│ 0010-gnu-Add-elixir-castore.patch
│ 0011-gnu-Add-elixir-excoveralls.patch
│ 0012-gnu-Add-elixir-credo.patch
│ 0013-gnu-Add-elixir-erlex.patch
│ 0014-gnu-Add-elixir-dialyxir.patch
│ 0015-gnu-Add-elixir-machete.patch
└────
I will start with the first 3. To test them, I have issued the following command:
┌────
│ ./pre-inst-env guix build elixir-hex
└────
which result was:
┌────
│ …
│ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-elixir-hex-2.0.5.drv
│ /gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-2.0.5
└────
If everything is correct, I will send the other ones.
Cheers.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 10:17 ` Pierre-Henry Fröhring
@ 2023-12-08 11:50 ` Liliana Marie Prikler
2023-12-08 14:20 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 11:50 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 11:17 +0100 schrieb Pierre-Henry
Fröhring:
> I will start with the first 3. To test them, I have issued the
> following command:
> ┌────
> │ ./pre-inst-env guix build elixir-hex
> └────
>
> which result was:
> ┌────
> │ …
> │ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-
> elixir-hex-2.0.5.drv
> │ /gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-2.0.5
> └────
>
> If everything is correct, I will send the other ones.
For the record, I get these hashes on current master:
grafting '/gnu/store/dapdrihxaxfxfcky51sr4607a79msgp6-elixir-hex-2.0.5'
-> '/gnu/store/blg85m7a4jd9cdyc6q9m96lnxf9d97h0-elixir-hex-2.0.5'
And you still forgot the reroll-count. Don't forget the reroll-count.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 11:50 ` Liliana Marie Prikler
@ 2023-12-08 14:20 ` Pierre-Henry Fröhring
2023-12-08 14:55 ` Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 14:20 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
For the record, I get these hashes on current master:
grafting '/gnu/store/dapdrihxaxfxfcky51sr4607a79msgp6-elixir-hex-2.0.5'
-> '/gnu/store/blg85m7a4jd9cdyc6q9m96lnxf9d97h0-elixir-hex-2.0.5'
I do not know exactly how to hash is computed. The previous build of elixir-hex has
been done after rebasing the commits on top of the commit `06f25a9a8' of master. For
the record:
┌────
│ git show --oneline -s
└────
┌────
│ 0fcd231da (HEAD -> master) gnu: Add elixir-machete.
└────
┌────
│ ./pre-inst-env guix build --check elixir-hex
└────
┌────
│ The following graft will be made:
│ /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-elixir-hex-2.0.5.drv
│ applying 1 graft for elixir-hex-2.0.5 ...
│ grafting '/gnu/store/dapdrihxaxfxfcky51sr4607a79msgp6-elixir-hex-2.0.5' -> '/gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-2.0.5'...
│ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-elixir-hex-2.0.5.drv
│ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-elixir-hex-2.0.5.drv
│ /gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-2.0.5
└────
And you still forgot the reroll-count. Don't forget the reroll-count.
Well, what I assumed the "reroll-count" was was wrong. You mean the `v<n>' in `[PATCH
v<n>]' in the subject of the patches? In my next email, I will send the same patches
except that I will use the `--reroll-count=3' option to build them.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH] build-system: Add mix-build-system.
2023-12-08 14:20 ` Pierre-Henry Fröhring
@ 2023-12-08 14:55 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 14:55 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 15:20 +0100 schrieb Pierre-Henry
Fröhring:
> For the record, I get these hashes on current master:
>
> grafting '/gnu/store/dapdrihxaxfxfcky51sr4607a79msgp6-elixir-
> hex-2.0.5'
> -> '/gnu/store/blg85m7a4jd9cdyc6q9m96lnxf9d97h0-elixir-
> hex-2.0.5'
>
> I do not know exactly how to hash is computed. The previous build of
> elixir-hex has been done after rebasing the commits on top of the
> commit `06f25a9a8' of master. For the record:
> ┌────
> │ git show --oneline -s
> └────
>
> ┌────
> │ 0fcd231da (HEAD -> master) gnu: Add elixir-machete.
> └────
>
> ┌────
> │ ./pre-inst-env guix build --check elixir-hex
> └────
>
> ┌────
> │ The following graft will be made:
> │ /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-elixir-hex-2.0.5.drv
> │ applying 1 graft for elixir-hex-2.0.5 ...
> │ grafting '/gnu/store/dapdrihxaxfxfcky51sr4607a79msgp6-elixir-hex-
> 2.0.5' -> '/gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-
> 2.0.5'...
> │ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-
> elixir-hex-2.0.5.drv
> │ successfully built /gnu/store/1732zx2s5afv1da5vhik0gr923frvg35-
> elixir-hex-2.0.5.drv
> │ /gnu/store/hak603f9adwad1vrlqkqn6ywgissfb13-elixir-hex-2.0.5
> └────
I don't get the same hashes, but at least locally, --check succeeds.
> Well, what I assumed the "reroll-count" was was wrong. You mean the
> `v<n>' in `[PATCH v<n>]' in the subject of the patches? In my next
> email, I will send the same patches except that I will use the `--
> reroll-count=3' option to build them.
Yep, that's what I meant. Feel free to also send 04..15.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 01/15] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (7 preceding siblings ...)
2023-12-07 22:34 ` [bug#66801] [PATCH] " Pierre-Henry Fröhring
@ 2023-12-08 11:10 ` Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (4 subsequent siblings)
13 siblings, 2 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 11:10 UTC (permalink / raw)
To: liliana.prikler; +Cc: Pierre-Henry Fröhring, 66801
* guix/build-system/mix.scm: New file.
* guix/build/mix-build-system.scm: New file.
Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
---
guix/build-system/mix.scm | 186 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
2 files changed, 347 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 000000000..1b04053d7
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,186 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cute string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cute string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 000000000..fe2e36d18
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,161 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries under PATH for a specified Elixir
+VERSION are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-build-root mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory. MIX-BUILD-ROOT depends on the
+package arguments. See: https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
+ (string-append mix-build-root "/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of PACKAGE.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cute string-join <> ".")
+ (cute take <> 2)
+ (cute string-split <> #\.)
+ strip-prefix
+ strip-store-file-name)
+ (assoc-ref inputs "elixir")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cute string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_EXS" mix-exs)
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3")))
+
+(define* (set-elixir-version #:key inputs #:allow-other-keys)
+ "Store the version number of the Elixir input in a parameter."
+ (%elixir-version (elixir-version inputs))
+ (format #t "Elixir version: ~a~%" (%elixir-version)))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
+ ((compose
+ (cute string-join <> "_")
+ (cute drop-right <> 1)
+ (cute string-split <> #\-))
+ (strip-prefix name+ver)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name))
+ (root (getenv "MIX_BUILD_ROOT"))
+ (env (if build-per-environment "prod" "shared")))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir root env) "/" lib-name) lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 02/15] gnu: elixir: Wrap binaries.
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
@ 2023-12-08 11:10 ` Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
1 sibling, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 11:10 UTC (permalink / raw)
To: liliana.prikler; +Cc: Pierre-Henry Fröhring, 66801
* gnu/packages/elixir.scm (elixir)[arguments]: Phase `wrap-programs' added.
* gnu/packages/elixir.scm (elixir)[native-search-paths]: Variable
`GUIX_ELIXIR_LIBS' added.
Change-Id: I75bdde3aeedc1d495ea5fc2c5fc3fcdc5dc3fad2
---
gnu/packages/elixir.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b42512..15cbdbdfc 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -96,9 +97,20 @@ (define-public elixir
(lambda* (#:key inputs #:allow-other-keys)
;; Some tests require access to a home directory.
(setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
+ programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ELIXIR_LIBS")
+ (files (list (string-append "lib/elixir/" (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
(description "Elixir is a dynamic, functional language used to build
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH 03/15] gnu: Add elixir-hex.
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
@ 2023-12-08 11:10 ` Pierre-Henry Fröhring
1 sibling, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 11:10 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801, Pierre-Henry Fröhring
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir.scm (elixir-hex): New variable.
Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
---
gnu/packages/elixir.scm | 43 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 15cbdbdfc..cb9074526 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -118,3 +118,46 @@ (define-public elixir
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public elixir-hex
+ (package
+ (name "elixir-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hexpm/hex.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+ ;; The mix-build-system assumes that Hex exists.
+ ;; We build Hex using the gnu-build-system.
+ ;; Other Elixir packages use the mix-build-system.
+ (build-system gnu-build-system)
+ (inputs (list elixir))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "MIX_ENV" "prod")
+ (invoke "mix" "compile")))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define X.Y #$(version-major+minor (package-version elixir)))
+ (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+ (mkdir-p out)
+ (copy-recursively "_build/prod/lib/hex" out))))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (8 preceding siblings ...)
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
@ 2023-12-08 14:27 ` Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
` (13 more replies)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (3 subsequent siblings)
13 siblings, 14 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 14:27 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* guix/build-system/mix.scm: New file.
* guix/build/mix-build-system.scm: New file.
Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
---
guix/build-system/mix.scm | 186 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
2 files changed, 347 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 000000000..1b04053d7
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,186 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cute string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cute string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 000000000..fe2e36d18
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,161 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries under PATH for a specified Elixir
+VERSION are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-build-root mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory. MIX-BUILD-ROOT depends on the
+package arguments. See: https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
+ (string-append mix-build-root "/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of PACKAGE.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cute string-join <> ".")
+ (cute take <> 2)
+ (cute string-split <> #\.)
+ strip-prefix
+ strip-store-file-name)
+ (assoc-ref inputs "elixir")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cute string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_EXS" mix-exs)
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3")))
+
+(define* (set-elixir-version #:key inputs #:allow-other-keys)
+ "Store the version number of the Elixir input in a parameter."
+ (%elixir-version (elixir-version inputs))
+ (format #t "Elixir version: ~a~%" (%elixir-version)))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
+ ((compose
+ (cute string-join <> "_")
+ (cute drop-right <> 1)
+ (cute string-split <> #\-))
+ (strip-prefix name+ver)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name))
+ (root (getenv "MIX_BUILD_ROOT"))
+ (env (if build-per-environment "prod" "shared")))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir root env) "/" lib-name) lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-08 14:27 ` Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
` (12 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 14:27 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* gnu/packages/elixir.scm (elixir)[arguments]: Phase `wrap-programs' added.
* gnu/packages/elixir.scm (elixir)[native-search-paths]: Variable
`GUIX_ELIXIR_LIBS' added.
Change-Id: I75bdde3aeedc1d495ea5fc2c5fc3fcdc5dc3fad2
---
gnu/packages/elixir.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b42512..15cbdbdfc 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -96,9 +97,20 @@ (define-public elixir
(lambda* (#:key inputs #:allow-other-keys)
;; Some tests require access to a home directory.
(setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
+ programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ELIXIR_LIBS")
+ (files (list (string-append "lib/elixir/" (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
(description "Elixir is a dynamic, functional language used to build
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
@ 2023-12-08 14:27 ` Pierre-Henry Fröhring
2023-12-08 15:29 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
` (11 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 14:27 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir.scm (elixir-hex): New variable.
Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
---
gnu/packages/elixir.scm | 43 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 15cbdbdfc..cb9074526 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -118,3 +118,46 @@ (define-public elixir
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public elixir-hex
+ (package
+ (name "elixir-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hexpm/hex.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+ ;; The mix-build-system assumes that Hex exists.
+ ;; We build Hex using the gnu-build-system.
+ ;; Other Elixir packages use the mix-build-system.
+ (build-system gnu-build-system)
+ (inputs (list elixir))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "MIX_ENV" "prod")
+ (invoke "mix" "compile")))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define X.Y #$(version-major+minor (package-version elixir)))
+ (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+ (mkdir-p out)
+ (copy-recursively "_build/prod/lib/hex" out))))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
@ 2023-12-08 15:29 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:29 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 15:27 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir.scm (elixir-hex): New variable.
>
> Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
> ---
> gnu/packages/elixir.scm | 43
> +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
> index 15cbdbdfc..cb9074526 100644
> --- a/gnu/packages/elixir.scm
> +++ b/gnu/packages/elixir.scm
> @@ -118,3 +118,46 @@ (define-public elixir
> for running low-latency, distributed and fault-tolerant systems,
> while also
> being successfully used in web development and the embedded software
> domain.")
> (license license:asl2.0)))
> +
> +(define-public elixir-hex
> + (package
> + (name "elixir-hex")
> + (version "2.0.5")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/hexpm/hex.git")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
> + ;; The mix-build-system assumes that Hex exists.
> + ;; We build Hex using the gnu-build-system.
> + ;; Other Elixir packages use the mix-build-system.
> + (build-system gnu-build-system)
> + (inputs (list elixir))
> + (arguments
> + (list
> + #:phases
> + #~(modify-phases %standard-phases
> + (delete 'bootstrap)
> + (delete 'configure)
> + (replace 'build
> + (lambda* (#:key inputs #:allow-other-keys)
> + (setenv "MIX_ENV" "prod")
> + (invoke "mix" "compile")))
> + (delete 'check)
Instead of (delete 'check), use #:tests? #f with an appropriate
comment.
> + (replace 'install
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (define X.Y #$(version-major+minor (package-version
> elixir)))
> + (define out (string-append (assoc-ref outputs "out")
> "/lib/elixir/" X.Y "/hex"))
> + (mkdir-p out)
> + (copy-recursively "_build/prod/lib/hex" out))))))
> + (synopsis "Package manager for the Erlang VM")
> + (description
> + "This project provides tasks that integrate with Mix, Elixir's
> build
> +tool.")
> + (home-page "https://hexdocs.pm/makeup_elixir/")
> + (license license:bsd-2)))
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:30 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
` (10 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-nimble-parsec): New variable.
Change-Id: I79bab8095aee3212bc295354ead55df49ef92d17
---
gnu/packages/elixir-xyz.scm | 59 +++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 gnu/packages/elixir-xyz.scm
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
new file mode 100644
index 000000000..352360fae
--- /dev/null
+++ b/gnu/packages/elixir-xyz.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages elixir-xyz)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages elixir)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system mix)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:use-module (guix packages)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26))
+
+(define-public elixir-nimble-parsec
+ (package
+ (name "elixir-nimble-parsec")
+ (version "1.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0rxiw6jzz77v0j460wmzcprhdgn71g1hrz3mcc6djn7bnb0f70i6"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Text-based parser combinators")
+ (description
+ "This library provides primitives for efficient parser combinators, allowing
+for higher-level combinators through composition.")
+ (home-page "https://hexdocs.pm/nimble_parsec/")
+ (license license:asl2.0)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
@ 2023-12-08 15:30 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:30 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-nimble-parsec): New variable.
>
> Change-Id: I79bab8095aee3212bc295354ead55df49ef92d17
> ---
> gnu/packages/elixir-xyz.scm | 59
> +++++++++++++++++++++++++++++++++++++
> 1 file changed, 59 insertions(+)
> create mode 100644 gnu/packages/elixir-xyz.scm
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> new file mode 100644
> index 000000000..352360fae
> --- /dev/null
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -0,0 +1,59 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix. If not, see
> <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages elixir-xyz)
> + #:use-module ((guix licenses) #:prefix license:)
> + #:use-module (gnu packages elixir)
> + #:use-module (gnu packages linux)
> + #:use-module (gnu packages)
> + #:use-module (guix build-system gnu)
> + #:use-module (guix build-system mix)
> + #:use-module (guix download)
> + #:use-module (guix git-download)
> + #:use-module (guix gexp)
> + #:use-module (guix utils)
> + #:use-module (guix packages)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-26))
> +
> +(define-public elixir-nimble-parsec
> + (package
> + (name "elixir-nimble-parsec")
> + (version "1.3.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "0rxiw6jzz77v0j460wmzcprhdgn71g1hrz3mcc6djn7bnb0f70i6"))))
> + (build-system mix-build-system)
> + (arguments
> + (list
> + #:tests? #f))
Why?
> + (synopsis "Text-based parser combinators")
> + (description
> + "This library provides primitives for efficient parser
> combinators, allowing
> +for higher-level combinators through composition.")
> + (home-page "https://hexdocs.pm/nimble_parsec/")
> + (license license:asl2.0)))
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:30 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
` (9 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-makeup): New variable.
Change-Id: I21fe9ffddb4c95a2c67b74340b1105c2a54d3c82
---
gnu/packages/elixir-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 352360fae..afc8b0db0 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -52,6 +52,28 @@ (define-public elixir-nimble-parsec
(home-page "https://hexdocs.pm/nimble_parsec/")
(license license:asl2.0)))
+(define-public elixir-makeup
+ (package
+ (name "elixir-makeup")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19jpprryixi452jwhws3bbks6ki3wni9kgzah3srg22a3x8fsi8a"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-nimble-parsec))
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Syntax highlighter for source code")
+ (description
+ "Makeup is a generic syntax highlighter in the style of Pygments suitable for use in code hosting,
+forums, wikis or other applications that need to prettify source code.")
+ (home-page "https://hexdocs.pm/makeup/")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
@ 2023-12-08 15:30 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:30 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-makeup): New variable.
>
> Change-Id: I21fe9ffddb4c95a2c67b74340b1105c2a54d3c82
> ---
> gnu/packages/elixir-xyz.scm | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index 352360fae..afc8b0db0 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -52,6 +52,28 @@ (define-public elixir-nimble-parsec
> (home-page "https://hexdocs.pm/nimble_parsec/")
> (license license:asl2.0)))
>
> +(define-public elixir-makeup
> + (package
> + (name "elixir-makeup")
> + (version "1.1.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "19jpprryixi452jwhws3bbks6ki3wni9kgzah3srg22a3x8fsi8a"))))
> + (build-system mix-build-system)
> + (propagated-inputs (list elixir-nimble-parsec))
> + (arguments
> + (list
> + #:tests? #f))
Why?
> + (synopsis "Syntax highlighter for source code")
> + (description
> + "Makeup is a generic syntax highlighter in the style of
> Pygments suitable for use in code hosting,
> +forums, wikis or other applications that need to prettify source
> code.")
> + (home-page "https://hexdocs.pm/makeup/")
> + (license license:bsd-2)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:31 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
` (8 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-jason): New variable.
Change-Id: Iadd816e2b5db6d146728aacb4d6b2c66aba4304c
---
gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index afc8b0db0..544a414b4 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -74,6 +74,30 @@ (define-public elixir-makeup
(home-page "https://hexdocs.pm/makeup/")
(license license:bsd-2)))
+(define-public elixir-jason
+ (package
+ (name "elixir-jason")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v"))))
+ (build-system mix-build-system)
+ ;; There is no test/ in the source.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "JSON parser and generator")
+ (description
+ "Parser and generator are written in pure Elixir and optimized for speed. They
+are at least twice as fast as other Elixir/Erlang libraries (e.g.
+Poison). The performance is comparable to jiffy, which is implemented in C as
+a NIF.")
+ (home-page "https://hexdocs.pm/jason/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
@ 2023-12-08 15:31 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:31 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-jason): New variable.
>
> Change-Id: Iadd816e2b5db6d146728aacb4d6b2c66aba4304c
> ---
> gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index afc8b0db0..544a414b4 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -74,6 +74,30 @@ (define-public elixir-makeup
> (home-page "https://hexdocs.pm/makeup/")
> (license license:bsd-2)))
>
> +(define-public elixir-jason
> + (package
> + (name "elixir-jason")
> + (version "1.4.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v"))))
> + (build-system mix-build-system)
> + ;; There is no test/ in the source.
> + (arguments
> + (list
> + #:tests? #f))
I'll move that comment closer to the cause. Btw. you don't need to
split those lines if everything fits into one.
> + (synopsis "JSON parser and generator")
> + (description
> + "Parser and generator are written in pure Elixir and optimized
> for speed. They
> +are at least twice as fast as other Elixir/Erlang libraries (e.g.
> +Poison). The performance is comparable to jiffy, which is
> implemented in C as
> +a NIF.")
> + (home-page "https://hexdocs.pm/jason/")
> + (license license:asl2.0)))
> +
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (4 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:33 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
` (7 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-file-system): New variable.
Change-Id: I54e9c9069ddf150bb0c882775b0b2c9d5e59abd6
---
gnu/packages/elixir-xyz.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 544a414b4..bed84e9f2 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -98,6 +98,33 @@ (define-public elixir-jason
(home-page "https://hexdocs.pm/jason/")
(license license:asl2.0)))
+(define-public elixir-file-system
+ (package
+ (name "elixir-file-system")
+ (version "0.2.10")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list inotify-tools))
+ (arguments
+ (list
+ #:tests? #f ;There is no test/ in the source.
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'rm-priv
+ (lambda _
+ ;; This directory represents source code not needed on UNIX systems.
+ ;; Since we aim at UNIX systems, it is deleted.
+ (delete-file-recursively "priv"))))))
+ (synopsis "File system change watcher")
+ (description "Provides a file system change watcher wrapper based on
+[fs](https://github.com/synrc/fs).")
+ (home-page "https://hexdocs.pm/file_system/")
+ (license license:wtfpl2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
@ 2023-12-08 15:33 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:33 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-file-system): New variable.
>
> Change-Id: I54e9c9069ddf150bb0c882775b0b2c9d5e59abd6
> ---
> gnu/packages/elixir-xyz.scm | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index 544a414b4..bed84e9f2 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -98,6 +98,33 @@ (define-public elixir-jason
> (home-page "https://hexdocs.pm/jason/")
> (license license:asl2.0)))
>
> +(define-public elixir-file-system
> + (package
> + (name "elixir-file-system")
> + (version "0.2.10")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))))
> + (build-system mix-build-system)
> + (propagated-inputs (list inotify-tools))
By convention, arguments follow build-system, only thereafter come
inputs.
> + (arguments
> + (list
> + #:tests? #f ;There is no test/ in the source.
> + #:phases #~(modify-phases %standard-phases
> + (add-after 'unpack 'rm-priv
> + (lambda _
> + ;; This directory represents source code not
> needed on UNIX systems.
> + ;; Since we aim at UNIX systems, it is
> deleted.
> + (delete-file-recursively "priv"))))))
Is this bundled or non-free source? If so, delete it in a snippet.
> + (synopsis "File system change watcher")
> + (description "Provides a file system change watcher wrapper
> based on
> +[fs](https://github.com/synrc/fs).")
> + (home-page "https://hexdocs.pm/file_system/")
> + (license license:wtfpl2)))
> +
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (5 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:33 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
` (6 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-bunt): New variable.
Change-Id: Ib84797c31d6ab40d59b87b040993dae9391ead6b
---
gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index bed84e9f2..984649de4 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -125,6 +125,25 @@ (define-public elixir-file-system
(home-page "https://hexdocs.pm/file_system/")
(license license:wtfpl2)))
+(define-public elixir-bunt
+ (package
+ (name "elixir-bunt")
+ (version "0.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19bp6xh052ql3ha0v3r8999cvja5d2p6cph02mxphfaj4jsbyc53"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "256 color ANSI coloring in the terminal")
+ (description "256 color ANSI coloring in the terminal.")
+ (home-page "https://hexdocs.pm/bunt/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
@ 2023-12-08 15:33 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:33 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-bunt): New variable.
>
> Change-Id: Ib84797c31d6ab40d59b87b040993dae9391ead6b
> ---
> gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index bed84e9f2..984649de4 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -125,6 +125,25 @@ (define-public elixir-file-system
> (home-page "https://hexdocs.pm/file_system/")
> (license license:wtfpl2)))
>
> +(define-public elixir-bunt
> + (package
> + (name "elixir-bunt")
> + (version "0.2.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "19bp6xh052ql3ha0v3r8999cvja5d2p6cph02mxphfaj4jsbyc53"))))
> + (build-system mix-build-system)
> + (arguments
> + (list
> + #:tests? #f))
Why?
> + (synopsis "256 color ANSI coloring in the terminal")
> + (description "256 color ANSI coloring in the terminal.")
The description should be a full sentence.
> + (home-page "https://hexdocs.pm/bunt/")
> + (license license:expat)))
> +
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (6 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:35 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
` (5 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-inch-ex): New variable.
Change-Id: I6e98424528a0264a2587d28fcf065fa74eff0f1a
---
gnu/packages/elixir-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 984649de4..12aee0d78 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -144,6 +144,29 @@ (define-public elixir-bunt
(home-page "https://hexdocs.pm/bunt/")
(license license:expat)))
+(define-public elixir-inch-ex
+ (package
+ (name "elixir-inch-ex")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1a4rjcy3hn5pc40si1d1y7qg0b0mnxx6pw825la67ky8r9gfrl4n"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (propagated-inputs (list elixir-bunt elixir-jason))
+ (synopsis
+ "Offers a Mix task for suggestions on enhancing your inline documentation")
+ (description
+ "This package provides a Mix task that gives you hints where to improve your
+inline docs.")
+ (home-page "https://hex.pm/packages/inch_ex")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
@ 2023-12-08 15:35 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:35 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-inch-ex): New variable.
>
> Change-Id: I6e98424528a0264a2587d28fcf065fa74eff0f1a
> ---
> gnu/packages/elixir-xyz.scm | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index 984649de4..12aee0d78 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -144,6 +144,29 @@ (define-public elixir-bunt
> (home-page "https://hexdocs.pm/bunt/")
> (license license:expat)))
>
> +(define-public elixir-inch-ex
> + (package
> + (name "elixir-inch-ex")
> + (version "2.0.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "1a4rjcy3hn5pc40si1d1y7qg0b0mnxx6pw825la67ky8r9gfrl4n"))))
> + (build-system mix-build-system)
> + (arguments
> + (list
> + #:tests? #f))
> + (propagated-inputs (list elixir-bunt elixir-jason))
> + (synopsis
> + "Offers a Mix task for suggestions on enhancing your inline
> documentation")
Perhaps shorten to "Suggest enhancements for inline documentation".
> + (description
> + "This package provides a Mix task that gives you hints where to
> improve your
> +inline docs.")
> + (home-page "https://hex.pm/packages/inch_ex")
> + (license license:expat)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
I see this line quite often now. Perhaps you should at least sort your
new packages alphabetically so that it doesn't *always* show up?
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (7 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:36 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
` (4 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-castore): New variable.
Change-Id: Iea1fea8241d19ff35a183af9c3fbf2ed5198a259
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 12aee0d78..f50c8f018 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -167,6 +167,26 @@ (define-public elixir-inch-ex
(home-page "https://hex.pm/packages/inch_ex")
(license license:expat)))
+(define-public elixir-castore
+ (package
+ (name "elixir-castore")
+ (version "1.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1y44amb8falsmrfzpkmf7qp6215g9kdl76g91dpna4af2jwc264l"))))
+ (build-system mix-build-system)
+ ;; There is no test/ in the source.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Up-to-date CA certificate store")
+ (description "Up-to-date CA certificate store.")
+ (home-page "https://hexdocs.pm/castore/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
@ 2023-12-08 15:36 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:36 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-castore): New variable.
>
> Change-Id: Iea1fea8241d19ff35a183af9c3fbf2ed5198a259
> ---
> gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index 12aee0d78..f50c8f018 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -167,6 +167,26 @@ (define-public elixir-inch-ex
> (home-page "https://hex.pm/packages/inch_ex")
> (license license:expat)))
>
> +(define-public elixir-castore
> + (package
> + (name "elixir-castore")
> + (version "1.0.4")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "1y44amb8falsmrfzpkmf7qp6215g9kdl76g91dpna4af2jwc264l"))))
> + (build-system mix-build-system)
> + ;; There is no test/ in the source.
> + (arguments
> + (list
> + #:tests? #f))
Move the comment closer to the cause.
> + (synopsis "Up-to-date CA certificate store")
> + (description "Up-to-date CA certificate store.")
Make the description a full sentence.
> + (home-page "https://hexdocs.pm/castore/")
> + (license license:asl2.0)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
Find ways to avoid this :)
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (8 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:38 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
` (3 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-excoveralls): New variable.
Change-Id: Ib271d8a7393e21178806df28ab892afe99757297
---
gnu/packages/elixir-xyz.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index f50c8f018..f6be8e88f 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -187,6 +187,31 @@ (define-public elixir-castore
(home-page "https://hexdocs.pm/castore/")
(license license:asl2.0)))
+(define-public elixir-excoveralls
+ (package
+ (name "elixir-excoveralls")
+ (version "0.18.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02x69ll5scvraky0k5gacvnnmldv5k04kgk02x087d9w3y8vn28i"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-castore elixir-jason))
+ ;; No test/ folder.
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis "Coverage report tool with coveralls.io integration")
+ (description
+ "Library that reports test coverage statistics, with the option to
+post to coveralls.io service. It uses Erlang's cover to generate coverage
+information, and posts the test coverage results to coveralls.io through the
+JSON API.")
+ (home-page "https://hexdocs.pm/excoveralls/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
@ 2023-12-08 15:38 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:38 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-excoveralls): New variable.
>
> Change-Id: Ib271d8a7393e21178806df28ab892afe99757297
> ---
> gnu/packages/elixir-xyz.scm | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index f50c8f018..f6be8e88f 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -187,6 +187,31 @@ (define-public elixir-castore
> (home-page "https://hexdocs.pm/castore/")
> (license license:asl2.0)))
>
> +(define-public elixir-excoveralls
> + (package
> + (name "elixir-excoveralls")
> + (version "0.18.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "02x69ll5scvraky0k5gacvnnmldv5k04kgk02x087d9w3y8vn28i"))))
> + (build-system mix-build-system)
> + (propagated-inputs (list elixir-castore elixir-jason))
> + ;; No test/ folder.
> + (arguments
> + (list
> + #:tests? #f))
Collapse and move, same as before :)
> + (synopsis "Coverage report tool with coveralls.io integration")
> + (description
> + "Library that reports test coverage statistics, with the option
> to
> +post to coveralls.io service.
Make this a complete sentence.
> It uses Erlang's cover to generate coverage
> +information, and posts the test coverage results to coveralls.io
> through the
> +JSON API.")
Fair enough.
> + (home-page "https://hexdocs.pm/excoveralls/")
> + (license license:expat)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (9 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:39 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
` (2 subsequent siblings)
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-credo): New variable.
Change-Id: I6df0d926e0fb96caa65d081892026b3495431c83
---
gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index f6be8e88f..afacbd872 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -212,6 +212,30 @@ (define-public elixir-excoveralls
(home-page "https://hexdocs.pm/excoveralls/")
(license license:expat)))
+(define-public elixir-credo
+ (package
+ (name "elixir-credo")
+ (version "1.7.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18jqi9s9r1587njzdxycvmmbma30cay9iamni4f3ih54jmh1r1z9"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f))
+ (propagated-inputs (list elixir-bunt elixir-file-system elixir-jason))
+ (native-inputs (list elixir-excoveralls elixir-inch-ex))
+ (synopsis "Static code analysis tool")
+ (description
+ "Credo is a static code analysis tool for the Elixir language with a focus on
+teaching and code consistency. Credo can show you refactoring opportunities in
+your code, complex code fragments, warn you about common mistakes, show
+inconsistencies in your naming scheme and - if needed - help you enforce a
+desired coding style.")
+ (home-page "https://hexdocs.pm/credo/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
@ 2023-12-08 15:39 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:39 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-credo): New variable.
>
> Change-Id: I6df0d926e0fb96caa65d081892026b3495431c83
> ---
> gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index f6be8e88f..afacbd872 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -212,6 +212,30 @@ (define-public elixir-excoveralls
> (home-page "https://hexdocs.pm/excoveralls/")
> (license license:expat)))
>
> +(define-public elixir-credo
> + (package
> + (name "elixir-credo")
> + (version "1.7.1")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "18jqi9s9r1587njzdxycvmmbma30cay9iamni4f3ih54jmh1r1z9"))))
> + (build-system mix-build-system)
> + (arguments (list #:tests? #f))
Good, it's collapsed, but you're still missing the comment explaining
why :)
> + (propagated-inputs (list elixir-bunt elixir-file-system elixir-
> jason))
> + (native-inputs (list elixir-excoveralls elixir-inch-ex))
> + (synopsis "Static code analysis tool")
> + (description
> + "Credo is a static code analysis tool for the Elixir language
> with a focus on
> +teaching and code consistency. Credo can show you refactoring
> opportunities in
> +your code, complex code fragments, warn you about common mistakes,
> show
> +inconsistencies in your naming scheme and - if needed - help you
> enforce a
> +desired coding style.")
> + (home-page "https://hexdocs.pm/credo/")
> + (license license:expat)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
Otherwise LGTM modulo placement.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (10 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:39 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 15:03 ` [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-erlex): New variable.
Change-Id: Ia518ad5fd32d3f5942b20113e61e4ef7e7895ff3
---
gnu/packages/elixir-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index afacbd872..08107934a 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -236,6 +236,29 @@ (define-public elixir-credo
(home-page "https://hexdocs.pm/credo/")
(license license:expat)))
+(define-public elixir-erlex
+ (package
+ (name "elixir-erlex")
+ (version "0.2.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (synopsis
+ "Convert Erlang style structs and error messages to equivalent Elixir")
+ (description
+ "Converted structs and error messages are useful for pretty printing things
+like Dialyzer errors and Observer .state. NOTE: Because this code calls the
+Elixir formatter, it requires Elixir 1.6+.")
+ (home-page "https://hexdocs.pm/erlex/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
@ 2023-12-08 15:39 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:39 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-erlex): New variable.
>
> Change-Id: Ia518ad5fd32d3f5942b20113e61e4ef7e7895ff3
> ---
> gnu/packages/elixir-xyz.scm | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index afacbd872..08107934a 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -236,6 +236,29 @@ (define-public elixir-credo
> (home-page "https://hexdocs.pm/credo/")
> (license license:expat)))
>
> +(define-public elixir-erlex
> + (package
> + (name "elixir-erlex")
> + (version "0.2.6")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif"))))
> + (build-system mix-build-system)
> + (arguments
> + (list
> + #:tests? #f))
> + (synopsis
> + "Convert Erlang style structs and error messages to equivalent
> Elixir")
> + (description
> + "Converted structs and error messages are useful for pretty
> printing things
> +like Dialyzer errors and Observer .state.
Should this dot be there?
> NOTE: Because this code calls the
> +Elixir formatter, it requires Elixir 1.6+.")
Pretty sure that's useless information because we package the right
Elixir, right?
> + (home-page "https://hexdocs.pm/erlex/")
> + (license license:asl2.0)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 14/15] gnu: Add elixir-dialyxir.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (11 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:03 ` [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-dialyxir): New variable.
Change-Id: I387062e0aaaded448022aa7534b95859b5979a06
---
gnu/packages/elixir-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 08107934a..70b752bc3 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -259,6 +259,27 @@ (define-public elixir-erlex
(home-page "https://hexdocs.pm/erlex/")
(license license:asl2.0)))
+(define-public elixir-dialyxir
+ (package
+ (name "elixir-dialyxir")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "00cqwhd1wabwds44jz94rvvr8z8cp12884d3lp69fqkrszb9bdw4"))))
+ (build-system mix-build-system)
+ (arguments
+ (list
+ #:tests? #f))
+ (propagated-inputs (list elixir-erlex))
+ (synopsis "Mix tasks to simplify use of Dialyzer")
+ (description
+ "Mix Tasks are usable from the directory of the mix project you want to analyze.")
+ (home-page "https://hexdocs.pm/dialyxir/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete.
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (12 preceding siblings ...)
2023-12-08 15:03 ` [bug#66801] [PATCH v3 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
@ 2023-12-08 15:03 ` Pierre-Henry Fröhring
2023-12-08 15:40 ` Liliana Marie Prikler
13 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 15:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-machete): New variable.
Change-Id: I76e0fd78aeeaeaa94a297032b3b309846510c975
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 70b752bc3..a1a29dfa0 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -280,6 +280,26 @@ (define-public elixir-dialyxir
(home-page "https://hexdocs.pm/dialyxir/")
(license license:asl2.0)))
+(define-public elixir-machete
+ (package
+ (name "elixir-machete")
+ (version "0.2.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0952603bmqsf6v3ja99zpbnbx5d52i4xksjkfj3irl45ccq5pgq9"))))
+ (build-system mix-build-system)
+ (native-inputs (list elixir-credo elixir-dialyxir))
+ (synopsis "Literate test matchers for ExUnit")
+ (description
+ "Machete provides ergonomic match operators that act as building blocks to let
+you define test expectations that can match data against any combination of
+literals, variables, or parametrically defined matchers.")
+ (home-page "https://hexdocs.pm/machete/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete.
2023-12-08 15:03 ` [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
@ 2023-12-08 15:40 ` Liliana Marie Prikler
2023-12-08 17:30 ` Pierre-Henry Fröhring
0 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-08 15:40 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Freitag, dem 08.12.2023 um 16:03 +0100 schrieb Pierre-Henry
Fröhring:
> From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
>
> * gnu/packages/elixir-xyz.scm (elixir-machete): New variable.
>
> Change-Id: I76e0fd78aeeaeaa94a297032b3b309846510c975
> ---
> gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-
> xyz.scm
> index 70b752bc3..a1a29dfa0 100644
> --- a/gnu/packages/elixir-xyz.scm
> +++ b/gnu/packages/elixir-xyz.scm
> @@ -280,6 +280,26 @@ (define-public elixir-dialyxir
> (home-page "https://hexdocs.pm/dialyxir/")
> (license license:asl2.0)))
>
> +(define-public elixir-machete
> + (package
> + (name "elixir-machete")
> + (version "0.2.8")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (hexpm-uri name version))
> + (sha256
> + (base32
> "0952603bmqsf6v3ja99zpbnbx5d52i4xksjkfj3irl45ccq5pgq9"))))
> + (build-system mix-build-system)
> + (native-inputs (list elixir-credo elixir-dialyxir))
> + (synopsis "Literate test matchers for ExUnit")
> + (description
> + "Machete provides ergonomic match operators that act as
> building blocks to let
> +you define test expectations that can match data against any
> combination of
> +literals, variables, or parametrically defined matchers.")
> + (home-page "https://hexdocs.pm/machete/")
> + (license license:expat)))
> +
> ;;;
> ;;; Avoid adding new packages to the end of this file. To reduce the
> chances
> ;;; of a merge conflict, place them above by existing packages with
> similar
LGTM modulo placement.
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (9 preceding siblings ...)
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
` (13 more replies)
2023-12-10 12:34 ` [bug#66801] (no subject) Pierre-Henry Fröhring
` (2 subsequent siblings)
13 siblings, 14 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* guix/build-system/mix.scm: New file.
* guix/build/mix-build-system.scm: New file.
Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
---
guix/build-system/mix.scm | 186 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
2 files changed, 347 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 000000000..1b04053d7
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,186 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cute string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cute string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 000000000..fe2e36d18
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,161 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries under PATH for a specified Elixir
+VERSION are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-build-root mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory. MIX-BUILD-ROOT depends on the
+package arguments. See: https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
+ (string-append mix-build-root "/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of PACKAGE.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cute string-join <> ".")
+ (cute take <> 2)
+ (cute string-split <> #\.)
+ strip-prefix
+ strip-store-file-name)
+ (assoc-ref inputs "elixir")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cute string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_EXS" mix-exs)
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3")))
+
+(define* (set-elixir-version #:key inputs #:allow-other-keys)
+ "Store the version number of the Elixir input in a parameter."
+ (%elixir-version (elixir-version inputs))
+ (format #t "Elixir version: ~a~%" (%elixir-version)))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
+ ((compose
+ (cute string-join <> "_")
+ (cute drop-right <> 1)
+ (cute string-split <> #\-))
+ (strip-prefix name+ver)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name))
+ (root (getenv "MIX_BUILD_ROOT"))
+ (env (if build-per-environment "prod" "shared")))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir root env) "/" lib-name) lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
` (12 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* gnu/packages/elixir.scm (elixir)[arguments]: Phase `wrap-programs' added.
* gnu/packages/elixir.scm (elixir)[native-search-paths]: Variable
`GUIX_ELIXIR_LIBS' added.
Change-Id: I75bdde3aeedc1d495ea5fc2c5fc3fcdc5dc3fad2
---
gnu/packages/elixir.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b42512..15cbdbdfc 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -96,9 +97,20 @@ (define-public elixir
(lambda* (#:key inputs #:allow-other-keys)
;; Some tests require access to a home directory.
(setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
+ programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ELIXIR_LIBS")
+ (files (list (string-append "lib/elixir/" (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
(description "Elixir is a dynamic, functional language used to build
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 03/15] gnu: Add elixir-hex.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
` (11 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir.scm (elixir-hex): New variable.
Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
---
gnu/packages/elixir.scm | 45 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 15cbdbdfc..ef8c39d0d 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -118,3 +118,48 @@ (define-public elixir
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public elixir-hex
+ (package
+ (name "elixir-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hexpm/hex.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+ ;; The mix-build-system assumes that Hex exists.
+ ;; We build Hex using the gnu-build-system.
+ ;; Other Elixir packages use the mix-build-system.
+ (build-system gnu-build-system)
+ (inputs (list elixir))
+ (arguments
+ (list
+ ;; Hex is needed to build packages used to test Hex.
+ ;; To avoid this circularity, we disable tests.
+ #:tests? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "MIX_ENV" "prod")
+ (invoke "mix" "compile")))
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define X.Y #$(version-major+minor (package-version elixir)))
+ (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+ (mkdir-p out)
+ (copy-recursively "_build/prod/lib/hex" out))))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 04/15] gnu: Add elixir-nimble-parsec.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
` (10 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-nimble-parsec): New variable.
Change-Id: I79bab8095aee3212bc295354ead55df49ef92d17
---
gnu/packages/elixir-xyz.scm | 57 +++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 gnu/packages/elixir-xyz.scm
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
new file mode 100644
index 000000000..a57d2aae8
--- /dev/null
+++ b/gnu/packages/elixir-xyz.scm
@@ -0,0 +1,57 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages elixir-xyz)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages elixir)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system mix)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:use-module (guix packages)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26))
+
+(define-public elixir-nimble-parsec
+ (package
+ (name "elixir-nimble-parsec")
+ (version "1.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0rxiw6jzz77v0j460wmzcprhdgn71g1hrz3mcc6djn7bnb0f70i6"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Text-based parser combinators")
+ (description
+ "This library provides primitives for efficient parser combinators, allowing
+for higher-level combinators through composition.")
+ (home-page "https://hexdocs.pm/nimble_parsec/")
+ (license license:asl2.0)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 05/15] gnu: Add elixir-makeup.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
` (9 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-makeup): New variable.
Change-Id: I21fe9ffddb4c95a2c67b74340b1105c2a54d3c82
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index a57d2aae8..ba682e7f0 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -50,6 +50,26 @@ (define-public elixir-nimble-parsec
(home-page "https://hexdocs.pm/nimble_parsec/")
(license license:asl2.0)))
+(define-public elixir-makeup
+ (package
+ (name "elixir-makeup")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19jpprryixi452jwhws3bbks6ki3wni9kgzah3srg22a3x8fsi8a"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-nimble-parsec))
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Syntax highlighter for source code")
+ (description
+ "Makeup is a generic syntax highlighter in the style of Pygments suitable for use in code hosting,
+forums, wikis or other applications that need to prettify source code.")
+ (home-page "https://hexdocs.pm/makeup/")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 06/15] gnu: Add elixir-jason.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
` (8 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-jason): New variable.
Change-Id: Iadd816e2b5db6d146728aacb4d6b2c66aba4304c
---
gnu/packages/elixir-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index ba682e7f0..66c364fb3 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -70,6 +70,27 @@ (define-public elixir-makeup
(home-page "https://hexdocs.pm/makeup/")
(license license:bsd-2)))
+(define-public elixir-jason
+ (package
+ (name "elixir-jason")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "JSON parser and generator")
+ (description
+ "Parser and generator are written in pure Elixir and optimized for speed. They
+are at least twice as fast as other Elixir/Erlang libraries (e.g.
+Poison). The performance is comparable to jiffy, which is implemented in C as
+a NIF.")
+ (home-page "https://hexdocs.pm/jason/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 07/15] gnu: Add elixir-file-system.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (4 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
` (7 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-file-system): New variable.
Change-Id: I54e9c9069ddf150bb0c882775b0b2c9d5e59abd6
---
gnu/packages/elixir-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 66c364fb3..f46e470cd 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -91,6 +91,28 @@ (define-public elixir-jason
(home-page "https://hexdocs.pm/jason/")
(license license:asl2.0)))
+(define-public elixir-file-system
+ (package
+ (name "elixir-file-system")
+ (version "0.2.10")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))
+ ;; This directory represents source code not needed on UNIX systems.
+ ;; Since we aim at UNIX systems, it is deleted.
+ (snippet '(delete-file-recursively "priv"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list inotify-tools))
+ (arguments (list #:tests? #f)) ;There is no test/ in the source.
+ (synopsis "File system change watcher")
+ (description "Provides a file system change watcher wrapper based on
+[fs](https://github.com/synrc/fs).")
+ (home-page "https://hexdocs.pm/file_system/")
+ (license license:wtfpl2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 08/15] gnu: Add elixir-bunt.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (5 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
` (6 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-bunt): New variable.
Change-Id: Ib84797c31d6ab40d59b87b040993dae9391ead6b
---
gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index f46e470cd..54a747554 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -113,6 +113,25 @@ (define-public elixir-file-system
(home-page "https://hexdocs.pm/file_system/")
(license license:wtfpl2)))
+(define-public elixir-bunt
+ (package
+ (name "elixir-bunt")
+ (version "0.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19bp6xh052ql3ha0v3r8999cvja5d2p6cph02mxphfaj4jsbyc53"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "256 color ANSI coloring in the terminal")
+ (description "Bunt is an Elixir package that enables 256 color ANSI
+coloring in the terminal and allows users to alias colors to more semantic and
+application-specific names1.")
+ (home-page "https://hexdocs.pm/bunt/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 09/15] gnu: Add elixir-inch-ex.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (6 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
` (5 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-inch-ex): New variable.
Change-Id: I6e98424528a0264a2587d28fcf065fa74eff0f1a
---
gnu/packages/elixir-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 54a747554..e4756a733 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -132,6 +132,27 @@ (define-public elixir-bunt
(home-page "https://hexdocs.pm/bunt/")
(license license:expat)))
+(define-public elixir-inch-ex
+ (package
+ (name "elixir-inch-ex")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1a4rjcy3hn5pc40si1d1y7qg0b0mnxx6pw825la67ky8r9gfrl4n"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-bunt elixir-jason))
+ (synopsis
+ "Suggest enhancements for inline documentation")
+ (description
+ "This package provides a Mix task that gives you hints where to improve your
+inline docs.")
+ (home-page "https://hex.pm/packages/inch_ex")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 10/15] gnu: Add elixir-castore.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (7 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
` (4 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-castore): New variable.
Change-Id: Iea1fea8241d19ff35a183af9c3fbf2ed5198a259
---
gnu/packages/elixir-xyz.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index e4756a733..18f168e33 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -153,6 +153,24 @@ (define-public elixir-inch-ex
(home-page "https://hex.pm/packages/inch_ex")
(license license:expat)))
+(define-public elixir-castore
+ (package
+ (name "elixir-castore")
+ (version "1.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1y44amb8falsmrfzpkmf7qp6215g9kdl76g91dpna4af2jwc264l"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Up-to-date CA certificate store")
+ (description "The Elixir castore package is a micro-library that provides
+an up-to-date CA certificate store file for Elixir applications.")
+ (home-page "https://hexdocs.pm/castore/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 11/15] gnu: Add elixir-excoveralls.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (8 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
` (3 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-excoveralls): New variable.
Change-Id: Ib271d8a7393e21178806df28ab892afe99757297
---
gnu/packages/elixir-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 18f168e33..4bb856f67 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -171,6 +171,28 @@ (define-public elixir-castore
(home-page "https://hexdocs.pm/castore/")
(license license:asl2.0)))
+(define-public elixir-excoveralls
+ (package
+ (name "elixir-excoveralls")
+ (version "0.18.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02x69ll5scvraky0k5gacvnnmldv5k04kgk02x087d9w3y8vn28i"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-castore elixir-jason))
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Coverage report tool with coveralls.io integration")
+ (description
+ "Library that reports test coverage statistics, with the option to
+post to coveralls.io service. It uses Erlang's cover to generate coverage
+information, and posts the test coverage results to coveralls.io through the
+JSON API.")
+ (home-page "https://hexdocs.pm/excoveralls/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 12/15] gnu: Add elixir-credo.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (9 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
` (2 subsequent siblings)
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-credo): New variable.
Change-Id: I6df0d926e0fb96caa65d081892026b3495431c83
---
gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 4bb856f67..b4e974797 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -193,6 +193,30 @@ (define-public elixir-excoveralls
(home-page "https://hexdocs.pm/excoveralls/")
(license license:expat)))
+(define-public elixir-credo
+ (package
+ (name "elixir-credo")
+ (version "1.7.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18jqi9s9r1587njzdxycvmmbma30cay9iamni4f3ih54jmh1r1z9"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-bunt elixir-file-system elixir-jason))
+ (native-inputs (list elixir-excoveralls elixir-inch-ex))
+ (synopsis "Static code analysis tool")
+ (description
+ "Credo is a static code analysis tool for the Elixir language with a focus on
+teaching and code consistency. Credo can show you refactoring opportunities in
+your code, complex code fragments, warn you about common mistakes, show
+inconsistencies in your naming scheme and - if needed - help you enforce a
+desired coding style.")
+ (home-page "https://hexdocs.pm/credo/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 13/15] gnu: Add elixir-erlex.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (10 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-erlex): New variable.
Change-Id: Ia518ad5fd32d3f5942b20113e61e4ef7e7895ff3
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index b4e974797..4d328aa07 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -217,6 +217,26 @@ (define-public elixir-credo
(home-page "https://hexdocs.pm/credo/")
(license license:expat)))
+(define-public elixir-erlex
+ (package
+ (name "elixir-erlex")
+ (version "0.2.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis
+ "Convert Erlang style structs and error messages to equivalent Elixir")
+ (description
+ "Converted structs and error messages are useful for pretty printing
+things like Dialyzer errors and Observer.")
+ (home-page "https://hexdocs.pm/erlex/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 14/15] gnu: Add elixir-dialyxir.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (11 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-dialyxir): New variable.
Change-Id: I387062e0aaaded448022aa7534b95859b5979a06
---
gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 4d328aa07..983c3ff5f 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -237,6 +237,25 @@ (define-public elixir-erlex
(home-page "https://hexdocs.pm/erlex/")
(license license:asl2.0)))
+(define-public elixir-dialyxir
+ (package
+ (name "elixir-dialyxir")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "00cqwhd1wabwds44jz94rvvr8z8cp12884d3lp69fqkrszb9bdw4"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-erlex))
+ (synopsis "Mix tasks to simplify use of Dialyzer")
+ (description
+ "Mix Tasks are usable from the directory of the mix project you want to analyze.")
+ (home-page "https://hexdocs.pm/dialyxir/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v4 15/15] gnu: Add elixir-machete.
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (12 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
@ 2023-12-08 18:35 ` Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-08 18:35 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-machete): New variable.
Change-Id: I76e0fd78aeeaeaa94a297032b3b309846510c975
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 983c3ff5f..e74750c5b 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -256,6 +256,26 @@ (define-public elixir-dialyxir
(home-page "https://hexdocs.pm/dialyxir/")
(license license:asl2.0)))
+(define-public elixir-machete
+ (package
+ (name "elixir-machete")
+ (version "0.2.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0952603bmqsf6v3ja99zpbnbx5d52i4xksjkfj3irl45ccq5pgq9"))))
+ (build-system mix-build-system)
+ (native-inputs (list elixir-credo elixir-dialyxir))
+ (synopsis "Literate test matchers for ExUnit")
+ (description
+ "Machete provides ergonomic match operators that act as building blocks to let
+you define test expectations that can match data against any combination of
+literals, variables, or parametrically defined matchers.")
+ (home-page "https://hexdocs.pm/machete/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] (no subject)
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (10 preceding siblings ...)
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-10 12:34 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-10 13:05 ` [bug#66801] Erratum Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 12:34 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: Guix Issue 66801
Hello lilyp,
After this email comes the v5 batch of patches.
Are these good enough?
For the record, I'm building a checklists of your suggestions here: <https://phfrohring.com/6e5895e1-fbbe-4ccb-a220-ae51807d70bd.html>
« These rules do their job when mindlessly applying them get rid of details preventing patches to be merged. »
I still did not compile all of them, but it will be done.
These patches were added on top of:
┌────
│ 06f25a9a8 * origin/master gnu: xrdp: Update to 0.9.23.1.
└────
The packages build on my machine.
┌────
│ echo $PWD
│ git rev-parse HEAD
└────
┌────
└────
┌────
│ ./pre-inst-env guix build elixir-file-system
└────
┌────
│ /gnu/store/76fsrn1bdsyhm9m1p17ibrd0cbgybigw-elixir-file-system-0.2.10
└────
┌────
│ ./pre-inst-env guix build elixir-machete
└────
┌────
│ /gnu/store/f5jc0jg1yd9imgvy0sk44ci0l1lh2v0x-elixir-machete-0.2.8
└────
The main difference is the introduction of the `snippet' field that
actually does the job for `elixir-file-system':
┌────
│ (define-public elixir-file-system
│ (package
│ (name "elixir-file-system")
│ (version "0.2.10")
│ (source
│ (origin
│ (method url-fetch)
│ (uri (hexpm-uri name version))
│ (sha256
│ (base32 "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))
│ (snippet #~(begin
│ (use-modules (guix build utils) (ice-9 ftw))
│ (mkdir "source")
│ (for-each (lambda (file)
│ (when (not (member file '("." ".." "source")))
│ (rename-file file (string-append "source/" file))))
│ (scandir "."))
│ (with-directory-excursion "source"
│ (invoke (string-append #+gzip "/bin/gunzip") "-v" "contents.tar.gz")
│ (invoke (string-append #+tar "/bin/tar") "-xvf" "contents.tar")
│ (delete-file "contents.tar")
│ (delete-file "priv/inotifywait.exe"))))))
│ (build-system mix-build-system)
│ (propagated-inputs (list inotify-tools))
│ (arguments (list #:tests? #f)) ; no tests
│ (synopsis "File system change watcher")
│ (description "Provides a file system change watcher wrapper based on
│ https://github.com/synrc/fs.")
│ (home-page "https://hexdocs.pm/file_system/")
│ (license license:wtfpl2)))
└────
For some reason, `--delete' option of `tar' did not work as expected which
made the code a bit longer that what it should have been:
┌────
│ tar --delete -f contents.tar priv/inotifywait.exe
│ emacsclient contents.tar
└────
┌────
│ …
│ -rw-r--r-- 0/0 734 c_src/mac/cli.h
│ -rw-r--r-- 0/0 1496 c_src/mac/common.h
│ rwxrwSrwt 163910/18953450 8929236060 >= 6))) {
│ config.flags |= kFSEventStreamCreateFlagIgnoreSelf;
│ } else {
│ fprintf(stder
└────
┌────
│ tar xf contents.tar
└────
┌────
│ tar: Skipping to next header
│ tar: Exiting with failure status due to previous errors
└────
–
Regards,
phf
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system.
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (11 preceding siblings ...)
2023-12-10 12:34 ` [bug#66801] (no subject) Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
` (14 more replies)
2023-12-10 13:05 ` [bug#66801] Erratum Pierre-Henry Fröhring
13 siblings, 15 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* guix/build-system/mix.scm: New file.
* guix/build/mix-build-system.scm: New file.
Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
---
guix/build-system/mix.scm | 186 ++++++++++++++++++++++++++++++++
guix/build/mix-build-system.scm | 161 +++++++++++++++++++++++++++
2 files changed, 347 insertions(+)
create mode 100644 guix/build-system/mix.scm
create mode 100644 guix/build/mix-build-system.scm
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
new file mode 100644
index 000000000..1b04053d7
--- /dev/null
+++ b/guix/build-system/mix.scm
@@ -0,0 +1,186 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Standard build procedure for Elixir packages using 'mix'. This is
+;; implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define-module (guix build-system mix)
+ #:use-module (guix build mix-build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix search-paths)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (mix-build-system hexpm-uri))
+
+;; Lazily resolve bindings to avoid circular dependencies.
+(define (default-glibc-utf8-locales)
+ (let* ((base (resolve-interface '(gnu packages base))))
+ (module-ref base 'glibc-utf8-locales)))
+
+(define (default-elixir-hex)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir-hex)))
+
+(define (default-rebar3)
+ (let ((erlang (resolve-interface '(gnu packages erlang))))
+ (module-ref erlang 'rebar3)))
+
+(define (default-elixir)
+ (let ((elixir (resolve-interface '(gnu packages elixir))))
+ (module-ref elixir 'elixir)))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (hexpm-uri name version)
+ "Return the URI where to fetch the sources of a Hex package NAME at VERSION.
+NAME is the name of the package which should look like: elixir-pkg-name-X.Y.Z
+See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
+ ((compose
+ (cute string-append "https://repo.hex.pm/tarballs/" <> "-" version ".tar")
+ (cute string-replace-substring <> "-" "_")
+ strip-prefix)
+ name))
+
+;; A number of environment variables specific to the Mix build system are
+;; reflected here. They are documented at
+;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables. Other
+;; parameters located in mix.exs are defined at
+;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
+(define* (mix-build name
+ inputs
+ #:key
+ source
+ (tests? #t)
+ (mix-path #f) ;See MIX_PATH.
+ (mix-exs "mix.exs") ;See MIX_EXS.
+ (build-per-environment #t) ;See :build_per_environment.
+ (phases '%standard-phases)
+ (outputs '("out"))
+ (search-paths '())
+ (system (%current-system))
+ (guile #f)
+ (imported-modules `((guix build mix-build-system)
+ ,@%gnu-build-system-modules))
+ (modules '((guix build mix-build-system)
+ (guix build utils))))
+ "Build SOURCE using Elixir, and with INPUTS."
+
+ ;; Check the documentation of :build_per_environment here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration And
+ ;; "Environments" here:
+ ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
+ (define mix-environments
+ (if build-per-environment
+ `("prod" ,@(if tests? '("test") '()))
+ '("shared")))
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(mix-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:tests? #$tests?
+ #:mix-path #$mix-path
+ #:mix-exs #$mix-exs
+ #:mix-environments '#$mix-environments
+ #:build-per-environment #$build-per-environment
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:outputs %outputs
+ #:search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ search-paths))
+ #:inputs
+ %build-inputs)))))
+
+ (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
+ system
+ #:graft? #f)))
+ (gexp->derivation name
+ builder
+ #:system system
+ #:graft? #f ;consistent with 'gnu-build'
+ #:target #f
+ #:guile-for-build guile)))
+
+(define* (lower name
+ #:key
+ (elixir (default-elixir))
+ (elixir-hex (default-elixir-hex))
+ (glibc-utf8-locales (default-glibc-utf8-locales))
+ (inputs '())
+ (native-inputs '())
+ (propagated-inputs '())
+ (rebar3 (default-rebar3))
+ (tests? #t)
+ outputs
+ source
+ system
+ target
+ #:allow-other-keys #:rest arguments)
+ "Return a bag for NAME."
+ (let ((private-keywords
+ '(#:inputs #:native-inputs
+ #:outputs #:system #:target
+ #:elixir #:elixir-hex #:glibc-utf8-locales
+ #:rebar3 #:erlang))
+ (build-inputs
+ `(,@(standard-packages)
+ ("glibc-utf8-locales" ,glibc-utf8-locales)
+ ("erlang" ,(lookup-package-input elixir "erlang"))
+ ("rebar3" ,rebar3)
+ ("elixir" ,elixir)
+ ("elixir-hex" ,elixir-hex)
+ ,@inputs
+ ,@native-inputs)))
+ (bag (name name)
+ (system system)
+ (build-inputs build-inputs)
+ (host-inputs (if target inputs '()))
+ (outputs outputs)
+ (build mix-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define mix-build-system
+ (build-system (name 'mix)
+ (description "The standard Mix build system")
+ (lower lower)))
+
+;;; mix.scm ends here
diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-system.scm
new file mode 100644
index 000000000..fe2e36d18
--- /dev/null
+++ b/guix/build/mix-build-system.scm
@@ -0,0 +1,161 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; Code:
+
+(define-module (guix build mix-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 string-fun)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-71)
+ #:export (mix-build
+ %standard-phases))
+
+;; The Elixir version is constant as soon as it is computable from the current
+;; execution. It is a X.Y string where X and Y are respectively the major and
+;; minor version number of the Elixir used in the build.
+(define %elixir-version (make-parameter "X.Y"))
+
+(define* (elixir-libdir path #:optional (version (%elixir-version)))
+ "Return the path where all libraries under PATH for a specified Elixir
+VERSION are installed."
+ (string-append path "/lib/elixir/" version))
+
+(define* (strip-prefix name #:optional (prefix "elixir-"))
+ "Return NAME without the prefix PREFIX."
+ (if (string-prefix? prefix name)
+ (string-drop name (string-length prefix))
+ name))
+
+(define (mix-build-dir mix-build-root mix-env)
+ "Return the directory where build artifacts are to be installed according to
+en environment MIX-ENV in the current directory. MIX-BUILD-ROOT depends on the
+package arguments. See: https://hexdocs.pm/mix/1.15/Mix.html#module-environment-variables"
+ (string-append mix-build-root "/" mix-env "/lib"))
+
+(define (elixir-version inputs)
+ "Return an X.Y string where X and Y are respectively the major and minor version number of PACKAGE.
+Example: /gnu/store/…-elixir-1.14.0 → 1.14"
+ ((compose
+ (cute string-join <> ".")
+ (cute take <> 2)
+ (cute string-split <> #\.)
+ strip-prefix
+ strip-store-file-name)
+ (assoc-ref inputs "elixir")))
+
+(define* (unpack #:key source mix-path #:allow-other-keys)
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
+ (gnu-unpack #:source source)
+ (when (file-exists? "contents.tar.gz")
+ (invoke "tar" "xvf" "contents.tar.gz"))))
+
+(define (list-directories dir)
+ "List absolute paths of directories directly under the directory DIR."
+ (map (cute string-append dir "/" <>)
+ (scandir dir (lambda (filename)
+ (and (not (member filename '("." "..")))
+ (directory-exists? (string-append dir "/" filename)))))))
+
+(define* (set-mix-env #:key inputs mix-path mix-exs #:allow-other-keys)
+ "Set environment variables.
+See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
+ (setenv "MIX_ARCHIVES" "archives")
+ (setenv "MIX_BUILD_ROOT" "_build")
+ (setenv "MIX_DEPS_PATH" "deps")
+ (setenv "MIX_EXS" mix-exs)
+ (setenv "MIX_HOME" (getcwd))
+ (setenv "MIX_PATH" (or mix-path ""))
+ (setenv "MIX_REBAR3" (string-append (assoc-ref inputs "rebar3") "/bin/rebar3")))
+
+(define* (set-elixir-version #:key inputs #:allow-other-keys)
+ "Store the version number of the Elixir input in a parameter."
+ (%elixir-version (elixir-version inputs))
+ (format #t "Elixir version: ~a~%" (%elixir-version)))
+
+(define* (build #:key mix-environments #:allow-other-keys)
+ "Builds the Mix project."
+ (for-each (lambda (mix-env)
+ (setenv "MIX_ENV" mix-env)
+ (invoke "mix" "compile" "--no-deps-check"))
+ mix-environments))
+
+(define* (check #:key (tests? #t) #:allow-other-keys)
+ "Test the Mix project."
+ (if tests?
+ (invoke "mix" "test" "--no-deps-check")
+ (format #t "tests? = ~a~%" tests?)))
+
+(define* (remove-mix-dirs . _)
+ "Remove all .mix/ directories.
+We do not want to copy them to the installation directory."
+ (for-each delete-file-recursively
+ (find-files "." (file-name-predicate "\\.mix$") #:directories? #t)))
+
+(define (package-name->elixir-name name+ver)
+ "Convert the Guix package NAME-VER to the corresponding Elixir name-version
+format. Example: elixir-a-pkg-1.2.3 -> a_pkg"
+ ((compose
+ (cute string-join <> "_")
+ (cute drop-right <> 1)
+ (cute string-split <> #\-))
+ (strip-prefix name+ver)))
+
+(define* (install #:key
+ inputs
+ outputs
+ name
+ build-per-environment
+ #:allow-other-keys)
+ "Install build artifacts in the store."
+ (let* ((lib-name (package-name->elixir-name name))
+ (lib-dir (string-append (elixir-libdir (assoc-ref outputs "out")) "/" lib-name))
+ (root (getenv "MIX_BUILD_ROOT"))
+ (env (if build-per-environment "prod" "shared")))
+ (mkdir-p lib-dir)
+ (copy-recursively (string-append (mix-build-dir root env) "/" lib-name) lib-dir
+ #:follow-symlinks? #t)))
+
+(define %standard-phases
+ (modify-phases gnu:%standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-after 'install-locale 'set-mix-env set-mix-env)
+ (add-after 'set-mix-env 'set-elixir-version set-elixir-version)
+ (replace 'unpack unpack)
+ (replace 'build build)
+ (replace 'check check)
+ (add-before 'install 'remove-mix-dirs remove-mix-dirs)
+ (replace 'install install)))
+
+(define* (mix-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Mix package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; mix-build-system.scm ends here
base-commit: 06f25a9a85be1bbe7a709e58ce41c1a834e5f1ae
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
` (13 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
* gnu/packages/elixir.scm (elixir)[arguments]: Phase `wrap-programs' added.
* gnu/packages/elixir.scm (elixir)[native-search-paths]: Variable
`GUIX_ELIXIR_LIBS' added.
Change-Id: I75bdde3aeedc1d495ea5fc2c5fc3fcdc5dc3fad2
---
gnu/packages/elixir.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 724b42512..15cbdbdfc 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages elixir)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (gnu packages)
@@ -96,9 +97,20 @@ (define-public elixir
(lambda* (#:key inputs #:allow-other-keys)
;; Some tests require access to a home directory.
(setenv "HOME" "/tmp")))
- (delete 'configure))))
- (inputs
- (list erlang git))
+ (delete 'configure)
+ (add-after 'install 'wrap-programs
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (programs '("elixir" "elixirc" "iex" "mix")))
+ (for-each (lambda (program)
+ (wrap-program (string-append out "/bin/" program)
+ '("ERL_LIBS" prefix ("${GUIX_ELIXIR_LIBS}"))))
+ programs)))))))
+ (inputs (list erlang git))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "GUIX_ELIXIR_LIBS")
+ (files (list (string-append "lib/elixir/" (version-major+minor version)))))))
(home-page "https://elixir-lang.org/")
(synopsis "Elixir programming language")
(description "Elixir is a dynamic, functional language used to build
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 03/15] gnu: Add elixir-hex.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
` (12 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir.scm (elixir-hex): New variable.
Change-Id: I957688ae4e078afd79acd439880c38083fdab83a
---
gnu/packages/elixir.scm | 45 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/gnu/packages/elixir.scm b/gnu/packages/elixir.scm
index 15cbdbdfc..ef8c39d0d 100644
--- a/gnu/packages/elixir.scm
+++ b/gnu/packages/elixir.scm
@@ -118,3 +118,48 @@ (define-public elixir
for running low-latency, distributed and fault-tolerant systems, while also
being successfully used in web development and the embedded software domain.")
(license license:asl2.0)))
+
+(define-public elixir-hex
+ (package
+ (name "elixir-hex")
+ (version "2.0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/hexpm/hex.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1kvczwvij58kgkhak68004ap81pl26600bczg21mymy2sypkgxmj"))))
+ ;; The mix-build-system assumes that Hex exists.
+ ;; We build Hex using the gnu-build-system.
+ ;; Other Elixir packages use the mix-build-system.
+ (build-system gnu-build-system)
+ (inputs (list elixir))
+ (arguments
+ (list
+ ;; Hex is needed to build packages used to test Hex.
+ ;; To avoid this circularity, we disable tests.
+ #:tests? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "MIX_ENV" "prod")
+ (invoke "mix" "compile")))
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define X.Y #$(version-major+minor (package-version elixir)))
+ (define out (string-append (assoc-ref outputs "out") "/lib/elixir/" X.Y "/hex"))
+ (mkdir-p out)
+ (copy-recursively "_build/prod/lib/hex" out))))))
+ (synopsis "Package manager for the Erlang VM")
+ (description
+ "This project provides tasks that integrate with Mix, Elixir's build
+tool.")
+ (home-page "https://hexdocs.pm/makeup_elixir/")
+ (license license:bsd-2)))
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 04/15] gnu: Add elixir-nimble-parsec.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
` (11 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-nimble-parsec): New variable.
Change-Id: I79bab8095aee3212bc295354ead55df49ef92d17
---
gnu/packages/elixir-xyz.scm | 57 +++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 gnu/packages/elixir-xyz.scm
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
new file mode 100644
index 000000000..a57d2aae8
--- /dev/null
+++ b/gnu/packages/elixir-xyz.scm
@@ -0,0 +1,57 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Pierre-Henry Fröhring <phfrohring@deeplinks.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages elixir-xyz)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (gnu packages elixir)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system mix)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix gexp)
+ #:use-module (guix utils)
+ #:use-module (guix packages)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26))
+
+(define-public elixir-nimble-parsec
+ (package
+ (name "elixir-nimble-parsec")
+ (version "1.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0rxiw6jzz77v0j460wmzcprhdgn71g1hrz3mcc6djn7bnb0f70i6"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Text-based parser combinators")
+ (description
+ "This library provides primitives for efficient parser combinators, allowing
+for higher-level combinators through composition.")
+ (home-page "https://hexdocs.pm/nimble_parsec/")
+ (license license:asl2.0)))
+
+;;;
+;;; Avoid adding new packages to the end of this file. To reduce the chances
+;;; of a merge conflict, place them above by existing packages with similar
+;;; functionality or similar names.
+;;;
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 05/15] gnu: Add elixir-makeup.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (2 preceding siblings ...)
2023-12-10 13:03 ` [bug#66801] [PATCH v5 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
` (10 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-makeup): New variable.
Change-Id: I21fe9ffddb4c95a2c67b74340b1105c2a54d3c82
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index a57d2aae8..ba682e7f0 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -50,6 +50,26 @@ (define-public elixir-nimble-parsec
(home-page "https://hexdocs.pm/nimble_parsec/")
(license license:asl2.0)))
+(define-public elixir-makeup
+ (package
+ (name "elixir-makeup")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19jpprryixi452jwhws3bbks6ki3wni9kgzah3srg22a3x8fsi8a"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-nimble-parsec))
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Syntax highlighter for source code")
+ (description
+ "Makeup is a generic syntax highlighter in the style of Pygments suitable for use in code hosting,
+forums, wikis or other applications that need to prettify source code.")
+ (home-page "https://hexdocs.pm/makeup/")
+ (license license:bsd-2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 06/15] gnu: Add elixir-jason.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (3 preceding siblings ...)
2023-12-10 13:03 ` [bug#66801] [PATCH v5 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
@ 2023-12-10 13:03 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
` (9 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:03 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-jason): New variable.
Change-Id: Iadd816e2b5db6d146728aacb4d6b2c66aba4304c
---
gnu/packages/elixir-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index ba682e7f0..66c364fb3 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -70,6 +70,27 @@ (define-public elixir-makeup
(home-page "https://hexdocs.pm/makeup/")
(license license:bsd-2)))
+(define-public elixir-jason
+ (package
+ (name "elixir-jason")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "JSON parser and generator")
+ (description
+ "Parser and generator are written in pure Elixir and optimized for speed. They
+are at least twice as fast as other Elixir/Erlang libraries (e.g.
+Poison). The performance is comparable to jiffy, which is implemented in C as
+a NIF.")
+ (home-page "https://hexdocs.pm/jason/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 07/15] gnu: Add elixir-file-system.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (4 preceding siblings ...)
2023-12-10 13:03 ` [bug#66801] [PATCH v5 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
` (8 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-file-system): New variable.
Change-Id: I54e9c9069ddf150bb0c882775b0b2c9d5e59abd6
---
gnu/packages/elixir-xyz.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 66c364fb3..948d8aecc 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -20,6 +20,8 @@ (define-module (gnu packages elixir-xyz)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages elixir)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages base)
#:use-module (gnu packages)
#:use-module (guix build-system gnu)
#:use-module (guix build-system mix)
@@ -91,6 +93,37 @@ (define-public elixir-jason
(home-page "https://hexdocs.pm/jason/")
(license license:asl2.0)))
+(define-public elixir-file-system
+ (package
+ (name "elixir-file-system")
+ (version "0.2.10")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1p0myxmnjjds8bbg69dd6fvhk8q3n7lb78zd4qvmjajnzgdmw6a1"))
+ (snippet #~(begin
+ (use-modules (guix build utils) (ice-9 ftw))
+ (mkdir "source")
+ (for-each (lambda (file)
+ (when (not (member file '("." ".." "source")))
+ (rename-file file (string-append "source/" file))))
+ (scandir "."))
+ (with-directory-excursion "source"
+ (invoke (string-append #+gzip "/bin/gunzip") "-v" "contents.tar.gz")
+ (invoke (string-append #+tar "/bin/tar") "-xvf" "contents.tar")
+ (delete-file "contents.tar")
+ (delete-file "priv/inotifywait.exe"))))))
+ (build-system mix-build-system)
+ (propagated-inputs (list inotify-tools))
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "File system change watcher")
+ (description "Provides a file system change watcher wrapper based on
+https://github.com/synrc/fs.")
+ (home-page "https://hexdocs.pm/file_system/")
+ (license license:wtfpl2)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 08/15] gnu: Add elixir-bunt.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (5 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
` (7 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-bunt): New variable.
Change-Id: Ib84797c31d6ab40d59b87b040993dae9391ead6b
---
gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 948d8aecc..33fa20749 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -124,6 +124,25 @@ (define-public elixir-file-system
(home-page "https://hexdocs.pm/file_system/")
(license license:wtfpl2)))
+(define-public elixir-bunt
+ (package
+ (name "elixir-bunt")
+ (version "0.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "19bp6xh052ql3ha0v3r8999cvja5d2p6cph02mxphfaj4jsbyc53"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "256 color ANSI coloring in the terminal")
+ (description "Bunt is an Elixir package that enables 256 color ANSI
+coloring in the terminal and allows users to alias colors to more semantic and
+application-specific names1.")
+ (home-page "https://hexdocs.pm/bunt/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 09/15] gnu: Add elixir-inch-ex.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (6 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
` (6 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-inch-ex): New variable.
Change-Id: I6e98424528a0264a2587d28fcf065fa74eff0f1a
---
gnu/packages/elixir-xyz.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 33fa20749..ed61cac50 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -143,6 +143,27 @@ (define-public elixir-bunt
(home-page "https://hexdocs.pm/bunt/")
(license license:expat)))
+(define-public elixir-inch-ex
+ (package
+ (name "elixir-inch-ex")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1a4rjcy3hn5pc40si1d1y7qg0b0mnxx6pw825la67ky8r9gfrl4n"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-bunt elixir-jason))
+ (synopsis
+ "Suggest enhancements for inline documentation")
+ (description
+ "This package provides a Mix task that gives you hints where to improve your
+inline docs.")
+ (home-page "https://hex.pm/packages/inch_ex")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 10/15] gnu: Add elixir-castore.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (7 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
` (5 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-castore): New variable.
Change-Id: Iea1fea8241d19ff35a183af9c3fbf2ed5198a259
---
gnu/packages/elixir-xyz.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index ed61cac50..ef80c9550 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -164,6 +164,24 @@ (define-public elixir-inch-ex
(home-page "https://hex.pm/packages/inch_ex")
(license license:expat)))
+(define-public elixir-castore
+ (package
+ (name "elixir-castore")
+ (version "1.0.4")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "1y44amb8falsmrfzpkmf7qp6215g9kdl76g91dpna4af2jwc264l"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Up-to-date CA certificate store")
+ (description "The Elixir castore package is a micro-library that provides
+an up-to-date CA certificate store file for Elixir applications.")
+ (home-page "https://hexdocs.pm/castore/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 11/15] gnu: Add elixir-excoveralls.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (8 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
` (4 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-excoveralls): New variable.
Change-Id: Ib271d8a7393e21178806df28ab892afe99757297
---
gnu/packages/elixir-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index ef80c9550..14e67060e 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -182,6 +182,28 @@ (define-public elixir-castore
(home-page "https://hexdocs.pm/castore/")
(license license:asl2.0)))
+(define-public elixir-excoveralls
+ (package
+ (name "elixir-excoveralls")
+ (version "0.18.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "02x69ll5scvraky0k5gacvnnmldv5k04kgk02x087d9w3y8vn28i"))))
+ (build-system mix-build-system)
+ (propagated-inputs (list elixir-castore elixir-jason))
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis "Coverage report tool with coveralls.io integration")
+ (description
+ "Library that reports test coverage statistics, with the option to
+post to coveralls.io service. It uses Erlang's cover to generate coverage
+information, and posts the test coverage results to coveralls.io through the
+JSON API.")
+ (home-page "https://hexdocs.pm/excoveralls/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 12/15] gnu: Add elixir-credo.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (9 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
` (3 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-credo): New variable.
Change-Id: I6df0d926e0fb96caa65d081892026b3495431c83
---
gnu/packages/elixir-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 14e67060e..8485355e4 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -204,6 +204,30 @@ (define-public elixir-excoveralls
(home-page "https://hexdocs.pm/excoveralls/")
(license license:expat)))
+(define-public elixir-credo
+ (package
+ (name "elixir-credo")
+ (version "1.7.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "18jqi9s9r1587njzdxycvmmbma30cay9iamni4f3ih54jmh1r1z9"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-bunt elixir-file-system elixir-jason))
+ (native-inputs (list elixir-excoveralls elixir-inch-ex))
+ (synopsis "Static code analysis tool")
+ (description
+ "Credo is a static code analysis tool for the Elixir language with a focus on
+teaching and code consistency. Credo can show you refactoring opportunities in
+your code, complex code fragments, warn you about common mistakes, show
+inconsistencies in your naming scheme and - if needed - help you enforce a
+desired coding style.")
+ (home-page "https://hexdocs.pm/credo/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 13/15] gnu: Add elixir-erlex.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (10 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
` (2 subsequent siblings)
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-erlex): New variable.
Change-Id: Ia518ad5fd32d3f5942b20113e61e4ef7e7895ff3
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 8485355e4..df4328430 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -228,6 +228,26 @@ (define-public elixir-credo
(home-page "https://hexdocs.pm/credo/")
(license license:expat)))
+(define-public elixir-erlex
+ (package
+ (name "elixir-erlex")
+ (version "0.2.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (synopsis
+ "Convert Erlang style structs and error messages to equivalent Elixir")
+ (description
+ "Converted structs and error messages are useful for pretty printing
+things like Dialyzer errors and Observer.")
+ (home-page "https://hexdocs.pm/erlex/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 14/15] gnu: Add elixir-dialyxir.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (11 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-10 14:20 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Liliana Marie Prikler
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-dialyxir): New variable.
Change-Id: I387062e0aaaded448022aa7534b95859b5979a06
---
gnu/packages/elixir-xyz.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index df4328430..5a7330ca4 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -248,6 +248,25 @@ (define-public elixir-erlex
(home-page "https://hexdocs.pm/erlex/")
(license license:asl2.0)))
+(define-public elixir-dialyxir
+ (package
+ (name "elixir-dialyxir")
+ (version "1.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "00cqwhd1wabwds44jz94rvvr8z8cp12884d3lp69fqkrszb9bdw4"))))
+ (build-system mix-build-system)
+ (arguments (list #:tests? #f)) ; no tests
+ (propagated-inputs (list elixir-erlex))
+ (synopsis "Mix tasks to simplify use of Dialyzer")
+ (description
+ "Mix Tasks are usable from the directory of the mix project you want to analyze.")
+ (home-page "https://hexdocs.pm/dialyxir/")
+ (license license:asl2.0)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 15/15] gnu: Add elixir-machete.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (12 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
@ 2023-12-10 13:04 ` Pierre-Henry Fröhring
2023-12-10 14:20 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Liliana Marie Prikler
14 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:04 UTC (permalink / raw)
To: liliana.prikler; +Cc: 66801
From: Pierre-Henry Fröhring <phfrohring@deeplinks.com>
* gnu/packages/elixir-xyz.scm (elixir-machete): New variable.
Change-Id: I76e0fd78aeeaeaa94a297032b3b309846510c975
---
gnu/packages/elixir-xyz.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gnu/packages/elixir-xyz.scm b/gnu/packages/elixir-xyz.scm
index 5a7330ca4..5af8d7c1b 100644
--- a/gnu/packages/elixir-xyz.scm
+++ b/gnu/packages/elixir-xyz.scm
@@ -267,6 +267,26 @@ (define-public elixir-dialyxir
(home-page "https://hexdocs.pm/dialyxir/")
(license license:asl2.0)))
+(define-public elixir-machete
+ (package
+ (name "elixir-machete")
+ (version "0.2.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (hexpm-uri name version))
+ (sha256
+ (base32 "0952603bmqsf6v3ja99zpbnbx5d52i4xksjkfj3irl45ccq5pgq9"))))
+ (build-system mix-build-system)
+ (native-inputs (list elixir-credo elixir-dialyxir))
+ (synopsis "Literate test matchers for ExUnit")
+ (description
+ "Machete provides ergonomic match operators that act as building blocks to let
+you define test expectations that can match data against any combination of
+literals, variables, or parametrically defined matchers.")
+ (home-page "https://hexdocs.pm/machete/")
+ (license license:expat)))
+
;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
--
2.41.0
^ permalink raw reply related [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system.
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
` (13 preceding siblings ...)
2023-12-10 13:04 ` [bug#66801] [PATCH v5 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
@ 2023-12-10 14:20 ` Liliana Marie Prikler
2023-12-10 14:22 ` Pierre-Henry Fröhring
14 siblings, 1 reply; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-10 14:20 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801
Am Sonntag, dem 10.12.2023 um 14:03 +0100 schrieb Pierre-Henry
Fröhring:
> * guix/build-system/mix.scm: New file.
> * guix/build/mix-build-system.scm: New file.
>
> Change-Id: I8066d00f7ada4a384621bf541e679bc512e93435
> ---
I have this series with some changes to the commit logs on my local
master branch right now. I'll leave it up for a week for further
comments and push afterwards.
Thanks for your patience.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system.
2023-12-10 14:20 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Liliana Marie Prikler
@ 2023-12-10 14:22 ` Pierre-Henry Fröhring
2023-12-18 3:01 ` bug#66801: " Liliana Marie Prikler
0 siblings, 1 reply; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 14:22 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
OK! I'll continue as planned:
1. The Rebar build system will be revisited.
2. The Mix build system will be enhanced so that Phoenix builds.
• Since a few (possibly transitive) packages depend on Erlang code, we
will determine if the implementation strategy discussed earlier is effective.
I will wait for your comments before sending more patches.
Have a great week.
–
Regards,
phf
^ permalink raw reply [flat|nested] 152+ messages in thread
* bug#66801: [PATCH v5 01/15] build-system: Add mix-build-system.
2023-12-10 14:22 ` Pierre-Henry Fröhring
@ 2023-12-18 3:01 ` Liliana Marie Prikler
0 siblings, 0 replies; 152+ messages in thread
From: Liliana Marie Prikler @ 2023-12-18 3:01 UTC (permalink / raw)
To: Pierre-Henry Fröhring; +Cc: 66801-done
Am Sonntag, dem 10.12.2023 um 15:22 +0100 schrieb Pierre-Henry
Fröhring:
> OK! I'll continue as planned:
>
> 1. The Rebar build system will be revisited.
> 2. The Mix build system will be enhanced so that Phoenix builds.
> • Since a few (possibly transitive) packages depend on Erlang
> code, we
> will determine if the implementation strategy discussed earlier
> is effective.
>
> I will wait for your comments before sending more patches.
>
> Have a great week.
I've pushed this now. To keep things manageable, please send the other
stuff in a(n or possibly more) new series.
Cheers
^ permalink raw reply [flat|nested] 152+ messages in thread
* [bug#66801] Erratum
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
` (12 preceding siblings ...)
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
@ 2023-12-10 13:05 ` Pierre-Henry Fröhring
13 siblings, 0 replies; 152+ messages in thread
From: Pierre-Henry Fröhring @ 2023-12-10 13:05 UTC (permalink / raw)
To: Liliana Marie Prikler; +Cc: 66801
The patches go on top of:
┌────
│ 06f25a9a8 * origin/master gnu: xrdp: Update to 0.9.23.1.
└────
Sorry for the oversight.
–
Regards,
phf
^ permalink raw reply [flat|nested] 152+ messages in thread
end of thread, other threads:[~2023-12-18 3:02 UTC | newest]
Thread overview: 152+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
2023-10-28 21:43 ` Liliana Marie Prikler
2023-10-29 17:19 ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated Pierre-Henry Fröhring
2023-10-29 19:22 ` Liliana Marie Prikler
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm Pierre-Henry Fröhring
2023-10-29 19:25 ` Liliana Marie Prikler
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 04/32] gnu: erlang-getopt: " Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 05/32] gnu: erlang-edown: " Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 06/32] gnu: erlang-rebar3-git-vsn: " Pierre-Henry Fröhring
2023-10-29 19:31 ` Liliana Marie Prikler
2023-10-29 19:42 ` Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 07/32] gnu: erlang-rebar3-raw-deps: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 08/32] gnu: erlang-rebar3-proper: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 09/32] gnu: erlang-bbmustache: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 10/32] gnu: erlang-cf: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 11/32] gnu: erlang-yamerl: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 12/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 13/32] gnu: erlang-cth-readable: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 14/32] gnu: erlang-erlware-commons: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 15/32] gnu: erlang-eunit-formatters: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 16/32] gnu: erlang-proper: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 17/32] gnu: erlang-hex-core: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 18/32] gnu: erlang-jsx: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 19/32] gnu: erlang-relx: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 20/32] gnu: erlang-providers: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 21/32] gnu: erlang-jsone: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 22/32] gnu: erlang-parse-trans: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 23/32] gnu: erlang-unicode-util-compat: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 24/32] gnu: erlang-idna: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 25/32] gnu: erlang-bear: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 26/32] gnu: erlang-erlang-color: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 27/32] gnu: erlang-tdiff: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 28/32] gnu: erlang-rebar3-ex-doc: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 29/32] gnu: erlang-samovar: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 30/32] gnu: erlang-geas: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 31/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
2023-10-29 14:37 ` [bug#66801] [PATCH va3e5ae0f..37252e07 32/32] gnu: erlang-telemetry: " Pierre-Henry Fröhring
2023-10-29 18:29 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Liliana Marie Prikler
2023-10-29 22:14 ` Pierre-Henry Fröhring
2023-10-30 5:29 ` Liliana Marie Prikler
2023-10-30 12:30 ` Pierre-Henry Fröhring
2023-10-30 20:40 ` Liliana Marie Prikler
2023-11-08 9:21 ` [bug#66801] A minimal set of changes Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
2023-11-08 20:40 ` Liliana Marie Prikler
2023-11-13 18:58 ` Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 2/5] gnu: Add erlang-goldrush Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 3/5] gnu: Add erlang-lager Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 4/5] gnu: Add erlang-unicode-util-compat Pierre-Henry Fröhring
2023-11-08 9:22 ` [bug#66801] [PATCH 5/5] gnu: Add erlang-idna Pierre-Henry Fröhring
2023-11-13 20:26 ` [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-11-13 21:22 ` Liliana Marie Prikler
2023-11-14 10:37 ` Pierre-Henry Fröhring
2023-11-14 17:53 ` Liliana Marie Prikler
2023-11-15 9:57 ` Pierre-Henry Fröhring
2023-11-15 9:59 ` Pierre-Henry Fröhring
2023-11-15 12:40 ` [bug#66801] Fwd: " Pierre-Henry Fröhring
2023-11-15 18:36 ` [bug#66801] " Liliana Marie Prikler
2023-11-15 22:49 ` Pierre-Henry Fröhring
2023-11-15 22:51 ` [bug#66801] [PATCH v3 " Pierre-Henry Fröhring
2023-11-16 2:05 ` Liliana Marie Prikler
2023-11-16 13:01 ` Pierre-Henry Fröhring
2023-11-16 15:11 ` Liliana Marie Prikler
2023-11-16 18:12 ` Pierre-Henry Fröhring
2023-11-16 19:34 ` Liliana Marie Prikler
2023-11-17 7:36 ` Pierre-Henry Fröhring
2023-11-17 8:03 ` Pierre-Henry Fröhring
2023-11-17 19:24 ` Liliana Marie Prikler
2023-11-18 4:44 ` Pierre-Henry Fröhring
2023-11-18 7:12 ` Liliana Marie Prikler
2023-11-18 10:19 ` Pierre-Henry Fröhring
2023-11-18 11:11 ` Liliana Marie Prikler
2023-11-18 12:02 ` Pierre-Henry Fröhring
2023-12-07 22:34 ` [bug#66801] [PATCH] " Pierre-Henry Fröhring
2023-12-08 7:25 ` Liliana Marie Prikler
2023-12-08 8:01 ` Pierre-Henry Fröhring
2023-12-08 9:52 ` Liliana Marie Prikler
2023-12-08 10:17 ` Pierre-Henry Fröhring
2023-12-08 11:50 ` Liliana Marie Prikler
2023-12-08 14:20 ` Pierre-Henry Fröhring
2023-12-08 14:55 ` Liliana Marie Prikler
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 11:10 ` [bug#66801] [PATCH 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 15:29 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-08 15:30 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-08 15:30 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-08 15:31 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-08 15:33 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-08 15:33 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-08 15:35 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-08 15:36 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-08 15:38 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-08 15:39 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-08 15:39 ` Liliana Marie Prikler
2023-12-08 15:03 ` [bug#66801] [PATCH v3 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 15:03 ` [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-08 15:40 ` Liliana Marie Prikler
2023-12-08 17:30 ` Pierre-Henry Fröhring
2023-12-08 18:01 ` Liliana Marie Prikler
2023-12-08 18:19 ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-10 12:34 ` [bug#66801] (no subject) Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-10 13:04 ` [bug#66801] [PATCH v5 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-10 14:20 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Liliana Marie Prikler
2023-12-10 14:22 ` Pierre-Henry Fröhring
2023-12-18 3:01 ` bug#66801: " Liliana Marie Prikler
2023-12-10 13:05 ` [bug#66801] Erratum Pierre-Henry Fröhring
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.