[PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang

  • Done
  • quality assurance status badge
Details
3 participants
  • Hartmut Goebel
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Hartmut Goebel
Severity
normal
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:01
(address . guix-patches@gnu.org)
cover.1649436566.git.h.goebel@crazy-compilers.com
Hi,

this is an updated version of #42180 and #51061 (both are closed
already). Notable changes are:

* the „extracting downloader“ and „hexpm-fetch” are gone

* documentation added for both the importer and the rebar3-build-system

* tests added for the importer

Some remarks on the patches:

* First patch adds a file guix/hexpm-download.scm, containing
definitions for the hex.pm repository. These are combined in
this module here since different build-systems (will) use it.

* The importer tries to detect the build system to be used. For Elexir
packages it creates package definitions using the “mix-build-system‘. This I
will add later (WIP).

* Next there patches provide the packages required rebar3, rebar3 itself and
some plugins for rebar3.

Open question:

* Shall the build system actually be called „rebar*3*“ or just „rebar“? There
is also a build-tool „rebar2“, which is obsoltete and not supported by this
build-system. Anyhow, somewhen in the future there might be some „rebar4“,
which we might be able to cover with the same build-system. WDYT?


Hartmut Goebel (22):
import: Add hex.pm importer.
gnu: Add erlang-cf.
gnu: Add erlang-certifi.
gnu: Add erlang-erlware-commons.
gnu: Add erlang-cth-readable.
gnu: Add erlang-bbmustache.
gnu: Add erlang-getopt.
gnu: Add erlang-eunit-formatters.
gnu: Add erlang-providers.
gnu: Add erlang-parse-trans.
gnu: Add erlang-hex-core.
gnu: Add erlang-ssl-verify-fun.
gnu: Add erlang-relx.
gnu: Add erlang-edown.
gnu: Add erlang-jsone.
gnu: Add erlang-proper.
gnu: Add erlang-covertool.
gnu: Add rebar3.
gnu: Add rebar3-raw-deps.
gnu: Add rebar3-git-vsn.
gnu: Add rebar3-proper.
build-system: Add 'rebar3-build-system'.

Makefile.am | 6 +
doc/guix.texi | 70 ++++-
gnu/packages/erlang.scm | 488 +++++++++++++++++++++++++++++
guix/build-system/rebar3.scm | 143 +++++++++
guix/build/rebar3-build-system.scm | 147 +++++++++
guix/hexpm-download.scm | 40 +++
guix/import/hexpm.scm | 347 ++++++++++++++++++++
guix/scripts/import.scm | 2 +-
guix/scripts/import/hexpm.scm | 109 +++++++
po/guix/POTFILES.in | 1 +
tests/hexpm.scm | 257 +++++++++++++++
11 files changed, 1608 insertions(+), 2 deletions(-)
create mode 100644 guix/build-system/rebar3.scm
create mode 100644 guix/build/rebar3-build-system.scm
create mode 100644 guix/hexpm-download.scm
create mode 100644 guix/import/hexpm.scm
create mode 100644 guix/scripts/import/hexpm.scm
create mode 100644 tests/hexpm.scm

--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 01/22] import: Add hex.pm importer.
(address . 54796@debbugs.gnu.org)
8a73d6c31892010f068775a5c6fa18ec8224b62f.1649436566.git.h.goebel@crazy-compilers.com
hex.pm is a package repository for Erlang and Elixir.

* doc/guix.texi (Invoking guix import): Document it.
* guix/scripts/import/hexpm.scm, guix/import/hexpm.scm,
guix/hexpm-download.scm: New files.
* tests/hexpm.scm: New file.
* Makefile.am (MODULES, SCM_TESTS): Register them.
* po/guix/POTFILES.in: Likewise.
* guix/scripts/import.scm (importers): Add "hexpm".
---
Makefile.am | 4 +
doc/guix.texi | 29 ++-
guix/hexpm-download.scm | 40 ++++
guix/import/hexpm.scm | 347 ++++++++++++++++++++++++++++++++++
guix/scripts/import.scm | 2 +-
guix/scripts/import/hexpm.scm | 109 +++++++++++
po/guix/POTFILES.in | 1 +
tests/hexpm.scm | 257 +++++++++++++++++++++++++
8 files changed, 787 insertions(+), 2 deletions(-)
create mode 100644 guix/hexpm-download.scm
create mode 100644 guix/import/hexpm.scm
create mode 100644 guix/scripts/import/hexpm.scm
create mode 100644 tests/hexpm.scm

Toggle diff (503 lines)
diff --git a/Makefile.am b/Makefile.am
index aedb514ee1..be2c183206 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -100,6 +100,7 @@ MODULES = \
guix/git-download.scm \
guix/hg-download.scm \
guix/hash.scm \
+ guix/hexpm-download.scm \
guix/swh.scm \
guix/monads.scm \
guix/monad-repl.scm \
@@ -263,6 +264,7 @@ MODULES = \
guix/import/gnu.scm \
guix/import/go.scm \
guix/import/hackage.scm \
+ guix/import/hexpm.scm \
guix/import/json.scm \
guix/import/kde.scm \
guix/import/launchpad.scm \
@@ -311,6 +313,7 @@ MODULES = \
guix/scripts/import/gnu.scm \
guix/scripts/import/go.scm \
guix/scripts/import/hackage.scm \
+ guix/scripts/import/hexpm.scm \
guix/scripts/import/json.scm \
guix/scripts/import/minetest.scm \
guix/scripts/import/opam.scm \
@@ -488,6 +491,7 @@ SCM_TESTS = \
tests/graph.scm \
tests/gremlin.scm \
tests/hackage.scm \
+ tests/hexpm.scm \
tests/home-import.scm \
tests/http-client.scm \
tests/import-git.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index e8ef4286be..6c17b26d70 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -48,7 +48,7 @@ Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017, 2021 Christine Lemmer-Webber@*
Copyright @copyright{} 2017, 2018, 2019, 2020, 2021, 2022 Marius Bakke@*
-Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
+Copyright @copyright{} 2017, 2019, 2020, 2022 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
Copyright @copyright{} 2017–2022 Tobias Geerinckx-Rice@*
Copyright @copyright{} 2017 George Clemmer@*
@@ -12817,6 +12817,33 @@ guix import egg arrays@@1.0
@end example
Additional options include:
+@table @code
+@item --recursive
+@itemx -r
+Traverse the dependency graph of the given upstream package recursively
+and generate package expressions for all those packages that are not yet
+in Guix.
+@end table
+
+@item hexpm
+@cindex hexpm
+Import metadata from the hex.pm Erlang and Elixir package repository
+@uref{https://hex.pm, hex.pm}, as in this example:
+
+@example
+guix import hexpm stun
+@end example
+
+The importer tries to determine the build system used by the package.
+
+The hexpm importer also allows you to specify a version string:
+
+@example
+guix import hexpm cf@@0.3.0
+@end example
+
+Additional options include:
+
@table @code
@item --recursive
@itemx -r
diff --git a/guix/hexpm-download.scm b/guix/hexpm-download.scm
new file mode 100644
index 0000000000..e2f0eb22a8
--- /dev/null
+++ b/guix/hexpm-download.scm
@@ -0,0 +1,40 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix hexpm-download)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm-package-url
+ hexpm-uri))
+
+;;;
+;;; Definitions for the hex.pm repository,
+;;; combined here since different build-systems use it.
+;;;
+
+;; URL and paths from
+;; https://github.com/hexpm/specifications/blob/master/endpoints.md
+(define %hexpm-repo-url
+ (make-parameter "https://repo.hex.pm"))
+
+(define hexpm-package-url
+ (string-append (%hexpm-repo-url) "/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"))
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
new file mode 100644
index 0000000000..bf7cfb333f
--- /dev/null
+++ b/guix/import/hexpm.scm
@@ -0,0 +1,347 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
+;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2017, 2019-2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix import hexpm)
+ #:use-module (guix base32)
+ #:use-module ((guix download) #:prefix download:)
+ #:use-module (guix hexpm-download)
+ #:use-module (gcrypt hash)
+ #:use-module (guix http-client)
+ #:use-module (json)
+ #:use-module (guix import utils)
+ #:use-module ((guix import json) #:select (json-fetch))
+ #:use-module ((guix build utils)
+ #:select ((package-name->name+version
+ . hyphen-package-name->name+version)
+ dump-port))
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix upstream)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 popen)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-2)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm->guix-package
+ guix-package->hexpm-name
+ strings->licenses ;; why used here?
+ hexpm-recursive-import
+ %hexpm-updater))
+
+;;;
+;;; Interface to https://hex.pm/api, version 2.
+;;; REST-API end-points:
+;;; https://github.com/hexpm/specifications/blob/master/apiary.apib
+;;; Repository end-points:
+;;; https://github.com/hexpm/specifications/blob/master/endpoints.md
+;;;
+
+(define %hexpm-api-url
+ (make-parameter "https://hex.pm/api"))
+
+(define (package-url name)
+ (string-append (%hexpm-api-url) "/packages/" name))
+
+;;
+;; Hexpm Package. /packages/${name}
+;; https://github.com/hexpm/specifications/blob/master/apiary.apib#Package
+;;
+;; Each package can have several "releases", each of which has its own set of
+;; requirements, build-tool, etc. - see <hexpm-release> below.
+(define-json-mapping <hexpm-pkgdef> make-hexpm-pkgdef hexpm-pkgdef?
+ json->hexpm
+ (name hexpm-name) ; string
+ (html-url hexpm-html-url "html_url") ; string
+ (docs-html-url hexpm-docs-html-url "docs_html_url") ; string | #nil
+ (meta hexpm-meta "meta" json->hexpm-meta)
+ (versions hexpm-versions "releases" ; list of <hexpm-version>
+ (lambda (vector)
+ (map json->hexpm-version
+ (vector->list vector))))
+ ;; "latest_version" and "latest_stable_version" are not named in the
+ ;; specification, butt seen in practice.
+ (latest-version hexpm-latest-version "latest_version") ; string
+ (latest-stable hexpm-latest-stable "latest_stable_version")) ; string
+
+;; Hexpm package metadata.
+(define-json-mapping <hexpm-meta> make-hexpm-meta hexpm-meta?
+ json->hexpm-meta
+ (description hexpm-meta-description) ;string
+ (licenses hexpm-meta-licenses "licenses" ;list of strings
+ (lambda (vector)
+ (or (and vector (vector->list vector))
+ #f))))
+
+;; Hexpm package versions.
+(define-json-mapping <hexpm-version> make-hexpm-version hexpm-version?
+ json->hexpm-version
+ (number hexpm-version-number "version") ;string
+ (url hexpm-version-url)) ;string
+
+
+(define (lookup-hexpm name)
+ "Look up NAME on hex.pm and return the corresopnding <hexpm> record
+or #f if it was not found."
+ (and=> (json-fetch (package-url name))
+ json->hexpm))
+
+;;
+;; Hexpm release. /packages/${name}/releases/${version}
+;; https://github.com/hexpm/specifications/blob/master/apiary.apib#Release
+;;
+(define-json-mapping <hexpm-release> make-hexpm-release hexpm-release?
+ json->hexpm-release
+ (version hexpm-release-version) ; string
+ (url hexpm-release-url) ; string
+ (meta hexpm-release-meta "meta" json->hexpm-release-meta)
+ ;; Specification names the next fiels "dependencies", but in practice it is
+ ;; "requirements".
+ (dependencies hexpm-requirements "requirements")) ; list of <hexpm-dependency>
+
+;; Hexpm release meta.
+;; https://github.com/hexpm/specifications/blob/main/package_metadata.md
+(define-json-mapping <hexpm-release-meta>
+ make-hexpm-release-meta hexpm-release-meta?
+ json->hexpm-release-meta
+ (app hexpm-release-meta-app) ; string
+ (elixir hexpm-release-meta-elixir) ; string
+ (build-tools hexpm-release-meta-build-tools "build_tools" ; list of strings
+ (lambda (vector)
+ (or (and vector (vector->list vector))
+ (list)))))
+
+;; Hexpm dependency. Each requirement has information about the required
+;; version, such as "~> 2.1.2" or ">= 2.1.2 and < 2.2.0", see
+;; <https://hexdocs.pm/elixir/Version.html#module-requirements>, and whether
+;; the dependency is optional.
+(define-json-mapping <hexpm-dependency> make-hexpm-dependency
+ hexpm-dependency?
+ json->hexpm-dependency
+ (name hexpm-dependency-name "app") ; string
+ (requirement hexpm-dependency-requirement) ; string
+ (optional hexpm-dependency-optional)) ; bool
+
+(define (hexpm-release-dependencies release)
+ "Return the list of dependency names of RELEASE, a <hexpm-release>."
+ (let ((reqs (or (hexpm-requirements release) '#())))
+ (map first reqs))) ;; TODO: also return required version
+
+
+(define (lookup-hexpm-release version*)
+ "Look up RELEASE on hexpm-version-url and return the corresopnding
+<hexpm-release> record or #f if it was not found."
+ (and=> (json-fetch (hexpm-version-url version*))
+ json->hexpm-release))
+
+
+;;;
+;;; Converting hex.pm packages to Guix packages.
+;;;
+
+(define (maybe-inputs package-inputs input-type)
+ "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
+package definition. INPUT-TYPE, a symbol, is used to populate the name of
+the input field."
+ (match package-inputs
+ (()
+ '())
+ ((package-inputs ...)
+ `((,input-type (list ,@package-inputs))))))
+
+(define (dependencies->package-names names)
+ "Given a list of hexpm package NAMES, returns a list of guix package names
+as symbols."
+ ;; TODO: Base name on languange of dependency.
+ ;; The languange used for implementing the depcendency is not know without
+ ;; recursing the dependencies. So for now assume more packages are based on
+ ;; Erlang and prefix all dependencies with "erlang-" (the default).
+ (map string->symbol
+ (map hexpm-name->package-name
+ (sort names string-ci<?))))
+
+(define* (make-hexpm-sexp #:key name version tarball-url
+ home-page synopsis description license
+ language build-system dependencies
+ #:allow-other-keys)
+ "Return the `package' s-expression for a hexpm package with the given NAME,
+VERSION, TARBALL-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE. The
+created package's name will stem from LANGUAGE. BUILD-SYSTEM defined the
+build-system, and DEPENDENCIES the inputs for the package."
+ (call-with-temporary-output-file
+ (lambda (temp port)
+ (and (url-fetch tarball-url temp)
+ (values
+ `(package
+ (name ,(hexpm-name->package-name name language))
+ (version ,version)
+ (source (origin
+ (method url-fetch)
+ (uri (hexpm-uri ,name version))
+ (sha256 (base32 ,(guix-hash-url temp)))))
+ (build-system ,build-system)
+ ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+ (synopsis ,synopsis)
+ (description ,(beautify-description description))
+ (home-page ,(match home-page
+ (() "")
+ (_ home-page)))
+ (license ,(match license
+ (() #f)
+ ((license) license)
+ (_ `(list ,@license))))))))))
+
+(define (strings->licenses strings)
+ "Convert the list of STRINGS into a list of license objects."
+ (filter-map (lambda (license)
+ (and (not (string-null? license))
+ (not (any (lambda (elem) (string=? elem license))
+ '("AND" "OR" "WITH")))
+ (or (spdx-string->license license)
+ license)))
+ strings))
+
+(define (hexpm-latest-release package)
+ "Return the version string for the latest stable release of PACKAGE."
+ ;; Use latest-stable if specified (see comment in hexpm-pkgdef above),
+ ;; otherwise compare the lists of release versions.
+ (let ((latest-stable (hexpm-latest-stable package)))
+ (if (not (unspecified? latest-stable))
+ latest-stable
+ (let ((versions (map hexpm-version-number (hexpm-versions package))))
+ (fold (lambda (a b)
+ (if (version>? a b) a b)) (car versions) versions)))))
+
+(define* (hexpm->guix-package package-name #:key repo version)
+ "Fetch the metadata for PACKAGE-NAME from hexpms.io, and return the
+`package' s-expression corresponding to that package, or #f on failure.
+When VERSION is specified, attempt to fetch that version; otherwise fetch the
+latest version of PACKAGE-NAME."
+
+ (define package
+ (lookup-hexpm package-name))
+
+ (define version-number
+ (and package
+ (or version
+ (hexpm-latest-release package))))
+
+ (define version*
+ (and package
+ (find (lambda (version)
+ (string=? (hexpm-version-number version)
+ version-number))
+ (hexpm-versions package))))
+
+ (define release
+ (and package version*
+ (lookup-hexpm-release version*)))
+
+ (define release-meta
+ (and package version*
+ (hexpm-release-meta release)))
+
+ (define build-system
+ (and package version*
+ (let ((build-tools (hexpm-release-meta-build-tools release-meta)))
+ (cond
+ ((member "rebar3" build-tools) 'rebar3-build-system)
+ ((member "mix" build-tools) 'mix-build-system)
+ ((member "make" build-tools) 'gnu-build-system)
+ (else #f)))))
+
+ (define language
+ (and package version*
+ (let ((elixir (hexpm-release-meta-elixir release-meta)))
+ (cond
+ ((and (string? elixir) (not (string-null? elixir))) "elixir")
+ (else "erlang")))))
+
+ (and package version*
+ (let ((dependencies (hexpm-release-dependencies release))
+ (pkg-meta (hexpm-meta package))
+ (docs-html-url (hexpm-docs-html-url package)))
+ (values
+ (make-hexpm-sexp
+ #:language language
+ #:build-system build-system
+ #:name package-name
+ #:version version-number
+ #:dependencies dependencies
+ #:home-page (or (and (not (eq? docs-html-url 'null))
+ docs-html-url)
+ ;; TODO: Homepage?
+ (hexpm-html-url package))
+ #:synopsis (hexpm-meta-description pkg-meta)
+ #:description (hexpm-meta-description pkg-meta)
+ #:license (or (and=> (hexpm-meta-licenses pkg-meta)
+ strings->licenses))
+ #:tarball-url (hexpm-uri package-name version-number))
+ dependencies))))
+
+(define* (hexpm-recursive-import pkg-name #:optional version)
+ (recursive-import pkg-name
+ #:version version
+ #:repo->guix-package hexpm->guix-package
+ #:guix-name hexpm-name->package-name))
+
+(define (guix-package->hexpm-name package)
+ "Return the hex.pm name of PACKAGE."
+ (define (url->hexpm-name url)
+ (hyphen-package-name->name+version
+ (basename (file-sans-extension url))))
+
+ (match (and=> (package-source package) origin-uri)
+ ((? string? url)
+ (url->hexpm-name url))
+ ((lst ...)
+ (any url->hexpm-name lst))
+ (#f #f)))
+
+(define* (hexpm-name->package-name name #:optional (language "erlang"))
+ (string-append language "-" (string-join (string-split name #\_) "-")))
+
+
+;;;
+;;; Updater
+;;;
+
+(define (latest-release package)
+ "Return an <upstream-source> for the latest release of PACKAGE."
+ (let* ((hexpm-name (guix-package->hexpm-name package))
+ (hexpm (lookup-hexpm hexpm-name))
+ (version (hexpm-latest-release hexpm))
+ (url (hexpm-uri hexpm-name version)))
+ (upstream-source
+ (package (package-name package))
+ (version version)
+ (urls (list url)))))
+
+(define %hexpm-updater
+ (upstream-updater
+ (name 'hexpm)
+ (description "Updater for hex.pm packages")
+ (pred (url-prefix-predicate hexpm-package-url))
+ (latest latest-release)))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 40fa6759ae..aaadad4adf 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -79,7 +79,7 @@ rather than \\n."
;;;
(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa"
- "gem" "go" "cran" "crate" "texlive" "json" "opam"
+ "gem" "go" "cran" "crate" "texlive" "json" "opam" "hexpm"
"minetest"))
(define (resolve-importer name)
diff --git a/guix/scripts/import/hexpm.scm b/guix/scripts/import/hexpm.scm
new file mode 100644
index 0000000000..b49d263f9e
--- /dev/null
+++ b/guix/scripts/import/hexpm.scm
@@ -0,0 +1,109 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 David T
This message was truncated. Download the full message here.
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 02/22] gnu: Add erlang-cf.
(address . 54796@debbugs.gnu.org)
f6719af209b0c4912472bd751941a44f68c6720d.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-cf): New variable.
---
gnu/packages/erlang.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 888a0f4f1e..0b9e89d134 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Nikita <nikita@n0.is>
+;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
;;;
@@ -26,6 +27,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix build-system emacs)
+ #:use-module (guix build-system rebar3)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
@@ -203,3 +205,20 @@ built-in support for concurrency, distribution and fault tolerance.")
"This package provides an Emacs major mode for editing Erlang source
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 "cf" version))
+ (sha256
+ (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
+ (build-system rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 03/22] gnu: Add erlang-certifi.
(address . 54796@debbugs.gnu.org)
25be4a7ca6f9af888b6a97f6ab03e2e3ae2caaf7.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-certifi): New variable.
---
gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 0b9e89d134..95a18e6f18 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -206,6 +206,30 @@ built-in support for concurrency, distribution and fault tolerance.")
files.")
(license license:asl2.0)))
+(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 rebar3-build-system)
+ (arguments
+ `(#:tests? #f)) ;; have not been updated for latest cert bundle
+ (home-page "https://github.com/certifi/erlang-certifi/")
+ (synopsis "CA bundle adapted from Mozilla for Erlang")
+ (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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 04/22] gnu: Add erlang-erlware-commons.
(address . 54796@debbugs.gnu.org)
3d46f7da1d14db0cbab7ae275b4807bcae3b94ab.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-erlware-commons): New variable.
---
gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 95a18e6f18..34761a4d64 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -246,3 +246,30 @@ Mozilla's canonical set.")
(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-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 rebar3-build-system)
+ (propagated-inputs
+ (list erlang-cf))
+ (native-inputs
+ (list git)) ;; Required for tests
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'check-setup
+ (lambda _
+ (setenv "TERM" "xterm")))))) ; enable color in logs
+ (home-page "http://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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 05/22] gnu: Add erlang-cth-readable.
(address . 54796@debbugs.gnu.org)
d9a56b1cb8dd349c2ab7dfcf4170c34106ad1e9f.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-cth-readable): New variable.
---
gnu/packages/erlang.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 34761a4d64..faf6509a4e 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -247,6 +247,27 @@ Mozilla's canonical set.")
printing extending the io:format syntax to add colours.")
(license license:expat)))
+(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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 06/22] gnu: Add erlang-bbmustache.
(address . 54796@debbugs.gnu.org)
79b9e17d9908b8b0b2d432e05b072d218f2e3f0c.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-bbmustache): New variable.
---
gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index faf6509a4e..1682521ca1 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -206,6 +206,38 @@ built-in support for concurrency, distribution and fault tolerance.")
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 rebar3-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")
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 07/22] gnu: Add erlang-getopt.
(address . 54796@debbugs.gnu.org)
3bea95519470305cd6257097343b78006a7d1d5c.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-getopt): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 1682521ca1..af79e2cd7d 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -326,3 +326,20 @@ outputs you want to be readable around all that noise they contain.")
(description "Erlware Commons is an Erlware project focused on all aspects
of reusable Erlang components.")
(license license:expat)))
+
+(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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 08/22] gnu: Add erlang-eunit-formatters.
(address . 54796@debbugs.gnu.org)
a0c5e2d63ff8651adabb331cf6b3a317c3160718.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-eunit-formatters): New variable.
---
gnu/packages/erlang.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Toggle diff (29 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index af79e2cd7d..154c11f207 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -327,6 +327,22 @@ outputs you want to be readable around all that noise they contain.")
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 rebar3-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")
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 09/22] gnu: Add erlang-providers.
(address . 54796@debbugs.gnu.org)
41ad6588ef2b9ab5fec7fa0229c60852c92e9b33.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-providers): New variable.
---
gnu/packages/erlang.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Toggle diff (28 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 154c11f207..85e491bb1d 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -359,3 +359,21 @@ of reusable Erlang components.")
(description "This package provides an Erlang module to parse command line
arguments using the GNU getopt syntax.")
(license license:bsd-3)))
+
+(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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 10/22] gnu: Add erlang-parse-trans.
(address . 54796@debbugs.gnu.org)
02b2a5809c945daae97889d7e0469ce9cc74a2fe.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-parse-trans): New variable.
---
gnu/packages/erlang.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (32 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 85e491bb1d..fc4b6f47d9 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -360,6 +360,25 @@ of reusable Erlang components.")
arguments using the GNU getopt syntax.")
(license license:bsd-3)))
+(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 rebar3-build-system)
+ (inputs
+ (list erlang-getopt))
+ (home-page "https://github.com/uwiger/parse_trans")
+ (synopsis "Parse transform utilities for Erlang")
+ (description "This package provides parse transform utilities for
+Erlang.")
+ (license license:asl2.0)))
+
(define-public erlang-providers
(package
(name "erlang-providers")
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 11/22] gnu: Add erlang-hex-core.
(address . 54796@debbugs.gnu.org)
8ed9c12690957e747a4a46558921e21e12e964db.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-hex-core): New variable.
---
gnu/packages/erlang.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index fc4b6f47d9..826bc67d40 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -360,6 +360,32 @@ of reusable Erlang components.")
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 rebar3-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-parse-trans
(package
(name "erlang-parse-trans")
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 12/22] gnu: Add erlang-ssl-verify-fun.
(address . 54796@debbugs.gnu.org)
d501af8e7563e6f51ec9c7e42c4efd094f7162df.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-ssl-verify-fun): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 826bc67d40..a7e63db0f3 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -422,3 +422,20 @@ Erlang.")
(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 "ssl_verify_fun" version))
+ (sha256
+ (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
+ (build-system rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 13/22] gnu: Add erlang-relx.
(address . 54796@debbugs.gnu.org)
64926e421fb4145966cc13c57869d13ebf33a1d2.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-relx): New variable.
---
gnu/packages/erlang.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (35 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index a7e63db0f3..626043a1b5 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -423,6 +423,28 @@ Erlang.")
(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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 14/22] gnu: Add erlang-edown.
(address . 54796@debbugs.gnu.org)
69b9c4486b710432fa7516bb5f34ce2841d2ebd8.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-edown): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (30 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 626043a1b5..1a4ff36abb 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -300,6 +300,23 @@ printing extending the io:format syntax to add colours.")
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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 15/22] gnu: Add erlang-jsone.
(address . 54796@debbugs.gnu.org)
1de6de372360203b61ac09b4486c0ff6a79bc5df.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-jsone): New variable.
---
gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 1a4ff36abb..91ce74f2d0 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -403,6 +403,30 @@ arguments using the GNU getopt syntax.")
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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 16/22] gnu: Add erlang-proper.
(address . 54796@debbugs.gnu.org)
41de68b47c956b9f0f7802093fbe2a329057d86e.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-proper): New variable.
---
gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 91ce74f2d0..9a626a65a2 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -446,6 +446,33 @@ specifications.")
Erlang.")
(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 rebar3-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-providers
(package
(name "erlang-providers")
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 17/22] gnu: Add erlang-covertool.
(address . 54796@debbugs.gnu.org)
863d3ffbaad0b942c939ae7d1969196c7c14cbd3.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-covertool): New variable.
---
gnu/packages/erlang.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Toggle diff (33 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 9a626a65a2..256b622fa3 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -279,6 +279,26 @@ Mozilla's canonical set.")
printing extending the io:format syntax to add colours.")
(license license:expat)))
+(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 rebar3-build-system)
+ (home-page "https://github.com/covertool/covertool")
+ (synopsis "Convert Erlang cover data into Cobertura XML reports")
+ (description "This package provides a build tool and plugin to convert
+exported Erlang 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.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 18/22] gnu: Add rebar3.
(address . 54796@debbugs.gnu.org)
9e3e90c9240599c212e5f8025e0967f9894b668f.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3): New variable.
---
gnu/packages/erlang.scm | 76 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)

Toggle diff (86 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 256b622fa3..35681e9a73 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -549,3 +549,79 @@ a well configured release directory.")
(description "This package provides SSL verification functions for
Erlang.")
(license license:expat)))
+
+(define-public rebar3
+ (package
+ (name "rebar3")
+ (version "3.18.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/erlang/rebar3")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "09648hzc2mnjwf9klm20cg4hb5rn2xv2gmzcg98ffv37p5yfl327"))))
+ (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))))
+ (home-page "https://www.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
+compile and test Erlang applications, port drivers and releases.
+
+@code{rebar3} is a self-contained Erlang script, so it's easy to distribute or
+even embed directly in a project. Where possible, rebar uses standard
+Erlang/OTP conventions for project structures, thus minimizing the amount of
+build configuration work. @code{rebar3} also provides dependency management,
+enabling application writers to easily re-use common libraries from a variety
+of locations (git, hg, etc).")
+ (license license:asl2.0)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 19/22] gnu: Add rebar3-raw-deps.
(address . 54796@debbugs.gnu.org)
38f49c05eda35a1c0492583bd3a8fcc1e1cdf21f.1649436566.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-raw-deps): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 35681e9a73..8bd7ba3739 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -625,3 +625,20 @@ build configuration work. @code{rebar3} also provides dependency management,
enabling application writers to easily re-use common libraries from a variety
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 rebar3-build-system)
+ (home-page "https://github.com/soranoba/rebar3_raw_deps")
+ (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
+ (description "This plugin adds support for \"raw\" dependencies to
+rebar3.")
+ (license license:expat)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 20/22] gnu: Add rebar3-git-vsn.
(address . 54796@debbugs.gnu.org)
bddf8df158bd6340f5380e0c188886a08b69fcf4.1649436567.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-git-vsn): New variable.
---
gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (49 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 8bd7ba3739..acd7c76aa1 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -37,6 +37,7 @@
#: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))
@@ -642,3 +643,34 @@ of locations (git, hg, etc).")
(description "This plugin adds support for \"raw\" dependencies to
rebar3.")
(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 rebar3-build-system)
+ (inputs
+ (list git))
+ (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")))
+ (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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 21/22] gnu: Add rebar3-proper.
(address . 54796@debbugs.gnu.org)
caaaad5c5d1d4ff052ec8c1b136d515d589c41ac.1649436567.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-proper): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index acd7c76aa1..339d93496b 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -674,3 +674,20 @@ rebar3.")
(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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 8 Apr 2022 19:03
[PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
(address . 54796@debbugs.gnu.org)
4227ca2ef20c4ea7f6bb452dba271baad877a93f.1649436567.git.h.goebel@crazy-compilers.com
* guix/build-system/rebar3.scm, guix/build/rebar3-build-system.scm: New files.
* Makefile.am (MODULES): Register them.
* doc/guix.texi (Build Systems): Document it.
---
Makefile.am | 2 +
doc/guix.texi | 41 ++++++++
guix/build-system/rebar3.scm | 143 ++++++++++++++++++++++++++++
guix/build/rebar3-build-system.scm | 147 +++++++++++++++++++++++++++++
4 files changed, 333 insertions(+)
create mode 100644 guix/build-system/rebar3.scm
create mode 100644 guix/build/rebar3-build-system.scm

Toggle diff (376 lines)
diff --git a/Makefile.am b/Makefile.am
index be2c183206..bb538222b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -164,6 +164,7 @@ MODULES = \
guix/build-system/waf.scm \
guix/build-system/r.scm \
guix/build-system/rakudo.scm \
+ guix/build-system/rebar3.scm \
guix/build-system/ruby.scm \
guix/build-system/scons.scm \
guix/build-system/texlive.scm \
@@ -217,6 +218,7 @@ MODULES = \
guix/build/r-build-system.scm \
guix/build/renpy-build-system.scm \
guix/build/rakudo-build-system.scm \
+ guix/build/rebar3-build-system.scm \
guix/build/ruby-build-system.scm \
guix/build/scons-build-system.scm \
guix/build/texlive-build-system.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index 6c17b26d70..518fabf48d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8717,6 +8717,47 @@ with @code{#:zef} or removed by passing @code{#f} to the
@code{with-zef?} parameter.
@end defvr
+@defvr {Scheme Variable} rebar3-build-system
+This variable is exported by @code{(guix build-system rebar3)}. It
+implements a build procedure around @code{rebar3}.
+
+It adds both @code{rebar3} and the @code{erlang} to the set of inputs.
+Different packages can be specified with the @code{#:rebar} and
+@code{#:erlang} parameters, respectively.
+
+This build system is based on @code{gnu-build-system}, but with the
+following phases changed:
+
+@table @code
+
+@item unpack
+This phase, after unpacking the source like the @code{gnu-build-system}
+does, checks for a file @code{contents.tar.gz} at the top-level of the
+source. If this file exists, it will be unpacked, too. This eases
+handling of package hosted by @i{hex.pm}.
+
+@item bootstrap
+@item configure
+There are no @code{bootstrap} and @code{configure} phase because erlang
+packages typically don’t need to be configured.
+
+@item build
+This phase runs @code{rebar3 compile}
+with the flags listed in @code{#:rebar-flags}.
+
+@item check
+Unless @code{#:tests? #f} is passed,
+this phase runs @code{rebar3 eunit},
+or some other target specified with @code{#:test-target},
+with the flags listed in @code{#:rebar-flags},
+
+@item install
+This installs the files created in the @i{default} profile, or some
+other profile specified with @code{#:install-profile}.
+
+@end table
+@end defvr
+
@defvr {Scheme Variable} texlive-build-system
This variable is exported by @code{(guix build-system texlive)}. It is
used to build TeX packages in batch mode with a specified engine. The
diff --git a/guix/build-system/rebar3.scm b/guix/build-system/rebar3.scm
new file mode 100644
index 0000000000..b96c806258
--- /dev/null
+++ b/guix/build-system/rebar3.scm
@@ -0,0 +1,143 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix build-system rebar3)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix monads)
+ #:use-module (guix search-paths)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module ((guix hexpm-download) #:select (hexpm-uri) #:prefix dl:)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm-uri
+ %rebar3-build-system-modules
+ rebar3-build
+ rebar3-build-system))
+
+;;
+;; Standard build procedure for Erlang packages using Rebar3.
+;;
+
+(define hexpm-uri dl:hexpm-uri)
+
+(define %rebar3-build-system-modules
+ ;; Build-side modules imported by default.
+ `((guix build rebar3-build-system)
+ ,@%gnu-build-system-modules))
+
+(define (default-rebar3)
+ "Return the default Rebar3 package."
+ ;; 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."
+ ;; 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
+ ;; Keep the standard inputs of 'gnu-build-system'.
+ ,@(standard-packages)))
+ (build-inputs `(("rebar" ,rebar)
+ ("erlang" ,erlang) ;; for escriptize
+ ,@native-inputs))
+ (outputs outputs)
+ (build rebar3-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (rebar3-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 rebar3-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (native-search-paths '())
+ (system (%current-system))
+ (imported-modules %rebar3-build-system-modules)
+ (modules '((guix build rebar3-build-system)
+ (guix build utils))))
+ "Build SOURCE with INPUTS."
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(rebar3-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)))
+ ;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
+ ;; co. would be interpreted as referring to grafted packages.
+ (gexp->derivation name builder
+ #:system system
+ #:target #f
+ #:graft? #f
+ #:guile-for-build guile)))
+
+(define rebar3-build-system
+ (build-system
+ (name 'rebar3)
+ (description "The standard Rebar3 build system")
+ (lower lower)))
diff --git a/guix/build/rebar3-build-system.scm b/guix/build/rebar3-build-system.scm
new file mode 100644
index 0000000000..ae18538ed3
--- /dev/null
+++ b/guix/build/rebar3-build-system.scm
@@ -0,0 +1,147 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; 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>
+;;;
+;;; 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 (guix build rebar3-build-system)
+ #: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 (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (rebar3-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~%")))
+
+(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 %standard-phases
+ (modify-phases gnu:%standard-phases
+ (replace 'unpack unpack)
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-before 'build 'erlang-depends erlang-depends)
+ (replace 'build build)
+ (replace 'check check)
+ (replace 'install install)))
+
+(define* (rebar3-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))
--
2.30.2
M
M
Maxime Devos wrote on 9 Apr 2022 12:58
Re: [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons.
b554bf986120a278725a01b00b5e2779ee1021c6.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (3 lines)
> +    (native-inputs
> +     (list git))  ;; Required for tests

Maybe git-minimal/fixed, to avoid rebuilds if 'git' is updated.

Greetings,
MAxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFm2xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qSVAP9S2AqA1ScAWQSFj+TryoCw2mcJ
4+I3Aa52iEDeoJwv4wD/XB+nX9VqGN56uXK0mvHuAYhkQur7/HwiM1+qYxLqYQY=
=UMs9
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:39
Re: [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi.
2285d26dd5b271a42bafb8aec553ba031f36d107.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (7 lines)
> +    (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

Can this bundle be built from 'nss-certs', such that when nss-certs is
updated (e.g. Mozilla revokes a root certificate due to reasons),
erlang-certifi is up-to-date as well?

Also, if Erlang supports some kind of static linking, then a package
like this might be useful for people wanting to make static binaries to
distribute to (non-Guix) systems.

However, adding packages like nss-certs to the package inputs is
avoided in favour of SSL_CERT_DIR/SSL_CERT_FILE / /etc/ssl/certs, to
avoid rebuilds (*) when nss-certs is updated and because people might
want to use a different set of root certificates (e.g., le-certs, none,
or a list of (non-CA) certificates for a few individual sites).

As such, can this package be avoided as dependency?

Also see:

(tzdata instead of nss-certs, but same principle)
(about rebuilds)
(some security reasons for not including nss-certs in the inputs
or even the user profile)

(*) nowaday it is less of a concern because of grafting, but grafting
can take a long time.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFwZhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kLjAQDafaG6JZ1bLIhnjoaogDgCUXz0
SBlZO+VW1sVG1X1fqwD/V1ZnDlzPoa5Kj+NSix3qc+xYSid3zWGUNiuzoCCBQgs=
=ffy7
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:41
Re: [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans.
88f4ccef42aff62bb7763c8ff6212fd15be4037c.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (4 lines)
> +    (synopsis "Parse transform utilities for Erlang")
> +    (description "This package provides parse transform utilities for
> +Erlang.")

This description is a bit parse, ‘(guix)Synopses and Descriptions’
recommends longer descriptions. What's a ‘parse transform utility’?
How do I know if I need one? What are they useful for? Are there
limitations and alternatives?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFw+hccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qdSAQCNwT4RTCFbWZ1XIC7koIDUfjVk
F1MWRU/bWvGNCAVewgEA5yGWELrL6uwfD0FOhZn0F173MUEvI5Z9XK1XIItO1Q0=
=NtbM
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:43
Re: [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
62d3d45e3ef8ce6e59faf89ad11fd490e63b9c41.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (2 lines)
> +    (description "Relx assembles releases for an Erlang/OTP release.  Given a

What does ‘Erlang/OTP’ mean here? Is it like "make dist", or more like
"cargo publish", or "git tag v1.2.3"?

Greetings,
MAxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFxbxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7leWAQDr3wGNHxrey9ZQZEOFZuEc/1YH
zikoV5cNfVnS868kvAD+N5pKa/DpSo3nHw4euCefoPBzJJ3KQVNt5ulg62sjKww=
=Akru
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:45
c200a47d95f13f30efc38f0f1a5e80c5fac6771b.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (3 lines)
> +    (propagated-inputs
> +     (list erlang-bbmustache))

erlang-relx looks like some kind of tool that can be run and not a
library. As such, does it belong in erlang.scm or package-
management.scm? Does the input need to be propagated? Can the
'erlang-' prefix be dropped?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFx0hccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lWmAQDL4LHVD0uek3JTA5T0t5ZSwvGh
Ju4sv9C8zYBb8Tv2sgD/fcuooFeSzBokpkan98OnZxEIKJIzlgPciYlxjAoE5wU=
=JSt8
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:48
Re: [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool.
1608ff50be88f8f2a33301aaee0407343233f089.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (9 lines)
> +    (synopsis "Convert Erlang cover data into Cobertura XML reports")
> +    (description "This package provides a build tool and plugin to convert
> +exported Erlang 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)))

What is ‘cover data’? Is it line coverage information for testing if a
test suite is of good quality, or is it for calculating a minimal
convex covering of a set of points?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFycRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lBOAP0d4CTetjxT3pAT7ZxKn1usuCFM
RBb4sDIWStHM2LHQzgEAoirjB/qSZviOifFIHG1I9gXRepy3M995Zh0tArpd1Qo=
=4yVn
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:49
Re: [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps.
d32443e499d6ce6368c5f1c261365eebda69741c.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (4 lines)
> +    (synopsis "Rebar3 plugin for supporting \"raw\" dependencies")
> +    (description "This plugin adds support for \"raw\" dependencies to
> +rebar3.")

The synopsis and description are practically identical here. What is a
‘raw’ depency? How does someone know if "raw" dependencies might be
useful for their purposes?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFy4hccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gyDAP43IiX9j//qa2e8DRIur2d/a11+
fbljToPRg98QjOXxFAD/QO2fBjZPMxLgHACbVGgNCfJCcaqlRpuioR2oCzedEQU=
=oVpi
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:52
Re: [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
2dada794ef45e2134663af43dfe3916532b6a078.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (2 lines)
> +  (docs-html-url hexpm-docs-html-url "docs_html_url") ; string | #nil

There is (currently) no Guix code written in Emacs Lisp. Do you mean
#f instead of #nil?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFzhBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sGqAQCZcYFnKCuyoHJdB0maAPAoc51N
h+r4leI78zWFZai30gD+PtwMN7feBosa8S8SOqH7V9iDMC+VWbsuELqbd/NF0Qw=
=gasT
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:53
2cd8a66b9e0c474096105ef70ffceea1305383cb.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (2 lines)
> +  ;; Specification names the next fiels "dependencies", but in practice it is

typo: fiels -> fields?
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlFzuhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7lBrAQCHGZ6zxN723ZYfpXcJqpwgGbdC
8pczVsRkMgU6yCqVrQD+N88+qnf/uWnm4gV3abeTMg0NxO66c3S6WOJ1vhmfCgE=
=E945
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:55
b3cb7d4af94bfef4182e5be3f23052c72a5866f2.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (10 lines)
> +(define (maybe-inputs package-inputs input-type)
> +  "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
> +package definition.  INPUT-TYPE, a symbol, is used to populate the name of
> +the input field."
> +  (match package-inputs
> +    (()
> +     '())
> +    ((package-inputs ...)
> +     `((,input-type (list ,@package-inputs))))))

This procedure 'maybe-inputs', or at least a similar procedure, already
seems to exist in (guix import utils).

Greetings,
MAxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlF0OxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uQ4AP9eHEdcb5ooHnqf5VfhdsoLR/RZ
JeHPapVztU+3qj6hyAD8DqEI+uXQEJJ94HBCExybdB65cIX1vaRmY/SFz0/B2wM=
=rKHw
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:56
718156ea9254b387e8711493600be3060b62cb32.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (5 lines)
> +  ;; TODO: Base name on languange of dependency.
> +  ;; The languange used for implementing the depcendency is not know without
> +  ;; recursing the dependencies.  So for now assume more packages are based on
> +  ;; Erlang and prefix all dependencies with "erlang-" (the default).

typos: depcendency, languange?
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlF0WRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nQXAP0UdeEiG9Pwy7ZHfDGlMa+iyeMc
i3rk023s+5e7ytPpVwEAzVDnYsfI0h+ETxmVEC5V6cr8OHgFcr9JuW1/qE6QSwk=
=3Uvc
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:58
0b92cf95a7aa5482467a02937786cac52f507d14.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (2 lines)
> +         (name ,(hexpm-name->package-name name language))

Would it possible to detect if a package is a library or a tool, and if
it's the latter, drop the "erlang-" prefix automatically (and move
propagated-inputs to inputs)?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlF09RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7jDBAP4ilGrbwk8kE9eeyquaFCi8wnaL
RR+Rat5Wfi0L531s+wD+MrIRRPXvC3HMXjzO2Loo1/TPdyTc0Mr+yXRT2Wddlg4=
=ypvw
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 13:59
cd61be3bd8dc0a2ab64b8a64ace72b04dcdd3814.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (5 lines)
> +   (lambda (temp port)
> +     (and (url-fetch tarball-url temp)
> +          (values
> +       `(package

WOuld 'alist->package' be useful here?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlF1JxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hU4AQCLFK7gy+PuReBS16vnlw7tLuRu
YfUGkF59nx3yjYgUggD+JEb36Q0QOfebhW6errcDPhEmwCj6cY3G5aJinoNX4QE=
=IXxy
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 14:07
ee5e3ba785a11abb06260b07b6df5c3534fcb925.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (13 lines)
> +(test-assert "hexpm->guix-package"
> +  ;; Replace network resources with sample data.
> +  (mock ((guix http-client) http-fetch
> +         (lambda (url . rest)
> +           (match url
> +             ("https://hex.pm/api/packages/bla"
> +              (values (open-input-string test-bla-package)
> +                      (string-length test-bla-package)))
> +             ("https://hex.pm/api/packages/bla/releases/1.5.0"
> +              (values (open-input-string test-bla-release)
> +                      (string-length test-bla-release)))
> +             (_ (error "http-fetch got unexpected URL: " url)))))

From what I've gathered, with-http-server and the like is preferred
above mocking, though with-http-server might need to be extended first
to allow checking the URL (see https://issues.guix.gnu.org/53389).

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlF2+xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rKLAP9p0LLdPGS6nBGpW5jyWcap9l8+
Mkd/+uq/HQVMc+mAygEA+j/t40CcXyg0bEwwf/7+P1uSy/tZ+yg7mUlcLbX1dgc=
=O+tc
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 15:16
Re: [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
e79005c1930bc216171ab06407fcfb224e08100c.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:

Toggle quote (2 lines)
> * guix/build-system/rebar3.scm, guix/build/rebar3-build-system.scm: New files.

This patch seems out-of-order. Wouldn't rebar3-build-system need to be
added before packages using rebar3-build-system?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlGHJBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kH2AQDdNn3Q7lGdlxQRveIBEoqpxhGb
1EvQ44/sj1JPvSY1RAEA3EtXNVmnCtVHd1ypGwPNGfWnEpi2U9YwOwzENFnWWAo=
=JsDL
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 15:19
13d5d93be4c0091b2b49586f97b9ce5c1a41a559.camel@telenet.be
Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
Toggle quote (8 lines)
> +         (system system)
> +         (host-inputs `(,@(if source
> +                              `(("source" ,source))
> +                              '())
> +                        ,@inputs
> +                         ;; Keep the standard inputs of 'gnu-build-system'.
> +                         ,@(standard-packages)))

(standard-packages) needs to be in 'build-inputs', at least according
to 'lower' in (guix build-system gnu).

Toggle quote (4 lines)
> +         (build-inputs `(("rebar" ,rebar)
> +                         ("erlang" ,erlang) ;; for escriptize
> +                         ,@native-inputs))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlGH3RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7j0aAP9n0QXe3FdGJ27/CkmlMTxhkzXc
iumZ4XmtAPYzbiPbvwEA+TleuFl95iJjXuxtO1Pd3toJed7v6zcT72Cm+zGlkQE=
=bDK0
-----END PGP SIGNATURE-----


H
H
Hartmut Goebel wrote on 9 Apr 2022 17:18
Re: [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
8b42b066-913b-ef42-e126-93a3fbc02abb@crazy-compilers.com
Am 09.04.22 um 13:45 schrieb Maxime Devos:
Toggle quote (3 lines)
> erlang-relx looks like some kind of tool that can be run and not a
> library. … Can the 'erlang-' prefix be dropped?

The github repo says: „|relx| is a library used by rebar3“. Thus I'd
keep the „erlang-“ prefix.

Toggle quote (2 lines)
> Does the input need to be propagated?

AFAIK: Like for Python, run-time dependencies of Erlang *libraries* need
to be propagated. Erlang does not actually have a notion of „library“.
It's more like Rust where all all dependent sources are expected to be
available at build-time and then put into the „executable“. Basically
this is statically linked, so only developers/package-builders are
effected by this propagation.

Would be great if some experienced Erlang developer would show up and
show a solution without needing to propagate.

--
Regards
Hartmut Goebel

| Hartmut Goebel |h.goebel@crazy-compilers.com |
|www.crazy-compilers.com | compilers which you thought are impossible |
Attachment: file
H
H
Hartmut Goebel wrote on 9 Apr 2022 17:19
Re: [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans.
a5083edb-4561-62c5-f441-aae4f27c7975@crazy-compilers.com
Am 09.04.22 um 13:41 schrieb Maxime Devos:
Toggle quote (2 lines)
> This description is a bit parse, ‘(guix)Synopses and Descriptions’
> recommends longer descriptions.
I added a more verbose description based on the projects readme.


--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 17:32
Re: [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
3db85a93-09ad-1e66-795e-b63d5ef1f30b@crazy-compilers.com
Am 09.04.22 um 13:43 schrieb Maxime Devos:
Toggle quote (5 lines)
> Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
>> +    (description "Relx assembles releases for an Erlang/OTP release.  Given a
> What does ‘Erlang/OTP’ mean here? Is it like "make dist", or more like
> "cargo publish", or "git tag v1.2.3"?

OTP is a collection of middleware, libraries, and tools written in
Erlang programming language (Wikipedia,
like the Java run-time engine plus libraries.

So „Erlang/OTP” is a standing term in the Erlang and Elixir world. Thus
I would keep it, expecting that Erlang developers understand this.

I can't explain what this library does — all I know is: it's a
dependency of rebar3.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 17:33
Re: [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons.
d8644b90-1cf9-9cda-dcec-81ed57928248@crazy-compilers.com
Am 09.04.22 um 12:58 schrieb Maxime Devos:
Toggle quote (2 lines)
> Maybe git-minimal/fixed, to avoid rebuilds if 'git' is updated.

Done.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 17:40
Re: [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool.
c610b793-e0f9-6512-6aac-81b611c89038@crazy-compilers.com
Am 09.04.22 um 13:48 schrieb Maxime Devos:
Toggle quote (2 lines)
> What is ‘cover data’?

Rephrased into „Convert Erlang code-coverage data generated by @code{cover}
into Cobertura XML reports“

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 17:50
Re: [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps.
ec6e9b7e-123b-347a-8590-d53a34448d54@crazy-compilers.com
Am 09.04.22 um 13:49 schrieb Maxime Devos:
Toggle quote (4 lines)
> The synopsis and description are practically identical here. What is a
> ‘raw’ depency? How does someone know if "raw" dependencies might be
> useful for their purposes?

„raw deps” are non-OTP applications.

Rephrased into „This plugin provides support for handling non-OTP
applications as a dependent libraries“.

(That's all I can tell based on the Readme and from trying to understand
the code.)

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 18:01
Re: [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
68ce2d00-65a8-35d9-ae94-63de6fe36502@crazy-compilers.com
Am 09.04.22 um 13:58 schrieb Maxime Devos:
Toggle quote (4 lines)
> Would it possible to detect if a package is a library or a tool, and if
> it's the latter, drop the "erlang-" prefix automatically (and move
> propagated-inputs to inputs)?

Good idea! This would indeed be cool and supportive for the packager.
Anyhow, AFAIK the meta-data does not provide such information. (Just
double-checked with https://hex.pm/api/packages/ejabberdand one of the
releases there.)

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 18:04
Re: [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
e3d57a9a-50eb-1a89-c1a4-067d044932e5@crazy-compilers.com
Am 09.04.22 um 15:16 schrieb Maxime Devos:
Toggle quote (3 lines)
> This patch seems out-of-order. Wouldn't rebar3-build-system need to be
> added before packages using rebar3-build-system?

However you like. Just tell me.

Since the rebar3 build-system requires rebar3, any way round results in
a hen-and-egg-problem.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 18:28
81040c10-21ed-8b91-2785-1df21f232872@crazy-compilers.com
Am 09.04.22 um 15:19 schrieb Maxime Devos:
Toggle quote (3 lines)
> (standard-packages) needs to be in 'build-inputs', at least according
> to 'lower' in (guix build-system gnu).

Build-systems are inconsistent here: texlive, ruby, python have them in
host-inputs. gnu, cmake, qt have them in build-inputs. Seems like thus
generating platform independent code tend to have it in host, the others
in build.

Can you elaborate the criteria which to choose? (I also just created

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 18:31
Re: [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
56ff21f5-6b37-d3fb-3ba3-03f157a8eda2@crazy-compilers.com
Am 09.04.22 um 13:52 schrieb Maxime Devos:
Toggle quote (3 lines)
> There is (currently) no Guix code written in Emacs Lisp. Do you mean
> #f instead of #nil?

Actually its 'null. Fixed.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 9 Apr 2022 18:50
86478645-336b-ab53-1ef1-3f92d292ffc7@crazy-compilers.com
Am 09.04.22 um 13:55 schrieb Maxime Devos:
Toggle quote (3 lines)
> This procedure 'maybe-inputs', or at least a similar procedure, already
> seems to exist in (guix import utils).

Thanks for this hint.

Unfortunately that return „old-style“ inputs:

  (inputs
   `(("erlang-base64url" ,erlang-base64url)


--
Regards
Hartmut Goebel

| Hartmut Goebel |h.goebel@crazy-compilers.com |
|www.crazy-compilers.com | compilers which you thought are impossible |
Attachment: file
M
M
Maxime Devos wrote on 9 Apr 2022 19:57
Re: [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
5cb8ddd0c1f2bfd4d459aa4eb4921f9b793d800f.camel@telenet.be
Hartmut Goebel schreef op za 09-04-2022 om 18:28 [+0200]:
Toggle quote (8 lines)
> Am 09.04.22 um 15:19 schrieb Maxime Devos:
> > (standard-packages) needs to be in 'build-inputs', at least according
> > to 'lower' in (guix build-system gnu).
>
> Build-systems are inconsistent here: texlive, ruby, python have them in
> host-inputs. gnu, cmake, qt have them in build-inputs. Seems like thus
> generating platform independent code tend to have it in host,

ruby and python are, from Guix POV, not platform-independent code, as
they may have baked-in references to platform-specific binaries.
Their build systems don't support cross-compilation yet though ...

Toggle quote (6 lines)
> the others
> in build.
>
> Can you elaborate the criteria which to choose? (I also just created
> https://issues.guix.gnu.org/54820 for this)

Always build-inputs -- some of the not-yet-cross-compiling build
systems do it different, but maybe they will gain cross-compilation
someday, and to do that, (standard-packages) needs to be in the right
place! I've added some info to https://issues.guix.gnu.org/54820.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlHJEhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ucrAP935RvJdAqlGt6lkNv4RuCPbmQ0
/Blh4+cuiTIkIJIe3AD/f7mX3skgAGni1Jpj74ujLdZmZNetZdW67o0/o4yy3AU=
=ZXXR
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Apr 2022 22:56
7a3f64a1f27cbd235ba2fded8f1b6a354e2cca12.camel@telenet.be
Hartmut Goebel schreef op za 09-04-2022 om 18:04 [+0200]:
Toggle quote (10 lines)
> Am 09.04.22 um 15:16 schrieb Maxime Devos:
> > This patch seems out-of-order.  Wouldn't rebar3-build-system need to be
> > added before packages using rebar3-build-system?
>
> However you like. Just tell me.
>
> Since the rebar3 build-system requires rebar3, any way round results in
> a hen-and-egg-problem.
>

Oh right. I would do the rebar3 build-system before rebar3. Then the
packages stil cannot be for quite a few commit, but at there won't be
'Unbound variable: rebar3-build-system’ errors when doing a bisection
with git.

The guix-data-service might still not like it though, so CC'ing cbaines
for input.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlHy8RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7sx8AP9a0HqUkNx0WhZZjmtu/Bcf740N
6Wh1ixS2iKYLMhHXQgEAnG2ZMfheFFQEpo0DZ4/MyOTm1Povy/hBlkUbJWkyaQs=
=aEJQ
-----END PGP SIGNATURE-----


H
H
Hartmut Goebel wrote on 10 Apr 2022 12:27
Re: [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi.
bea2db8b-0957-6a32-52ae-615ba3cc2e65@crazy-compilers.com
Am 09.04.22 um 13:39 schrieb Maxime Devos:
Toggle quote (4 lines)
> Can this bundle be built from 'nss-certs', such that when nss-certs is
> updated (e.g. Mozilla revokes a root certificate due to reasons),
> erlang-certifi is up-to-date as well?

This package is a sibling of python-certifi [1] and
go-github-com-certifi-gocertifi. All these contain a copy of the/a CA
bundle — which is the idea of these packages: „useful for systems that
do not have CA bundles“. So they intentionally do not honor
SSL_CERT_DIR/…. They are meant to be used as fall-back for
libraries/applications honoring SSL_CERT_DIR/….

Neither python-certifi nor gocertifi build on nss-cert. Addind some
update mechanism into the Guix package is not a good idea IMO: This
would make “erlang-certif@2.9.0“ contain different certificates than the
release 2.9.0, making debugging a hell.

Toggle quote (1 lines)
> As such, can this package be avoided as dependency?
As of now, rebar3 does not support SSL_CERT_DIR/…. Anyhow there is
already an open ticket [3] for.

Other libraries/application might still need erlang-certifi, like some
need python-certifi or gocertif. So anyhow we should keep this package.


--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |]
H
H
Hartmut Goebel wrote on 10 Apr 2022 12:36
Re: [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
90bdc31b-4b3f-8193-5087-c5f8ee1cc9df@crazy-compilers.com
Am 09.04.22 um 14:07 schrieb Maxime Devos:
Toggle quote (4 lines)
> From what I've gathered, with-http-server and the like is preferred
> above mocking, though with-http-server might need to be extended first
> to allow checking the URL (see<https://issues.guix.gnu.org/53389>).

Since this issue is stale (and referring to another stale issue). And I
don't want to block this patch series by stale issues.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 10 Apr 2022 13:22
1887b943-01b9-8126-d474-6e7fd12397a5@crazy-compilers.com
Am 09.04.22 um 13:59 schrieb Maxime Devos:
Toggle quote (2 lines)
> WOuld 'alist->package' be useful here?

Thanks for pointing me to that. Unfortunately, since records are used
here (not alists) and since „alist->package“ expects the licenses to be
an alist, too, the code using „alist->package“ would be quite ugly.

Your tip brought me to „package->code“. Sadly I dif not get this to
work: I failed converting

         ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)

into the unquoted form.

--
Regards
Hartmut Goebel

| Hartmut Goebel |h.goebel@crazy-compilers.com |
|www.crazy-compilers.com | compilers which you thought are impossible |
Attachment: file
M
M
Maxime Devos wrote on 10 Apr 2022 14:26
abfbe5421a0378600b0ae63550e096f98a51d661.camel@telenet.be
Hartmut Goebel schreef op zo 10-04-2022 om 12:36 [+0200]:
Toggle quote (8 lines)
> Am 09.04.22 um 14:07 schrieb Maxime Devos:
> >   From what I've gathered, with-http-server and the like is preferred
> > above mocking, though with-http-server might need to be extended first
> > to allow checking the URL (see<https://issues.guix.gnu.org/53389>).
>
> Since this issue is stale (and referring to another stale issue). And I
> don't want to block this patch series by stale issues.

Ok.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlLNBBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7iWKAPwMxHn+4ZCdAaj7DWZFLGiejOCf
zJkYukaA/MLcJubFqwEAod7zN5M8L2Q08rs7Aa+ZSkX1FxE/R0c2a8l1jxCl/A0=
=VcJw
-----END PGP SIGNATURE-----


H
H
Hartmut Goebel wrote on 10 Apr 2022 20:47
Re: [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
f32506d3-c20d-4328-4fff-fe075025878c@crazy-compilers.com
Am 09.04.22 um 19:57 schrieb Maxime Devos:
Toggle quote (2 lines)
> Always build-inputs

Done.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:49
3e96511f-563c-1092-0c45-b99d4f00ebd4@crazy-compilers.com
Am 09.04.22 um 22:56 schrieb Maxime Devos:
Toggle quote (5 lines)
> Oh right. I would do the rebar3 build-system before rebar3. Then the
> packages stil cannot be for quite a few commit, but at there won't be
> 'Unbound variable: rebar3-build-system’ errors when doing a bisection
> with git.

Good point. Changed.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
(address . 54796@debbugs.gnu.org)
cover.1649616716.git.h.goebel@crazy-compilers.com
Thanks to Maxime Devos for the review of V3. Do ease review for other
reviewers, here is a complete set of updated patches, incorporating Maxime's
comments.

Cover text from v3:

this is an updated version of #42180 and #51061 (both are closed
already). Notable changes are:

* the „extracting downloader“ and „hexpm-fetch” are gone

* documentation added for both the importer and the rebar3-build-system

* tests added for the importer

Some remarks on the patches:

* First patch adds a file guix/hexpm-download.scm, containing
definitions for the hex.pm repository. These are combined in
this module here since different build-systems (will) use it.

* The importer tries to detect the build system to be used. For Elexir
packages it creates package definitions using the “mix-build-system‘. This I
will add later (WIP).

* Next there patches provide the packages required rebar3, rebar3 itself and
some plugins for rebar3.

Open question:

* Shall the build system actually be called „rebar*3*“ or just „rebar“? There
is also a build-tool „rebar2“, which is obsoltete and not supported by this
build-system. Anyhow, somewhen in the future there might be some „rebar4“,
which we might be able to cover with the same build-system. WDYT?

Hartmut Goebel (22):
import: Add hex.pm importer.
build-system: Add 'rebar3-build-system'.
gnu: Add erlang-cf.
gnu: Add erlang-certifi.
gnu: Add erlang-erlware-commons.
gnu: Add erlang-cth-readable.
gnu: Add erlang-bbmustache.
gnu: Add erlang-getopt.
gnu: Add erlang-eunit-formatters.
gnu: Add erlang-providers.
gnu: Add erlang-parse-trans.
gnu: Add erlang-hex-core.
gnu: Add erlang-ssl-verify-fun.
gnu: Add erlang-relx.
gnu: Add erlang-edown.
gnu: Add erlang-jsone.
gnu: Add erlang-proper.
gnu: Add erlang-covertool.
gnu: Add rebar3.
gnu: Add rebar3-raw-deps.
gnu: Add rebar3-git-vsn.
gnu: Add rebar3-proper.

Makefile.am | 5 +
doc/guix.texi | 70 +++-
gnu/packages/erlang.scm | 493 +++++++++++++++++++++++++++++
guix/build-system/rebar3.scm | 143 +++++++++
guix/build/rebar3-build-system.scm | 147 +++++++++
guix/hexpm-download.scm | 40 +++
guix/import/hexpm.scm | 347 ++++++++++++++++++++
guix/scripts/import.scm | 2 +-
guix/scripts/import/hexpm.scm | 109 +++++++
guix/upstream.scm | 1 +
tests/hexpm.scm | 257 +++++++++++++++
11 files changed, 1612 insertions(+), 2 deletions(-)
create mode 100644 guix/build-system/rebar3.scm
create mode 100644 guix/build/rebar3-build-system.scm
create mode 100644 guix/hexpm-download.scm
create mode 100644 guix/import/hexpm.scm
create mode 100644 guix/scripts/import/hexpm.scm
create mode 100644 tests/hexpm.scm

--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 02/22] build-system: Add 'rebar3-build-system'.
(address . 54796@debbugs.gnu.org)
ff7998dc0ee622ecc26ba278495691dfcd62b42a.1649616716.git.h.goebel@crazy-compilers.com
* guix/build-system/rebar3.scm, guix/build/rebar3-build-system.scm: New files.
* Makefile.am (MODULES): Add them.
---
Makefile.am | 2 +
doc/guix.texi | 41 ++++++++
guix/build-system/rebar3.scm | 143 ++++++++++++++++++++++++++++
guix/build/rebar3-build-system.scm | 147 +++++++++++++++++++++++++++++
4 files changed, 333 insertions(+)
create mode 100644 guix/build-system/rebar3.scm
create mode 100644 guix/build/rebar3-build-system.scm

Toggle diff (376 lines)
diff --git a/Makefile.am b/Makefile.am
index 46481dac2c..e2321d1098 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -164,6 +164,7 @@ MODULES = \
guix/build-system/waf.scm \
guix/build-system/r.scm \
guix/build-system/rakudo.scm \
+ guix/build-system/rebar3.scm \
guix/build-system/ruby.scm \
guix/build-system/scons.scm \
guix/build-system/texlive.scm \
@@ -217,6 +218,7 @@ MODULES = \
guix/build/r-build-system.scm \
guix/build/renpy-build-system.scm \
guix/build/rakudo-build-system.scm \
+ guix/build/rebar3-build-system.scm \
guix/build/ruby-build-system.scm \
guix/build/scons-build-system.scm \
guix/build/texlive-build-system.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index 6c17b26d70..518fabf48d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8717,6 +8717,47 @@ with @code{#:zef} or removed by passing @code{#f} to the
@code{with-zef?} parameter.
@end defvr
+@defvr {Scheme Variable} rebar3-build-system
+This variable is exported by @code{(guix build-system rebar3)}. It
+implements a build procedure around @code{rebar3}.
+
+It adds both @code{rebar3} and the @code{erlang} to the set of inputs.
+Different packages can be specified with the @code{#:rebar} and
+@code{#:erlang} parameters, respectively.
+
+This build system is based on @code{gnu-build-system}, but with the
+following phases changed:
+
+@table @code
+
+@item unpack
+This phase, after unpacking the source like the @code{gnu-build-system}
+does, checks for a file @code{contents.tar.gz} at the top-level of the
+source. If this file exists, it will be unpacked, too. This eases
+handling of package hosted by @i{hex.pm}.
+
+@item bootstrap
+@item configure
+There are no @code{bootstrap} and @code{configure} phase because erlang
+packages typically don’t need to be configured.
+
+@item build
+This phase runs @code{rebar3 compile}
+with the flags listed in @code{#:rebar-flags}.
+
+@item check
+Unless @code{#:tests? #f} is passed,
+this phase runs @code{rebar3 eunit},
+or some other target specified with @code{#:test-target},
+with the flags listed in @code{#:rebar-flags},
+
+@item install
+This installs the files created in the @i{default} profile, or some
+other profile specified with @code{#:install-profile}.
+
+@end table
+@end defvr
+
@defvr {Scheme Variable} texlive-build-system
This variable is exported by @code{(guix build-system texlive)}. It is
used to build TeX packages in batch mode with a specified engine. The
diff --git a/guix/build-system/rebar3.scm b/guix/build-system/rebar3.scm
new file mode 100644
index 0000000000..753dcf0989
--- /dev/null
+++ b/guix/build-system/rebar3.scm
@@ -0,0 +1,143 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix build-system rebar3)
+ #:use-module (guix store)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix monads)
+ #:use-module (guix search-paths)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system gnu)
+ #:use-module ((guix hexpm-download) #:select (hexpm-uri) #:prefix dl:)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm-uri
+ %rebar3-build-system-modules
+ rebar3-build
+ rebar3-build-system))
+
+;;
+;; Standard build procedure for Erlang packages using Rebar3.
+;;
+
+(define hexpm-uri dl:hexpm-uri)
+
+(define %rebar3-build-system-modules
+ ;; Build-side modules imported by default.
+ `((guix build rebar3-build-system)
+ ,@%gnu-build-system-modules))
+
+(define (default-rebar3)
+ "Return the default Rebar3 package."
+ ;; 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."
+ ;; 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 rebar3-build)
+ (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (rebar3-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 rebar3-build-system)
+ %standard-phases))
+ (outputs '("out"))
+ (search-paths '())
+ (native-search-paths '())
+ (system (%current-system))
+ (imported-modules %rebar3-build-system-modules)
+ (modules '((guix build rebar3-build-system)
+ (guix build utils))))
+ "Build SOURCE with INPUTS."
+
+ (define builder
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
+
+ #$(with-build-variables inputs outputs
+ #~(rebar3-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)))
+ ;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
+ ;; co. would be interpreted as referring to grafted packages.
+ (gexp->derivation name builder
+ #:system system
+ #:target #f
+ #:graft? #f
+ #:guile-for-build guile)))
+
+(define rebar3-build-system
+ (build-system
+ (name 'rebar3)
+ (description "The standard Rebar3 build system")
+ (lower lower)))
diff --git a/guix/build/rebar3-build-system.scm b/guix/build/rebar3-build-system.scm
new file mode 100644
index 0000000000..ae18538ed3
--- /dev/null
+++ b/guix/build/rebar3-build-system.scm
@@ -0,0 +1,147 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; 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>
+;;;
+;;; 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 (guix build rebar3-build-system)
+ #: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 (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (rebar3-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~%")))
+
+(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 %standard-phases
+ (modify-phases gnu:%standard-phases
+ (replace 'unpack unpack)
+ (delete 'bootstrap)
+ (delete 'configure)
+ (add-before 'build 'erlang-depends erlang-depends)
+ (replace 'build build)
+ (replace 'check check)
+ (replace 'install install)))
+
+(define* (rebar3-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))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:56
[PATCH v4 01/22] import: Add hex.pm importer.
(address . 54796@debbugs.gnu.org)
1b7d1999ae7d090d17ad8953b835da9c5dc3cf54.1649616716.git.h.goebel@crazy-compilers.com
hex.pm is a package repository for Erlang and Elixir.

* guix/scripts/import.scm (importers): Add "hexpm".
* guix/scripts/import/hexpm.scm, guix/import/hexpm.scm,
guix/hexpm-download.scm: New files.
* guix/import/utils.scm (source-spec->object): Add "hexpm-fetch" to list of
fetch methods.
* guix/upstream.scm (package-update/hexpm-fetch): New function.
(%method-updates) Add it.
* Makefile.am: Add them.
---
Makefile.am | 3 +
doc/guix.texi | 29 ++-
guix/hexpm-download.scm | 40 ++++
guix/import/hexpm.scm | 347 ++++++++++++++++++++++++++++++++++
guix/scripts/import.scm | 2 +-
guix/scripts/import/hexpm.scm | 109 +++++++++++
guix/upstream.scm | 1 +
tests/hexpm.scm | 257 +++++++++++++++++++++++++
8 files changed, 786 insertions(+), 2 deletions(-)
create mode 100644 guix/hexpm-download.scm
create mode 100644 guix/import/hexpm.scm
create mode 100644 guix/scripts/import/hexpm.scm
create mode 100644 tests/hexpm.scm

Toggle diff (498 lines)
diff --git a/Makefile.am b/Makefile.am
index aedb514ee1..46481dac2c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -100,6 +100,7 @@ MODULES = \
guix/git-download.scm \
guix/hg-download.scm \
guix/hash.scm \
+ guix/hexpm-download.scm \
guix/swh.scm \
guix/monads.scm \
guix/monad-repl.scm \
@@ -263,6 +264,7 @@ MODULES = \
guix/import/gnu.scm \
guix/import/go.scm \
guix/import/hackage.scm \
+ guix/import/hexpm.scm \
guix/import/json.scm \
guix/import/kde.scm \
guix/import/launchpad.scm \
@@ -311,6 +313,7 @@ MODULES = \
guix/scripts/import/gnu.scm \
guix/scripts/import/go.scm \
guix/scripts/import/hackage.scm \
+ guix/scripts/import/hexpm.scm \
guix/scripts/import/json.scm \
guix/scripts/import/minetest.scm \
guix/scripts/import/opam.scm \
diff --git a/doc/guix.texi b/doc/guix.texi
index e8ef4286be..6c17b26d70 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -48,7 +48,7 @@ Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017, 2021 Christine Lemmer-Webber@*
Copyright @copyright{} 2017, 2018, 2019, 2020, 2021, 2022 Marius Bakke@*
-Copyright @copyright{} 2017, 2019, 2020 Hartmut Goebel@*
+Copyright @copyright{} 2017, 2019, 2020, 2022 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019, 2020, 2021 Maxim Cournoyer@*
Copyright @copyright{} 2017–2022 Tobias Geerinckx-Rice@*
Copyright @copyright{} 2017 George Clemmer@*
@@ -12817,6 +12817,33 @@ guix import egg arrays@@1.0
@end example
Additional options include:
+@table @code
+@item --recursive
+@itemx -r
+Traverse the dependency graph of the given upstream package recursively
+and generate package expressions for all those packages that are not yet
+in Guix.
+@end table
+
+@item hexpm
+@cindex hexpm
+Import metadata from the hex.pm Erlang and Elixir package repository
+@uref{https://hex.pm, hex.pm}, as in this example:
+
+@example
+guix import hexpm stun
+@end example
+
+The importer tries to determine the build system used by the package.
+
+The hexpm importer also allows you to specify a version string:
+
+@example
+guix import hexpm cf@@0.3.0
+@end example
+
+Additional options include:
+
@table @code
@item --recursive
@itemx -r
diff --git a/guix/hexpm-download.scm b/guix/hexpm-download.scm
new file mode 100644
index 0000000000..e2f0eb22a8
--- /dev/null
+++ b/guix/hexpm-download.scm
@@ -0,0 +1,40 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix hexpm-download)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm-package-url
+ hexpm-uri))
+
+;;;
+;;; Definitions for the hex.pm repository,
+;;; combined here since different build-systems use it.
+;;;
+
+;; URL and paths from
+;; https://github.com/hexpm/specifications/blob/master/endpoints.md
+(define %hexpm-repo-url
+ (make-parameter "https://repo.hex.pm"))
+
+(define hexpm-package-url
+ (string-append (%hexpm-repo-url) "/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"))
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
new file mode 100644
index 0000000000..39ac9ed5db
--- /dev/null
+++ b/guix/import/hexpm.scm
@@ -0,0 +1,347 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
+;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2017, 2019-2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.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 (guix import hexpm)
+ #:use-module (guix base32)
+ #:use-module ((guix download) #:prefix download:)
+ #:use-module (guix hexpm-download)
+ #:use-module (gcrypt hash)
+ #:use-module (guix http-client)
+ #:use-module (json)
+ #:use-module (guix import utils)
+ #:use-module ((guix import json) #:select (json-fetch))
+ #:use-module ((guix build utils)
+ #:select ((package-name->name+version
+ . hyphen-package-name->name+version)
+ dump-port))
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix monads)
+ #:use-module (guix packages)
+ #:use-module (guix upstream)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 popen)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-2)
+ #:use-module (srfi srfi-26)
+ #:export (hexpm->guix-package
+ guix-package->hexpm-name
+ strings->licenses ;; why used here?
+ hexpm-recursive-import
+ %hexpm-updater))
+
+;;;
+;;; Interface to https://hex.pm/api, version 2.
+;;; REST-API end-points:
+;;; https://github.com/hexpm/specifications/blob/master/apiary.apib
+;;; Repository end-points:
+;;; https://github.com/hexpm/specifications/blob/master/endpoints.md
+;;;
+
+(define %hexpm-api-url
+ (make-parameter "https://hex.pm/api"))
+
+(define (package-url name)
+ (string-append (%hexpm-api-url) "/packages/" name))
+
+;;
+;; Hexpm Package. /packages/${name}
+;; https://github.com/hexpm/specifications/blob/master/apiary.apib#Package
+;;
+;; Each package can have several "releases", each of which has its own set of
+;; requirements, build-tool, etc. - see <hexpm-release> below.
+(define-json-mapping <hexpm-pkgdef> make-hexpm-pkgdef hexpm-pkgdef?
+ json->hexpm
+ (name hexpm-name) ; string
+ (html-url hexpm-html-url "html_url") ; string
+ (docs-html-url hexpm-docs-html-url "docs_html_url") ; string | 'null
+ (meta hexpm-meta "meta" json->hexpm-meta)
+ (versions hexpm-versions "releases" ; list of <hexpm-version>
+ (lambda (vector)
+ (map json->hexpm-version
+ (vector->list vector))))
+ ;; "latest_version" and "latest_stable_version" are not named in the
+ ;; specification, butt seen in practice.
+ (latest-version hexpm-latest-version "latest_version") ; string
+ (latest-stable hexpm-latest-stable "latest_stable_version")) ; string
+
+;; Hexpm package metadata.
+(define-json-mapping <hexpm-meta> make-hexpm-meta hexpm-meta?
+ json->hexpm-meta
+ (description hexpm-meta-description) ;string
+ (licenses hexpm-meta-licenses "licenses" ;list of strings
+ (lambda (vector)
+ (or (and vector (vector->list vector))
+ #f))))
+
+;; Hexpm package versions.
+(define-json-mapping <hexpm-version> make-hexpm-version hexpm-version?
+ json->hexpm-version
+ (number hexpm-version-number "version") ;string
+ (url hexpm-version-url)) ;string
+
+
+(define (lookup-hexpm name)
+ "Look up NAME on hex.pm and return the corresopnding <hexpm> record
+or #f if it was not found."
+ (and=> (json-fetch (package-url name))
+ json->hexpm))
+
+;;
+;; Hexpm release. /packages/${name}/releases/${version}
+;; https://github.com/hexpm/specifications/blob/master/apiary.apib#Release
+;;
+(define-json-mapping <hexpm-release> make-hexpm-release hexpm-release?
+ json->hexpm-release
+ (version hexpm-release-version) ; string
+ (url hexpm-release-url) ; string
+ (meta hexpm-release-meta "meta" json->hexpm-release-meta)
+ ;; Specification names the next fields "dependencies", but in practice it is
+ ;; "requirements".
+ (dependencies hexpm-requirements "requirements")) ; list of <hexpm-dependency>
+
+;; Hexpm release meta.
+;; https://github.com/hexpm/specifications/blob/main/package_metadata.md
+(define-json-mapping <hexpm-release-meta>
+ make-hexpm-release-meta hexpm-release-meta?
+ json->hexpm-release-meta
+ (app hexpm-release-meta-app) ; string
+ (elixir hexpm-release-meta-elixir) ; string
+ (build-tools hexpm-release-meta-build-tools "build_tools" ; list of strings
+ (lambda (vector)
+ (or (and vector (vector->list vector))
+ (list)))))
+
+;; Hexpm dependency. Each requirement has information about the required
+;; version, such as "~> 2.1.2" or ">= 2.1.2 and < 2.2.0", see
+;; <https://hexdocs.pm/elixir/Version.html#module-requirements>, and whether
+;; the dependency is optional.
+(define-json-mapping <hexpm-dependency> make-hexpm-dependency
+ hexpm-dependency?
+ json->hexpm-dependency
+ (name hexpm-dependency-name "app") ; string
+ (requirement hexpm-dependency-requirement) ; string
+ (optional hexpm-dependency-optional)) ; bool
+
+(define (hexpm-release-dependencies release)
+ "Return the list of dependency names of RELEASE, a <hexpm-release>."
+ (let ((reqs (or (hexpm-requirements release) '#())))
+ (map first reqs))) ;; TODO: also return required version
+
+
+(define (lookup-hexpm-release version*)
+ "Look up RELEASE on hexpm-version-url and return the corresopnding
+<hexpm-release> record or #f if it was not found."
+ (and=> (json-fetch (hexpm-version-url version*))
+ json->hexpm-release))
+
+
+;;;
+;;; Converting hex.pm packages to Guix packages.
+;;;
+
+(define (maybe-inputs package-inputs input-type)
+ "Given a list of PACKAGE-INPUTS, tries to generate the 'inputs' field of a
+package definition. INPUT-TYPE, a symbol, is used to populate the name of
+the input field."
+ (match package-inputs
+ (()
+ '())
+ ((package-inputs ...)
+ `((,input-type (list ,@package-inputs))))))
+
+(define (dependencies->package-names names)
+ "Given a list of hexpm package NAMES, returns a list of guix package names
+as symbols."
+ ;; TODO: Base name on language of dependency.
+ ;; The language used for implementing the dependency is not know without
+ ;; recursing the dependencies. So for now assume more packages are based on
+ ;; Erlang and prefix all dependencies with "erlang-" (the default).
+ (map string->symbol
+ (map hexpm-name->package-name
+ (sort names string-ci<?))))
+
+(define* (make-hexpm-sexp #:key name version tarball-url
+ home-page synopsis description license
+ language build-system dependencies
+ #:allow-other-keys)
+ "Return the `package' s-expression for a hexpm package with the given NAME,
+VERSION, TARBALL-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE. The
+created package's name will stem from LANGUAGE. BUILD-SYSTEM defined the
+build-system, and DEPENDENCIES the inputs for the package."
+ (call-with-temporary-output-file
+ (lambda (temp port)
+ (and (url-fetch tarball-url temp)
+ (values
+ `(package
+ (name ,(hexpm-name->package-name name language))
+ (version ,version)
+ (source (origin
+ (method url-fetch)
+ (uri (hexpm-uri ,name version))
+ (sha256 (base32 ,(guix-hash-url temp)))))
+ (build-system ,build-system)
+ ,@(maybe-inputs (dependencies->package-names dependencies) 'inputs)
+ (synopsis ,synopsis)
+ (description ,(beautify-description description))
+ (home-page ,(match home-page
+ (() "")
+ (_ home-page)))
+ (license ,(match license
+ (() #f)
+ ((license) license)
+ (_ `(list ,@license))))))))))
+
+(define (strings->licenses strings)
+ "Convert the list of STRINGS into a list of license objects."
+ (filter-map (lambda (license)
+ (and (not (string-null? license))
+ (not (any (lambda (elem) (string=? elem license))
+ '("AND" "OR" "WITH")))
+ (or (spdx-string->license license)
+ license)))
+ strings))
+
+(define (hexpm-latest-release package)
+ "Return the version string for the latest stable release of PACKAGE."
+ ;; Use latest-stable if specified (see comment in hexpm-pkgdef above),
+ ;; otherwise compare the lists of release versions.
+ (let ((latest-stable (hexpm-latest-stable package)))
+ (if (not (unspecified? latest-stable))
+ latest-stable
+ (let ((versions (map hexpm-version-number (hexpm-versions package))))
+ (fold (lambda (a b)
+ (if (version>? a b) a b)) (car versions) versions)))))
+
+(define* (hexpm->guix-package package-name #:key repo version)
+ "Fetch the metadata for PACKAGE-NAME from hexpms.io, and return the
+`package' s-expression corresponding to that package, or #f on failure.
+When VERSION is specified, attempt to fetch that version; otherwise fetch the
+latest version of PACKAGE-NAME."
+
+ (define package
+ (lookup-hexpm package-name))
+
+ (define version-number
+ (and package
+ (or version
+ (hexpm-latest-release package))))
+
+ (define version*
+ (and package
+ (find (lambda (version)
+ (string=? (hexpm-version-number version)
+ version-number))
+ (hexpm-versions package))))
+
+ (define release
+ (and package version*
+ (lookup-hexpm-release version*)))
+
+ (define release-meta
+ (and package version*
+ (hexpm-release-meta release)))
+
+ (define build-system
+ (and package version*
+ (let ((build-tools (hexpm-release-meta-build-tools release-meta)))
+ (cond
+ ((member "rebar3" build-tools) 'rebar3-build-system)
+ ((member "mix" build-tools) 'mix-build-system)
+ ((member "make" build-tools) 'gnu-build-system)
+ (else #f)))))
+
+ (define language
+ (and package version*
+ (let ((elixir (hexpm-release-meta-elixir release-meta)))
+ (cond
+ ((and (string? elixir) (not (string-null? elixir))) "elixir")
+ (else "erlang")))))
+
+ (and package version*
+ (let ((dependencies (hexpm-release-dependencies release))
+ (pkg-meta (hexpm-meta package))
+ (docs-html-url (hexpm-docs-html-url package)))
+ (values
+ (make-hexpm-sexp
+ #:language language
+ #:build-system build-system
+ #:name package-name
+ #:version version-number
+ #:dependencies dependencies
+ #:home-page (or (and (not (eq? docs-html-url 'null))
+ docs-html-url)
+ ;; TODO: Homepage?
+ (hexpm-html-url package))
+ #:synopsis (hexpm-meta-description pkg-meta)
+ #:description (hexpm-meta-description pkg-meta)
+ #:license (or (and=> (hexpm-meta-licenses pkg-meta)
+ strings->licenses))
+ #:tarball-url (hexpm-uri package-name version-number))
+ dependencies))))
+
+(define* (hexpm-recursive-import pkg-name #:optional version)
+ (recursive-import pkg-name
+ #:version version
+ #:repo->guix-package hexpm->guix-package
+ #:guix-name hexpm-name->package-name))
+
+(define (guix-package->hexpm-name package)
+ "Return the hex.pm name of PACKAGE."
+ (define (url->hexpm-name url)
+ (hyphen-package-name->name+version
+ (basename (file-sans-extension url))))
+
+ (match (and=> (package-source package) origin-uri)
+ ((? string? url)
+ (url->hexpm-name url))
+ ((lst ...)
+ (any url->hexpm-name lst))
+ (#f #f)))
+
+(define* (hexpm-name->package-name name #:optional (language "erlang"))
+ (string-append language "-" (string-join (string-split name #\_) "-")))
+
+
+;;;
+;;; Updater
+;;;
+
+(define (latest-release package)
+ "Return an <upstream-source> for the latest release of PACKAGE."
+ (let* ((hexpm-name (guix-package->hexpm-name package))
+ (hexpm (lookup-hexpm hexpm-name))
+ (version (hexpm-latest-release hexpm))
+ (url (hexpm-uri hexpm-name version)))
+ (upstream-source
+ (package (package-name package))
+ (version version)
+ (urls (list url)))))
+
+(define %hexpm-updater
+ (upstream-updater
+ (name 'hexpm)
+ (description "Updater for hex.pm packages")
+ (pred (url-prefix-predicate hexpm-package-url))
+ (latest latest-release)))
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index 40fa6759ae..aaadad4adf 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -79,7 +79,7 @@ rather than \\n."
;;;
(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa"
- "gem" "go" "cran" "crate" "texlive" "json" "opam"
+ "gem" "go" "cran" "crate" "texlive" "json" "opam" "hexpm"
"minetest"))
(define (resolve-importer name)
diff --git a/guix/scripts/import/hexpm.scm b/guix/scripts/import/hexpm.scm
new file mode 100644
index 0000000000..b49d263f9e
--- /dev/null
+++ b/guix/scripts/import/hexpm.scm
@@ -0,0 +1,109 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 David Thompson <davet@gnu.org>
+;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebe
This message was truncated. Download the full message here.
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 03/22] gnu: Add erlang-cf.
(address . 54796@debbugs.gnu.org)
2b273525253d11c97d5202561763a30d89eb745e.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-cf): New variable.
---
gnu/packages/erlang.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 888a0f4f1e..0b9e89d134 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Nikita <nikita@n0.is>
+;;; Copyright © 2020-2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
;;; Copyright © 2021 Cees de Groot <cg@evrl.com>
;;;
@@ -26,6 +27,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
#:use-module (guix build-system emacs)
+ #:use-module (guix build-system rebar3)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
@@ -203,3 +205,20 @@ built-in support for concurrency, distribution and fault tolerance.")
"This package provides an Emacs major mode for editing Erlang source
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 "cf" version))
+ (sha256
+ (base32 "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"))))
+ (build-system rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 04/22] gnu: Add erlang-certifi.
(address . 54796@debbugs.gnu.org)
9d4747b3080cbbf91ab52389bd9802c8d36aa08f.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-certifi): New variable.
---
gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 0b9e89d134..02ea0deed1 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -206,6 +206,30 @@ built-in support for concurrency, distribution and fault tolerance.")
files.")
(license license:asl2.0)))
+(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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 05/22] gnu: Add erlang-erlware-commons.
(address . 54796@debbugs.gnu.org)
47b8bb91b19c0c8c555ce0b322f4694c3665f464.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-erlware-commons): New variable.
---
gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 02ea0deed1..98f6a44cb4 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -246,3 +246,30 @@ Mozilla's canonical set.")
(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-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 rebar3-build-system)
+ (propagated-inputs
+ (list erlang-cf))
+ (native-inputs
+ (list git-minimal/fixed)) ;; Required for tests
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'check-setup
+ (lambda _
+ (setenv "TERM" "xterm")))))) ; enable color in logs
+ (home-page "http://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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 06/22] gnu: Add erlang-cth-readable.
(address . 54796@debbugs.gnu.org)
9c93787f4991d5e9ac0f77fd439a1fcde6efd387.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-cth-readable): New variable.
---
gnu/packages/erlang.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 98f6a44cb4..a06de3bb87 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -247,6 +247,27 @@ Mozilla's canonical set.")
printing extending the io:format syntax to add colours.")
(license license:expat)))
+(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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 07/22] gnu: Add erlang-bbmustache.
(address . 54796@debbugs.gnu.org)
af8bc4127680dfdd12e66a539bed6f355710bab4.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-bbmustache): New variable.
---
gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index a06de3bb87..c025eb83cd 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -206,6 +206,38 @@ built-in support for concurrency, distribution and fault tolerance.")
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 rebar3-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")
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 08/22] gnu: Add erlang-getopt.
(address . 54796@debbugs.gnu.org)
02c3ad5b64322f6437430bafe60d8c87fafc2000.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-getopt): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c025eb83cd..2b4d0bfdc3 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -326,3 +326,20 @@ outputs you want to be readable around all that noise they contain.")
(description "Erlware Commons is an Erlware project focused on all aspects
of reusable Erlang components.")
(license license:expat)))
+
+(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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 09/22] gnu: Add erlang-eunit-formatters.
(address . 54796@debbugs.gnu.org)
993e14ecae2227545c39197f7a270d518f08b9db.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-eunit-formatters): New variable.
---
gnu/packages/erlang.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Toggle diff (29 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 2b4d0bfdc3..0b4fe327a5 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -327,6 +327,22 @@ outputs you want to be readable around all that noise they contain.")
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 rebar3-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")
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 10/22] gnu: Add erlang-providers.
(address . 54796@debbugs.gnu.org)
cc3448e48f6a15df6bff4117c7c1651f4d8dc3e0.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-providers): New variable.
---
gnu/packages/erlang.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Toggle diff (28 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 0b4fe327a5..351484b5d6 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -359,3 +359,21 @@ of reusable Erlang components.")
(description "This package provides an Erlang module to parse command line
arguments using the GNU getopt syntax.")
(license license:bsd-3)))
+
+(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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 11/22] gnu: Add erlang-parse-trans.
(address . 54796@debbugs.gnu.org)
a3f3aff6ffc8c58f1a949ccce1ee834c52209b1c.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-parse-trans): New variable.
---
gnu/packages/erlang.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (36 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 351484b5d6..df6c722f68 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -360,6 +360,29 @@ of reusable Erlang components.")
arguments using the GNU getopt syntax.")
(license license:bsd-3)))
+(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 rebar3-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-providers
(package
(name "erlang-providers")
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 13/22] gnu: Add erlang-ssl-verify-fun.
(address . 54796@debbugs.gnu.org)
494b48fa25e47554dc770a283ead188a822ac38f.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-ssl-verify-fun): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 219cc04b05..b151f5c695 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -426,3 +426,20 @@ compile-time constant.")
(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 "ssl_verify_fun" version))
+ (sha256
+ (base32 "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"))))
+ (build-system rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 12/22] gnu: Add erlang-hex-core.
(address . 54796@debbugs.gnu.org)
759948386d975c5e373b52faefc8781408f2be26.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-hex-core): New variable.
---
gnu/packages/erlang.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index df6c722f68..219cc04b05 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -360,6 +360,32 @@ of reusable Erlang components.")
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 rebar3-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-parse-trans
(package
(name "erlang-parse-trans")
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 14/22] gnu: Add erlang-relx.
(address . 54796@debbugs.gnu.org)
e6c9d2f1543d8acc59a884cab6dc45f103e55ddc.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-relx): New variable.
---
gnu/packages/erlang.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (35 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index b151f5c695..9c8f61b714 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -427,6 +427,28 @@ compile-time constant.")
(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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 15/22] gnu: Add erlang-edown.
(address . 54796@debbugs.gnu.org)
5af714f8b14605bc353f76dcb5c3cbadcbff220b.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-edown): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (30 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 9c8f61b714..a8beb7e34c 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -300,6 +300,23 @@ printing extending the io:format syntax to add colours.")
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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 16/22] gnu: Add erlang-jsone.
(address . 54796@debbugs.gnu.org)
140d9e86a3cf739a654f8d7dbf0124a42443bdb2.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-jsone): New variable.
---
gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index a8beb7e34c..fdc59894c0 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -403,6 +403,30 @@ arguments using the GNU getopt syntax.")
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 rebar3-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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 17/22] gnu: Add erlang-proper.
(address . 54796@debbugs.gnu.org)
a291aa4fe6efa4a466de56d6eb14d541fe552432.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-proper): New variable.
---
gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index fdc59894c0..33ac324074 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -450,6 +450,33 @@ 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 rebar3-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-providers
(package
(name "erlang-providers")
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 18/22] gnu: Add erlang-covertool.
(address . 54796@debbugs.gnu.org)
09ddfc5e71b2ef074936009df1f694dc7131e37f.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (erlang-covertool): New variable.
---
gnu/packages/erlang.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 33ac324074..18ea933333 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -279,6 +279,27 @@ Mozilla's canonical set.")
printing extending the io:format syntax to add colours.")
(license license:expat)))
+(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 rebar3-build-system)
+ (home-page "https://github.com/covertool/covertool")
+ (synopsis "Convert Erlang 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.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 19/22] gnu: Add rebar3.
(address . 54796@debbugs.gnu.org)
120da897838074daac150b733b46c2716f24da2c.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3): New variable.
---
gnu/packages/erlang.scm | 76 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)

Toggle diff (86 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index 18ea933333..e8f43e7de2 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -554,3 +554,79 @@ a well configured release directory.")
(description "This package provides SSL verification functions for
Erlang.")
(license license:expat)))
+
+(define-public rebar3
+ (package
+ (name "rebar3")
+ (version "3.18.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/erlang/rebar3")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "09648hzc2mnjwf9klm20cg4hb5rn2xv2gmzcg98ffv37p5yfl327"))))
+ (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))))
+ (home-page "https://www.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
+compile and test Erlang applications, port drivers and releases.
+
+@code{rebar3} is a self-contained Erlang script, so it's easy to distribute or
+even embed directly in a project. Where possible, rebar uses standard
+Erlang/OTP conventions for project structures, thus minimizing the amount of
+build configuration work. @code{rebar3} also provides dependency management,
+enabling application writers to easily re-use common libraries from a variety
+of locations (git, hg, etc).")
+ (license license:asl2.0)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 20/22] gnu: Add rebar3-raw-deps.
(address . 54796@debbugs.gnu.org)
a03bb535408fe2d4d97fce307ca3489659e2827c.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-raw-deps): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index e8f43e7de2..e5331a37a5 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -630,3 +630,20 @@ build configuration work. @code{rebar3} also provides dependency management,
enabling application writers to easily re-use common libraries from a variety
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 rebar3-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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 21/22] gnu: Add rebar3-git-vsn.
(address . 54796@debbugs.gnu.org)
349cec253c9e68e1836cc85d0d435271a3fa191f.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-git-vsn): New variable.
---
gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (49 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index e5331a37a5..c6cffd9906 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -37,6 +37,7 @@
#: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))
@@ -647,3 +648,34 @@ of locations (git, hg, etc).")
(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 rebar3-build-system)
+ (inputs
+ (list git-minimal/fixed))
+ (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)))
--
2.30.2
H
H
Hartmut Goebel wrote on 10 Apr 2022 20:57
[PATCH v4 22/22] gnu: Add rebar3-proper.
(address . 54796@debbugs.gnu.org)
d66c818b55b57a297cad03c8281d2eb1c4cc43ab.1649616716.git.h.goebel@crazy-compilers.com
* gnu/packages/erlang.scm (rebar3-proper): New variable.
---
gnu/packages/erlang.scm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c6cffd9906..ea441e1c2a 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -679,3 +679,20 @@ applications as a dependent libraries.")
(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 rebar3-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)))
--
2.30.2
M
M
Maxime Devos wrote on 11 Apr 2022 14:04
Re: [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
d432ccd7899311d0797b98be6355677363302bb7.camel@telenet.be
Hartmut Goebel schreef op zo 10-04-2022 om 20:57 [+0200]:
Toggle quote (5 lines)
> * Shall the build system actually be called „rebar*3*“ or just „rebar“? There
>   is also a build-tool „rebar2“, which is obsoltete and not supported by this
>   build-system. Anyhow, somewhen in the future there might be some „rebar4“,
>   which we might be able to cover with the same build-system. WDYT?

Was the rebar2 --> rebar3 change mostly backwards-compatible, and would
a hypothetical rebar2 or rebar4 build system look mostly the same?
If both hold, I would treat rebar2 --> rebar3 as ‘merely’ a package
update from python@2 to python@3 -- some breaking changes, but no need
for separate build systems (and hence, no 3 suffix)

If rebar2, rebar3 and rebar4 would require completely different phases
and use different file formats or such, IMO a separate build system
(and hence, a 2, 3 or 4 suffix) may be useful.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYlQZYBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ifOAQCFHG0x5ivnZCLGu/Dv+JB7BQFO
ufS0RrFWOSeCDM9g3wEA+Czp4Nj0Vmf5r+UA4SGN3jNUlbRAsE8bDspM7NDTbwA=
=jABI
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 29 Apr 2022 15:06
Re: bug#54796: [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 54796@debbugs.gnu.org)
877d7882ev.fsf_-_@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (3 lines)
> * guix/build-system/rebar3.scm, guix/build/rebar3-build-system.scm: New files.
> * Makefile.am (MODULES): Add them.

Please mention the guix.texi changes here.

Toggle quote (4 lines)
> +@defvr {Scheme Variable} rebar3-build-system
> +This variable is exported by @code{(guix build-system rebar3)}. It
> +implements a build procedure around @code{rebar3}.

Please provide a bit more context, like: “[…] around
@uref{http://example.org,rebar3}, a build system for programs written in
the Erlang language.”

Toggle quote (3 lines)
> +source. If this file exists, it will be unpacked, too. This eases
> +handling of package hosted by @i{hex.pm}.

Rather: “hosted at @uref{https://hex.pm/},the Erlang package
repository.”

Toggle quote (11 lines)
> + (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")))

“ebin” and “priv” are non-standard directory names. It would be ideal
to avoid them, unless this is a hard requirement for Erlang/rebar3?

Otherwise LGTM!

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 29 Apr 2022 15:13
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 54796@debbugs.gnu.org)
8735hw823j.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (11 lines)
> hex.pm is a package repository for Erlang and Elixir.
>
> * guix/scripts/import.scm (importers): Add "hexpm".
> * guix/scripts/import/hexpm.scm, guix/import/hexpm.scm,
> guix/hexpm-download.scm: New files.
> * guix/import/utils.scm (source-spec->object): Add "hexpm-fetch" to list of
> fetch methods.
> * guix/upstream.scm (package-update/hexpm-fetch): New function.
> (%method-updates) Add it.
> * Makefile.am: Add them.

Please mention tests/hexpm.scm.


[...]

Toggle quote (5 lines)
> +(define-module (guix hexpm-download)
> + #:use-module (srfi srfi-26)
> + #:export (hexpm-package-url
> + hexpm-uri))

How about moving these two procedures to (guix build-system rebar3)?
This is what is done in similar cases, for example with ‘pypi-uri’.

Toggle quote (8 lines)
> +++ b/guix/scripts/import/hexpm.scm
> @@ -0,0 +1,109 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2014 David Thompson <davet@gnu.org>
> +;;; Copyright © 2016 David Craven <david@craven.ch>
> +;;; Copyright © 2019 Martin Becze <mjbecze@riseup.net>
> +;;; Copyright © 2020, 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>

I think it’s fine to keep just your name here; it’s a short file and one
could argue that the bits found in all these files aren’t inventive. :-)

Toggle quote (3 lines)
> + #:use-module (srfi srfi-11)
> + #:use-module (srfi srfi-71)

I think you can drop these two imports.

Toggle quote (7 lines)
> +++ b/guix/upstream.scm
> @@ -464,6 +464,7 @@ SOURCE, an <upstream-source>."
> #:key-download key-download)))
> (values version tarball source))))))
>
> +

Oops. :-)

Toggle quote (9 lines)
> +++ b/tests/hexpm.scm
> @@ -0,0 +1,257 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2015 David Thompson <davet@gnu.org>
> +;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
> +;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
> +;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
> +;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>

Same comment here.

Toggle quote (5 lines)
> +(test-assert "hexpm->guix-package"
> + ;; Replace network resources with sample data.
> + (mock ((guix http-client) http-fetch
> + (lambda (url . rest)

I have a preference for spawning an HTTP server, if that’s possible, as
is done in tests/cpan.scm for instance.

But it’s already been a long ride, so we can keep that for later.

Otherwise LGTM.

Great to see this new importer!

Ludo’.
L
L
Ludovic Courtès wrote on 29 Apr 2022 15:16
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 54796@debbugs.gnu.org)
87y1zo6ndy.fsf_-_@gnu.org
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (2 lines)
> * gnu/packages/erlang.scm (rebar3): New variable.

[...]

Toggle quote (14 lines)
> + (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))))

Not a blocker, but I’d rather see this eventually changed to use a gexp,
like so:

#:arguments #~(modify-phases …
(add-before …
(lambda …
(for-each (lambda (source) …)
'(#$@(map package-source
(list erlang-bbmustache …)))))))

Ludo’.
L
L
Ludovic Courtès wrote on 29 Apr 2022 15:18
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)
87sfpw6nac.fsf_-_@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (4 lines)
> Thanks to Maxime Devos for the review of V3. Do ease review for other
> reviewers, here is a complete set of updated patches, incorporating Maxime's
> comments.

Unless Maxime has further comments, this patch series looks ready to me,
modulo the cosmetic changes I suggested (some of which can be made
afterwards).

Hartmut, can we remove guix/extracting-download.scm now?

Thanks folks for all the work!

Ludo’.
M
M
Maxime Devos wrote on 29 Apr 2022 16:33
(address . 54796@debbugs.gnu.org)
5dfc8bc092e05496db58cd7290a31df665faa594.camel@telenet.be
Ludovic Courtès schreef op vr 29-04-2022 om 15:18 [+0200]:
Toggle quote (12 lines)
> Hi,
>
> Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
>
> > Thanks to Maxime Devos for the review of V3. Do ease review for other
> > reviewers, here is a complete set of updated patches, incorporating Maxime's
> > comments.
>
> Unless Maxime has further comments, this patch series looks ready to me,
> modulo the cosmetic changes I suggested (some of which can be made
> afterwards).

No further comments.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYmv3JBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hatAQDcLjTK3TRWc7RIBK9AL66wB8mF
3/PKh09jcGABB8nflgEAp/G4EMaHy0Dbctq3LMPaJcbexDzkzFs+0UdE9T+VVgU=
=gnlX
-----END PGP SIGNATURE-----


H
H
Hartmut Goebel wrote on 5 May 2022 14:40
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54796@debbugs.gnu.org)
85f5b644-cabe-36f4-3d67-94948043091a@crazy-compilers.com
Am 29.04.22 um 15:13 schrieb Ludovic Courtès:
Toggle quote (7 lines)
>> +(define-module (guix hexpm-download)
>> + #:use-module (srfi srfi-26)
>> + #:export (hexpm-package-url
>> + hexpm-uri))
> How about moving these two procedures to (guix build-system rebar3)?
> This is what is done in similar cases, for example with ‘pypi-uri’.
>
These definitions are combined in this module, since the WIP
„mix-build-system“ (for Elixir) will also use it.

Do you want me to move this into the respective build-system modules and
thus duplicate the data?

--

Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 5 May 2022 14:46
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54796@debbugs.gnu.org)
20323546-87c1-ef2e-4b20-c6dc12f1190c@crazy-compilers.com
Am 29.04.22 um 15:06 schrieb Ludovic Courtès:
Toggle quote (3 lines)
> “ebin” and “priv” are non-standard directory names. It would be ideal
> to avoid them, unless this is a hard requirement for Erlang/rebar3?

AFAIU they are. I'm lacking knowledge about Erlang/OTP internals, and
this is what I experienced.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 5 May 2022 14:56
Re: [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
3d4996a0-5e90-31c0-ea5c-854b3356327d@crazy-compilers.com
Am 11.04.22 um 14:04 schrieb Maxime Devos:
Toggle quote (4 lines)
> If rebar2, rebar3 and rebar4 would require completely different phases
> and use different file formats or such, IMO a separate build system
> (and hence, a 2, 3 or 4 suffix) may be useful.

It took some time to come to a conclusion for me on this:

I'm going to rename it into „rebar-build-system“ (without the number).
If need arises for some rebar4-build-system, we can still think about
adding „rebar3-build-system” as an alias.

Rational:

I assume, some rebar2 and rebar4 build-systems would have the same
phases. „Just” commands might be different. Eg. rebar2 did just
„compile“ while rebar3 can have „as prod compile“ — which could be
handled with different means.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
L
L
Ludovic Courtès wrote on 5 May 2022 22:48
Re: bug#54796: [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 54796@debbugs.gnu.org)
8735hn7lkm.fsf@gnu.org
Hello,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (11 lines)
> Am 29.04.22 um 15:13 schrieb Ludovic Courtès:
>>> +(define-module (guix hexpm-download)
>>> + #:use-module (srfi srfi-26)
>>> + #:export (hexpm-package-url
>>> + hexpm-uri))
>> How about moving these two procedures to (guix build-system rebar3)?
>> This is what is done in similar cases, for example with ‘pypi-uri’.
>>
> These definitions are combined in this module, since the WIP
> „mix-build-system“ (for Elixir) will also use it.

OK.

Toggle quote (3 lines)
> Do you want me to move this into the respective build-system modules
> and thus duplicate the data?

We don’t want to duplicate it, but it might still make sense to have
them in (guix build-system rebar3) and have it imported by (guix
build-system mix) if needed.

At least I have a slight preference for this over having a short
top-level module ‘just’ for these two procedures.

Thanks,
Ludo’.
H
H
Hartmut Goebel wrote on 5 May 2022 23:06
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54796@debbugs.gnu.org)
53972c3f-6232-9737-63e0-f6d2653bfb01@crazy-compilers.com
Am 05.05.22 um 22:48 schrieb Ludovic Courtès:
Toggle quote (4 lines)
> We don’t want to duplicate it, but it might still make sense to have
> them in (guix build-system rebar3) and have it imported by (guix
> build-system mix) if needed.

Fine for me. I'll change the patches accordingly.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 6 May 2022 16:58
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54796@debbugs.gnu.org)
f6f430ed-7bc0-0e98-036a-9c1f296b9d51@crazy-compilers.com
Am 29.04.22 um 15:16 schrieb Ludovic Courtès:
Toggle quote (3 lines)
> Not a blocker, but I’d rather see this eventually changed to use a gexp,
> like so:

Writing some decent code for with is beyond my scheme knowledge. I leave
this as an excersice for guile experts.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
L
L
Ludovic Courtès wrote on 9 May 2022 10:25
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)(address . 54796@debbugs.gnu.org)
87ee13t8nf.fsf_-_@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (7 lines)
> Am 29.04.22 um 15:16 schrieb Ludovic Courtès:
>> Not a blocker, but I’d rather see this eventually changed to use a gexp,
>> like so:
>
> Writing some decent code for with is beyond my scheme knowledge. I
> leave this as an excersice for guile experts.

To be fair, there’s not much expertise to be had beyond mimicking the
example I gave you in the parent message; it’s close to working code!

Thanks,
Ludo’.
H
H
Hartmut Goebel wrote on 9 May 2022 12:15
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54796@debbugs.gnu.org)
0d5b991a-e0dc-f2d4-5ab9-5f9d30a6807d@crazy-compilers.com
Am 09.05.22 um 10:25 schrieb Ludovic Courtès:
Toggle quote (3 lines)
> To be fair, there’s not much expertise to be had beyond mimicking the
> example I gave you in the parent message; it’s close to working code!

This is what I thought. But beside the package, there is also required
the original package's name (no prefix, underscores instead of dashes).
And the code I was able to write was ugly.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
L
L
Ludovic Courtès wrote on 14 Jun 2022 23:29
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)
877d5jvsqx.fsf_-_@gnu.org
Hi Hartmut,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (15 lines)
> Ludovic Courtès schreef op vr 29-04-2022 om 15:18 [+0200]:
>> Hi,
>>
>> Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
>>
>> > Thanks to Maxime Devos for the review of V3. Do ease review for other
>> > reviewers, here is a complete set of updated patches, incorporating Maxime's
>> > comments.
>>
>> Unless Maxime has further comments, this patch series looks ready to me,
>> modulo the cosmetic changes I suggested (some of which can be made
>> afterwards).
>
> No further comments.

This patch series was reviewed and approved a while back, please feel
free to push it!

There were a couple of suggestions (non-blockers) that you could
implement in subsequent patches.

Thanks,
Ludo’.
H
H
Hartmut Goebel wrote on 15 Jun 2022 11:20
Re: [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
(address . 54796-close@debbugs.gnu.org)
427ac7c5-a3a2-b892-315f-4a66f31d4da0@crazy-compilers.com
Many thanks for the review. Finally I finished this patch series and
pushed as 9cccf6490d98bd40ea1eb9e84ecf4a2b32614107

Notable changes compared to last review comments:

* removed guix extracting-download - which was an left-over

* build-system is now named rebar (without '3')

* fixed some minor lint-errors

I also validated that all packages are up to date.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
L
L
Ludovic Courtès wrote on 17 Jun 2022 17:25
(name . Hartmut Goebel)(address . h.goebel@crazy-compilers.com)
87ilozfh2q.fsf@gnu.org
Hi,

Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:

Toggle quote (3 lines)
> Many thanks for the review. Finally I finished this patch series and
> pushed as 9cccf6490d98bd40ea1eb9e84ecf4a2b32614107

Yay, well done, thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 54796@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 54796
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch