all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
@ 2022-04-08 17:01 Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
                   ` (22 more replies)
  0 siblings, 23 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:01 UTC (permalink / raw)
  To: 54796

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





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:52   ` Maxime Devos
                     ` (6 more replies)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 02/22] gnu: Add erlang-cf Hartmut Goebel
                   ` (21 subsequent siblings)
  22 siblings, 7 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

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

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))
+\f
+;;;
+;;; 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))
+
+\f
+;;;
+;;; 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 #\_) "-")))
+
+\f
+;;;
+;;; 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.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 scripts import hexpm)
+  #:use-module (guix ui)
+  #:use-module (guix utils)
+  #:use-module (guix scripts)
+  #:use-module (guix import hexpm)
+  #:use-module (guix scripts import)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-37)
+  #:use-module (srfi srfi-71)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:export (guix-import-hexpm))
+
+\f
+;;;
+;;; Command-line options.
+;;;
+
+(define %default-options
+  '())
+
+(define (show-help)
+  (display (G_ "Usage: guix import hexpm PACKAGE-NAME
+Import and convert the hex.pm package for PACKAGE-NAME.\n"))
+  (display (G_ "
+  -h, --help             display this help and exit"))
+  (display (G_ "
+  -V, --version          display version information and exit"))
+  (newline)
+  (display (G_ "
+  -r, --recursive        import packages recursively"))
+  (newline)
+  (show-bug-report-information))
+
+(define %options
+  ;; Specification of the command-line options.
+  (cons* (option '(#\h "help") #f #f
+                 (lambda args
+                   (show-help)
+                   (exit 0)))
+         (option '(#\V "version") #f #f
+                 (lambda args
+                   (show-version-and-exit "guix import hexpm")))
+         (option '(#\r "recursive") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'recursive #t result)))
+         %standard-import-options))
+
+\f
+;;;
+;;; Entry point.
+;;;
+
+(define (guix-import-hexpm . args)
+  (define (parse-options)
+    ;; Return the alist of option values.
+    (parse-command-line args %options (list %default-options)
+                        #:build-options? #f))
+
+  (let* ((opts (parse-options))
+         (args (filter-map (match-lambda
+                            (('argument . value)
+                             value)
+                            (_ #f))
+                           (reverse opts))))
+    (match args
+      ((spec)
+       (with-error-handling
+         (let ((name version (package-name->name+version spec)))
+           (if (assoc-ref opts 'recursive)
+               ;; Recursive import
+               (map (match-lambda
+                     ((and ('package ('name name) . rest) pkg)
+                      `(define-public ,(string->symbol name)
+                         ,pkg))
+                     (_ #f))
+                    (hexpm-recursive-import name version))
+               ;; Single import
+               (let ((sexp (hexpm->guix-package name #:version version)))
+                 (unless sexp
+                   (leave (G_ "failed to download meta-data for package '~a'~%")
+                          spec))
+                 sexp)))))
+      (()
+       (leave (G_ "too few arguments~%")))
+      ((many ...)
+       (leave (G_ "too many arguments~%"))))))
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index 49a8edfef3..ed873fe5d9 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -134,6 +134,7 @@ guix/scripts/import/gem.scm
 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/opam.scm
 guix/scripts/import/pypi.scm
diff --git a/tests/hexpm.scm b/tests/hexpm.scm
new file mode 100644
index 0000000000..84d126c821
--- /dev/null
+++ 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>
+;;;
+;;; 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 (test-hexpm)
+  #:use-module (guix import hexpm)
+  #:use-module (guix base32)
+  #:use-module (gcrypt hash)
+  #:use-module (guix tests)
+  #:use-module (srfi srfi-64)
+  #:use-module (ice-9 binary-ports)
+  #:use-module (ice-9 match))
+
+(define test-bla-package
+  "{\"name\": \"bla\",
+    \"html_url\": \"https://hex.pm/packages/bla\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"A cool package\",
+        \"licenses\": [\"MIT\", \"Apache-2.0\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/bla/releases/1.5.0\",
+         \"version\": \"1.5.0\"},
+        {\"url\": \"https://hex.pm/api/packages/bla/releases/1.4.7\",
+         \"version\": \"1.4.7\"}
+    ]
+}")
+
+(define test-bla-release
+  "{
+   \"version\": \"1.5.0\",
+   \"url\": \"https://hex.pm/api/packages/bla/releases/1.5.0\",
+   \"requirements\": {
+     \"blubb\":{\"app\": \"blubb\",
+        \"optional\": false,
+        \"requirement\": \"~>0.3\"
+         },
+     \"fasel\":{\"app\": \"fasel\",
+        \"optional\": false,
+        \"requirement\": \"~>1.0\"
+         }
+   },
+   \"meta\":{ \"build_tools\":[\"mix\", \"make\", \"rebar3\"] }
+ }")
+
+(define test-blubb-package
+  "{\"name\": \"blubb\",
+    \"latest_stable_version\": \"0.3.1\",
+    \"latest_version\": \"0.3.1\",
+    \"html_url\": \"https://hex.pm/packages/blubb\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"Another cool package\",
+        \"licenses\": [\"MIT\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.1\",
+         \"version\": \"0.3.1\"},
+        {\"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.0\",
+         \"version\": \"0.3.0\"}
+    ]
+}")
+
+(define test-blubb-release
+  "{
+   \"version\": \"0.3.1\",
+   \"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.1\",
+   \"requirements\": {
+     \"fasel\":{\"app\": \"fasel\",
+        \"optional\": false,
+        \"requirement\": \"~>1.0\"
+         }
+   },
+   \"meta\": { \"build_tools\":[\"mix\"] }
+ }")
+
+(define test-fasel-package
+  "{\"name\": \"fasel\",
+    \"latest_stable_version\": \"1.2.1\",
+    \"latest_version\": \"1.2.1\",
+    \"html_url\": \"https://hex.pm/packages/fasel\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"Yet another cool package\",
+        \"licenses\": [\"GPL\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/fasel/releases/1.2.1\",
+         \"version\": \"1.2.1\"}
+    ]
+}")
+
+(define test-fasel-release
+  "{
+   \"version\": \"1.2.1\",
+   \"url\": \"https://hex.pm/api/packages/fasel/releases/1.2.1\",
+   \"requirements\" :{},
+   \"meta\":{ \"build_tools\":[\"make\"] }
+ }")
+
+(test-begin "hexpm")
+
+(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)))))
+  (mock ((guix build download) url-fetch
+         (lambda* (url file-name
+                       #:key
+                       (mirrors '()) verify-certificate?)
+           (with-output-to-file file-name
+             (lambda ()
+               (display
+                (match url
+                  ("https://repo.hex.pm/tarballs/bla-1.5.0.tar"
+                   "source")
+                  (_ (error "url-fetch got unexpected URL: " url))))))))
+    (match (hexpm->guix-package "bla")
+      (('package
+         ('name "erlang-bla")
+         ('version "1.5.0")
+         ('source
+          ('origin
+            ('method 'url-fetch)
+            ('uri ('hexpm-uri "bla" 'version))
+            ('sha256
+             ('base32
+              "0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1"))))
+         ('build-system 'rebar3-build-system)
+         ('inputs ('list 'erlang-blubb 'erlang-fasel))
+         ('synopsis "A cool package")
+         ('description "This package provides a cool package")
+         ('home-page "https://hex.pm/packages/bla")
+         ('license ('list 'license:expat 'license:asl2.0)))
+       #t)
+      (x
+       (pk 'fail x #f))))))
+
+(test-assert "hexpm-recursive-import"
+  ;; 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)))
+             ("https://hex.pm/api/packages/blubb"
+              (values (open-input-string test-blubb-package)
+                      (string-length test-blubb-package)))
+             ("https://hex.pm/api/packages/blubb/releases/0.3.1"
+              (values (open-input-string test-blubb-release)
+                      (string-length test-blubb-release)))
+             ("https://hex.pm/api/packages/fasel"
+              (values (open-input-string test-fasel-package)
+                      (string-length test-fasel-package)))
+             ("https://hex.pm/api/packages/fasel/releases/1.2.1"
+              (values (open-input-string test-fasel-release)
+                      (string-length test-fasel-release)))
+             (_ (error "http-fetch got unexpected URL: " url)))))
+  (mock ((guix build download) url-fetch
+         (lambda* (url file-name
+                       #:key
+                       (mirrors '()) verify-certificate?)
+           (with-output-to-file file-name
+             (lambda ()
+               (display
+                (match url
+                  ("https://repo.hex.pm/tarballs/bla-1.5.0.tar"
+                   "bla-source")
+                  ("https://repo.hex.pm/tarballs/blubb-0.3.1.tar"
+                   "blubb-source")
+                  ("https://repo.hex.pm/tarballs/fasel-1.2.1.tar"
+                   "fasel-source")
+                  (_ (error "url-fetch got unexpected URL: " url))))))))
+        (match (hexpm-recursive-import "bla")
+          ((('package
+              ('name "erlang-blubb")
+              ('version "0.3.1")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "blubb" 'version))
+                 ('sha256
+                  ('base32
+                   "17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2"))))
+              ('build-system 'mix-build-system)
+              ('inputs ('list 'erlang-fasel))
+              ('synopsis "Another cool package")
+              ('description "Another cool package")
+              ('home-page "https://hex.pm/packages/blubb")
+              ('license 'license:expat))
+            ('package
+              ('name "erlang-fasel")
+              ('version "1.2.1")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "fasel" 'version))
+                 ('sha256
+                  ('base32
+                   "1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha"))))
+              ('build-system 'gnu-build-system)
+              ('synopsis "Yet another cool package")
+              ('description "Yet another cool package")
+              ('home-page "https://hex.pm/packages/fasel")
+              ('license "GPL"))
+            ('package
+              ('name "erlang-bla")
+              ('version "1.5.0")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "bla" 'version))
+                 ('sha256
+                  ('base32
+                   "0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8"))))
+              ('build-system 'rebar3-build-system)
+              ('inputs ('list 'erlang-blubb 'erlang-fasel))
+              ('synopsis "A cool package")
+              ('description "This package provides a cool package")
+              ('home-page "https://hex.pm/packages/bla")
+              ('license ('list 'license:expat 'license:asl2.0))))
+           #t)
+          (x
+           (pk 'fail x #f))))))
+
+(test-end "hexpm")
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 02/22] gnu: Add erlang-cf.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi Hartmut Goebel
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-cf): New variable.
---
 gnu/packages/erlang.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 02/22] gnu: Add erlang-cf Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:39   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons Hartmut Goebel
                   ` (19 subsequent siblings)
  22 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-certifi): New variable.
---
 gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (2 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 10:58   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 05/22] gnu: Add erlang-cth-readable Hartmut Goebel
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-erlware-commons): New variable.
---
 gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 05/22] gnu: Add erlang-cth-readable.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (3 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 06/22] gnu: Add erlang-bbmustache Hartmut Goebel
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-cth-readable): New variable.
---
 gnu/packages/erlang.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 06/22] gnu: Add erlang-bbmustache.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (4 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 05/22] gnu: Add erlang-cth-readable Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 07/22] gnu: Add erlang-getopt Hartmut Goebel
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-bbmustache): New variable.
---
 gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 07/22] gnu: Add erlang-getopt.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (5 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 06/22] gnu: Add erlang-bbmustache Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 08/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-getopt): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 08/22] gnu: Add erlang-eunit-formatters.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (6 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 07/22] gnu: Add erlang-getopt Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 09/22] gnu: Add erlang-providers Hartmut Goebel
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-eunit-formatters): New variable.
---
 gnu/packages/erlang.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 09/22] gnu: Add erlang-providers.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (7 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 08/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans Hartmut Goebel
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-providers): New variable.
---
 gnu/packages/erlang.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (8 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 09/22] gnu: Add erlang-providers Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:41   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 11/22] gnu: Add erlang-hex-core Hartmut Goebel
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-parse-trans): New variable.
---
 gnu/packages/erlang.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 11/22] gnu: Add erlang-hex-core.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (9 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 12/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-hex-core): New variable.
---
 gnu/packages/erlang.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 12/22] gnu: Add erlang-ssl-verify-fun.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (10 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 11/22] gnu: Add erlang-hex-core Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx Hartmut Goebel
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-ssl-verify-fun): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (11 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 12/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:43   ` Maxime Devos
  2022-04-09 11:45   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 14/22] gnu: Add erlang-edown Hartmut Goebel
                   ` (9 subsequent siblings)
  22 siblings, 2 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-relx): New variable.
---
 gnu/packages/erlang.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 14/22] gnu: Add erlang-edown.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (12 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 15/22] gnu: Add erlang-jsone Hartmut Goebel
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-edown): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 15/22] gnu: Add erlang-jsone.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (13 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 14/22] gnu: Add erlang-edown Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 16/22] gnu: Add erlang-proper Hartmut Goebel
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-jsone): New variable.
---
 gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 16/22] gnu: Add erlang-proper.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (14 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 15/22] gnu: Add erlang-jsone Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool Hartmut Goebel
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-proper): New variable.
---
 gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (15 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 16/22] gnu: Add erlang-proper Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:48   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 18/22] gnu: Add rebar3 Hartmut Goebel
                   ` (5 subsequent siblings)
  22 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-covertool): New variable.
---
 gnu/packages/erlang.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 18/22] gnu: Add rebar3.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (16 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps Hartmut Goebel
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3): New variable.
---
 gnu/packages/erlang.scm | 76 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (17 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 18/22] gnu: Add rebar3 Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 11:49   ` Maxime Devos
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 20/22] gnu: Add rebar3-git-vsn Hartmut Goebel
                   ` (3 subsequent siblings)
  22 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-raw-deps): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 20/22] gnu: Add rebar3-git-vsn.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (18 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 21/22] gnu: Add rebar3-proper Hartmut Goebel
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-git-vsn): New variable.
---
 gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 21/22] gnu: Add rebar3-proper.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (19 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 20/22] gnu: Add rebar3-git-vsn Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  22 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-proper): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (20 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 21/22] gnu: Add rebar3-proper Hartmut Goebel
@ 2022-04-08 17:03 ` Hartmut Goebel
  2022-04-09 13:16   ` Maxime Devos
  2022-04-09 13:19   ` Maxime Devos
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  22 siblings, 2 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-08 17:03 UTC (permalink / raw)
  To: 54796

* 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

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons Hartmut Goebel
@ 2022-04-09 10:58   ` Maxime Devos
  2022-04-09 15:33     ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 10:58 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (native-inputs
> +     (list git))  ;; Required for tests

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

Greetings,
MAxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi Hartmut Goebel
@ 2022-04-09 11:39   ` Maxime Devos
  2022-04-10 10:27     ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:39 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (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:

  * https://issues.guix.gnu.org/54434#8
    (tzdata instead of nss-certs, but same principle)
  * https://lists.gnu.org/archive/html/guix-devel/2017-01/msg00516.html
    (about rebuilds)
  * https://lists.gnu.org/archive/html/guix-devel/2014-02/msg00277.html
    (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans Hartmut Goebel
@ 2022-04-09 11:41   ` Maxime Devos
  2022-04-09 15:19     ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:41 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx Hartmut Goebel
@ 2022-04-09 11:43   ` Maxime Devos
  2022-04-09 15:32     ` Hartmut Goebel
  2022-04-09 11:45   ` Maxime Devos
  1 sibling, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:43 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

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"?

Greetings,
MAxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx Hartmut Goebel
  2022-04-09 11:43   ` Maxime Devos
@ 2022-04-09 11:45   ` Maxime Devos
  2022-04-09 15:18     ` Hartmut Goebel
  1 sibling, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:45 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool Hartmut Goebel
@ 2022-04-09 11:48   ` Maxime Devos
  2022-04-09 15:40     ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:48 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (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)))

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps Hartmut Goebel
@ 2022-04-09 11:49   ` Maxime Devos
  2022-04-09 15:50     ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:49 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +    (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
@ 2022-04-09 11:52   ` Maxime Devos
  2022-04-09 16:31     ` Hartmut Goebel
  2022-04-09 11:53   ` Maxime Devos
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:52 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +  (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
  2022-04-09 11:52   ` Maxime Devos
@ 2022-04-09 11:53   ` Maxime Devos
  2022-04-09 11:55   ` Maxime Devos
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:53 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +  ;; Specification names the next fiels "dependencies", but in practice it is

typo: fiels -> fields?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
  2022-04-09 11:52   ` Maxime Devos
  2022-04-09 11:53   ` Maxime Devos
@ 2022-04-09 11:55   ` Maxime Devos
  2022-04-09 16:50     ` Hartmut Goebel
  2022-04-09 11:56   ` Maxime Devos
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:55 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +(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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
                     ` (2 preceding siblings ...)
  2022-04-09 11:55   ` Maxime Devos
@ 2022-04-09 11:56   ` Maxime Devos
  2022-04-09 11:58   ` Maxime Devos
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:56 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +  ;; 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?

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
                     ` (3 preceding siblings ...)
  2022-04-09 11:56   ` Maxime Devos
@ 2022-04-09 11:58   ` Maxime Devos
  2022-04-09 16:01     ` Hartmut Goebel
  2022-04-09 11:59   ` Maxime Devos
  2022-04-09 12:07   ` Maxime Devos
  6 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:58 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +         (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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
                     ` (4 preceding siblings ...)
  2022-04-09 11:58   ` Maxime Devos
@ 2022-04-09 11:59   ` Maxime Devos
  2022-04-10 11:22     ` Hartmut Goebel
  2022-04-09 12:07   ` Maxime Devos
  6 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 11:59 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +   (lambda (temp port)
> +     (and (url-fetch tarball-url temp)
> +          (values
> +       `(package

WOuld 'alist->package' be useful here?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
                     ` (5 preceding siblings ...)
  2022-04-09 11:59   ` Maxime Devos
@ 2022-04-09 12:07   ` Maxime Devos
  2022-04-10 10:36     ` Hartmut Goebel
  6 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 12:07 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +(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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
@ 2022-04-09 13:16   ` Maxime Devos
  2022-04-09 16:04     ` Hartmut Goebel
  2022-04-09 13:19   ` Maxime Devos
  1 sibling, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 13:16 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:

> * 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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
  2022-04-09 13:16   ` Maxime Devos
@ 2022-04-09 13:19   ` Maxime Devos
  2022-04-09 16:28     ` Hartmut Goebel
  1 sibling, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 13:19 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

Hartmut Goebel schreef op vr 08-04-2022 om 19:03 [+0200]:
> +         (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).

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

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
  2022-04-09 11:45   ` Maxime Devos
@ 2022-04-09 15:18     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:18 UTC (permalink / raw)
  To: Maxime Devos, 54796

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Am 09.04.22 um 13:45 schrieb Maxime Devos:
> 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.

> 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 #2: Type: text/html, Size: 1760 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans.
  2022-04-09 11:41   ` Maxime Devos
@ 2022-04-09 15:19     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:19 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:41 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx.
  2022-04-09 11:43   ` Maxime Devos
@ 2022-04-09 15:32     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:32 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:43 schrieb Maxime Devos:
> 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, 
https://en.wikipedia.org/wiki/Open_Telecom_Platform). AFAIU it's much 
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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons.
  2022-04-09 10:58   ` Maxime Devos
@ 2022-04-09 15:33     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:33 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 12:58 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool.
  2022-04-09 11:48   ` Maxime Devos
@ 2022-04-09 15:40     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:40 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:48 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps.
  2022-04-09 11:49   ` Maxime Devos
@ 2022-04-09 15:50     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 15:50 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:49 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-09 11:58   ` Maxime Devos
@ 2022-04-09 16:01     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 16:01 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:58 schrieb Maxime Devos:
> 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/ejabberd and 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 13:16   ` Maxime Devos
@ 2022-04-09 16:04     ` Hartmut Goebel
  2022-04-09 20:56       ` Maxime Devos
  0 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 16:04 UTC (permalink / raw)
  To: Maxime Devos, 54796

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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 13:19   ` Maxime Devos
@ 2022-04-09 16:28     ` Hartmut Goebel
  2022-04-09 17:57       ` Maxime Devos
  0 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 16:28 UTC (permalink / raw)
  To: Maxime Devos, 54796

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, the others 
in build.

Can you elaborate the criteria which to choose? (I also just created 
https://issues.guix.gnu.org/54820 for this)

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-09 11:52   ` Maxime Devos
@ 2022-04-09 16:31     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 16:31 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:52 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-09 11:55   ` Maxime Devos
@ 2022-04-09 16:50     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-09 16:50 UTC (permalink / raw)
  To: Maxime Devos, 54796

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Am 09.04.22 um 13:55 schrieb Maxime Devos:
> 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 #2: Type: text/html, Size: 1220 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 16:28     ` Hartmut Goebel
@ 2022-04-09 17:57       ` Maxime Devos
  2022-04-10 18:47         ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 17:57 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

Hartmut Goebel schreef op za 09-04-2022 om 18:28 [+0200]:
> 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 ...

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 16:04     ` Hartmut Goebel
@ 2022-04-09 20:56       ` Maxime Devos
  2022-04-10 18:49         ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-09 20:56 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

Hartmut Goebel schreef op za 09-04-2022 om 18:04 [+0200]:
> 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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi.
  2022-04-09 11:39   ` Maxime Devos
@ 2022-04-10 10:27     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 10:27 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 13:39 schrieb Maxime Devos:
> 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.

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

[1] https://github.com/certifi/python-certifi
[2] https://github.com/certifi/gocertifi
[3] https://github.com/erlang/rebar3/issues/2696

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |]





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-09 12:07   ` Maxime Devos
@ 2022-04-10 10:36     ` Hartmut Goebel
  2022-04-10 12:26       ` Maxime Devos
  0 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 10:36 UTC (permalink / raw)
  To: Maxime Devos, 54796

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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-09 11:59   ` Maxime Devos
@ 2022-04-10 11:22     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 11:22 UTC (permalink / raw)
  To: Maxime Devos, 54796

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

Am 09.04.22 um 13:59 schrieb Maxime Devos:
> 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 #2: Type: text/html, Size: 1356 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer.
  2022-04-10 10:36     ` Hartmut Goebel
@ 2022-04-10 12:26       ` Maxime Devos
  0 siblings, 0 replies; 98+ messages in thread
From: Maxime Devos @ 2022-04-10 12:26 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

Hartmut Goebel schreef op zo 10-04-2022 om 12:36 [+0200]:
> 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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 17:57       ` Maxime Devos
@ 2022-04-10 18:47         ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:47 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 19:57 schrieb Maxime Devos:
> Always build-inputs

Done.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system'.
  2022-04-09 20:56       ` Maxime Devos
@ 2022-04-10 18:49         ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:49 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 09.04.22 um 22:56 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
@ 2022-04-10 18:56   ` Hartmut Goebel
  2022-04-29 13:13     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 02/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
                     ` (24 subsequent siblings)
  25 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:56 UTC (permalink / raw)
  To: 54796

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

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))
+\f
+;;;
+;;; 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))
+
+\f
+;;;
+;;; 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 #\_) "-")))
+
+\f
+;;;
+;;; 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.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 scripts import hexpm)
+  #:use-module (guix ui)
+  #:use-module (guix utils)
+  #:use-module (guix scripts)
+  #:use-module (guix import hexpm)
+  #:use-module (guix scripts import)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-37)
+  #:use-module (srfi srfi-71)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:export (guix-import-hexpm))
+
+\f
+;;;
+;;; Command-line options.
+;;;
+
+(define %default-options
+  '())
+
+(define (show-help)
+  (display (G_ "Usage: guix import hexpm PACKAGE-NAME
+Import and convert the hex.pm package for PACKAGE-NAME.\n"))
+  (display (G_ "
+  -h, --help             display this help and exit"))
+  (display (G_ "
+  -V, --version          display version information and exit"))
+  (newline)
+  (display (G_ "
+  -r, --recursive        import packages recursively"))
+  (newline)
+  (show-bug-report-information))
+
+(define %options
+  ;; Specification of the command-line options.
+  (cons* (option '(#\h "help") #f #f
+                 (lambda args
+                   (show-help)
+                   (exit 0)))
+         (option '(#\V "version") #f #f
+                 (lambda args
+                   (show-version-and-exit "guix import hexpm")))
+         (option '(#\r "recursive") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'recursive #t result)))
+         %standard-import-options))
+
+\f
+;;;
+;;; Entry point.
+;;;
+
+(define (guix-import-hexpm . args)
+  (define (parse-options)
+    ;; Return the alist of option values.
+    (parse-command-line args %options (list %default-options)
+                        #:build-options? #f))
+
+  (let* ((opts (parse-options))
+         (args (filter-map (match-lambda
+                            (('argument . value)
+                             value)
+                            (_ #f))
+                           (reverse opts))))
+    (match args
+      ((spec)
+       (with-error-handling
+         (let ((name version (package-name->name+version spec)))
+           (if (assoc-ref opts 'recursive)
+               ;; Recursive import
+               (map (match-lambda
+                     ((and ('package ('name name) . rest) pkg)
+                      `(define-public ,(string->symbol name)
+                         ,pkg))
+                     (_ #f))
+                    (hexpm-recursive-import name version))
+               ;; Single import
+               (let ((sexp (hexpm->guix-package name #:version version)))
+                 (unless sexp
+                   (leave (G_ "failed to download meta-data for package '~a'~%")
+                          spec))
+                 sexp)))))
+      (()
+       (leave (G_ "too few arguments~%")))
+      ((many ...)
+       (leave (G_ "too many arguments~%"))))))
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 6666803a92..b0f77fb7d0 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -464,6 +464,7 @@ SOURCE, an <upstream-source>."
                                         #:key-download key-download)))
          (values version tarball source))))))
 
+
 (define* (package-update/git-fetch store package source #:key key-download)
   "Return the version, checkout, and SOURCE, to update PACKAGE to
 SOURCE, an <upstream-source>."
diff --git a/tests/hexpm.scm b/tests/hexpm.scm
new file mode 100644
index 0000000000..84d126c821
--- /dev/null
+++ 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>
+;;;
+;;; 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 (test-hexpm)
+  #:use-module (guix import hexpm)
+  #:use-module (guix base32)
+  #:use-module (gcrypt hash)
+  #:use-module (guix tests)
+  #:use-module (srfi srfi-64)
+  #:use-module (ice-9 binary-ports)
+  #:use-module (ice-9 match))
+
+(define test-bla-package
+  "{\"name\": \"bla\",
+    \"html_url\": \"https://hex.pm/packages/bla\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"A cool package\",
+        \"licenses\": [\"MIT\", \"Apache-2.0\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/bla/releases/1.5.0\",
+         \"version\": \"1.5.0\"},
+        {\"url\": \"https://hex.pm/api/packages/bla/releases/1.4.7\",
+         \"version\": \"1.4.7\"}
+    ]
+}")
+
+(define test-bla-release
+  "{
+   \"version\": \"1.5.0\",
+   \"url\": \"https://hex.pm/api/packages/bla/releases/1.5.0\",
+   \"requirements\": {
+     \"blubb\":{\"app\": \"blubb\",
+        \"optional\": false,
+        \"requirement\": \"~>0.3\"
+         },
+     \"fasel\":{\"app\": \"fasel\",
+        \"optional\": false,
+        \"requirement\": \"~>1.0\"
+         }
+   },
+   \"meta\":{ \"build_tools\":[\"mix\", \"make\", \"rebar3\"] }
+ }")
+
+(define test-blubb-package
+  "{\"name\": \"blubb\",
+    \"latest_stable_version\": \"0.3.1\",
+    \"latest_version\": \"0.3.1\",
+    \"html_url\": \"https://hex.pm/packages/blubb\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"Another cool package\",
+        \"licenses\": [\"MIT\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.1\",
+         \"version\": \"0.3.1\"},
+        {\"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.0\",
+         \"version\": \"0.3.0\"}
+    ]
+}")
+
+(define test-blubb-release
+  "{
+   \"version\": \"0.3.1\",
+   \"url\": \"https://hex.pm/api/packages/blubb/releases/0.3.1\",
+   \"requirements\": {
+     \"fasel\":{\"app\": \"fasel\",
+        \"optional\": false,
+        \"requirement\": \"~>1.0\"
+         }
+   },
+   \"meta\": { \"build_tools\":[\"mix\"] }
+ }")
+
+(define test-fasel-package
+  "{\"name\": \"fasel\",
+    \"latest_stable_version\": \"1.2.1\",
+    \"latest_version\": \"1.2.1\",
+    \"html_url\": \"https://hex.pm/packages/fasel\",
+    \"docs_html_url\": null,
+    \"meta\": {
+        \"description\": \"Yet another cool package\",
+        \"licenses\": [\"GPL\"]
+    },
+    \"releases\": [
+        {\"url\": \"https://hex.pm/api/packages/fasel/releases/1.2.1\",
+         \"version\": \"1.2.1\"}
+    ]
+}")
+
+(define test-fasel-release
+  "{
+   \"version\": \"1.2.1\",
+   \"url\": \"https://hex.pm/api/packages/fasel/releases/1.2.1\",
+   \"requirements\" :{},
+   \"meta\":{ \"build_tools\":[\"make\"] }
+ }")
+
+(test-begin "hexpm")
+
+(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)))))
+  (mock ((guix build download) url-fetch
+         (lambda* (url file-name
+                       #:key
+                       (mirrors '()) verify-certificate?)
+           (with-output-to-file file-name
+             (lambda ()
+               (display
+                (match url
+                  ("https://repo.hex.pm/tarballs/bla-1.5.0.tar"
+                   "source")
+                  (_ (error "url-fetch got unexpected URL: " url))))))))
+    (match (hexpm->guix-package "bla")
+      (('package
+         ('name "erlang-bla")
+         ('version "1.5.0")
+         ('source
+          ('origin
+            ('method 'url-fetch)
+            ('uri ('hexpm-uri "bla" 'version))
+            ('sha256
+             ('base32
+              "0zcl4dgcmqwl1g5xb901pd6dz61r1xgmac9mqlwvh022paa6gks1"))))
+         ('build-system 'rebar3-build-system)
+         ('inputs ('list 'erlang-blubb 'erlang-fasel))
+         ('synopsis "A cool package")
+         ('description "This package provides a cool package")
+         ('home-page "https://hex.pm/packages/bla")
+         ('license ('list 'license:expat 'license:asl2.0)))
+       #t)
+      (x
+       (pk 'fail x #f))))))
+
+(test-assert "hexpm-recursive-import"
+  ;; 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)))
+             ("https://hex.pm/api/packages/blubb"
+              (values (open-input-string test-blubb-package)
+                      (string-length test-blubb-package)))
+             ("https://hex.pm/api/packages/blubb/releases/0.3.1"
+              (values (open-input-string test-blubb-release)
+                      (string-length test-blubb-release)))
+             ("https://hex.pm/api/packages/fasel"
+              (values (open-input-string test-fasel-package)
+                      (string-length test-fasel-package)))
+             ("https://hex.pm/api/packages/fasel/releases/1.2.1"
+              (values (open-input-string test-fasel-release)
+                      (string-length test-fasel-release)))
+             (_ (error "http-fetch got unexpected URL: " url)))))
+  (mock ((guix build download) url-fetch
+         (lambda* (url file-name
+                       #:key
+                       (mirrors '()) verify-certificate?)
+           (with-output-to-file file-name
+             (lambda ()
+               (display
+                (match url
+                  ("https://repo.hex.pm/tarballs/bla-1.5.0.tar"
+                   "bla-source")
+                  ("https://repo.hex.pm/tarballs/blubb-0.3.1.tar"
+                   "blubb-source")
+                  ("https://repo.hex.pm/tarballs/fasel-1.2.1.tar"
+                   "fasel-source")
+                  (_ (error "url-fetch got unexpected URL: " url))))))))
+        (match (hexpm-recursive-import "bla")
+          ((('package
+              ('name "erlang-blubb")
+              ('version "0.3.1")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "blubb" 'version))
+                 ('sha256
+                  ('base32
+                   "17y88b5y8ld7s1c2bcwwwa04pf1cl4402i9zk3inna221ps3ppj2"))))
+              ('build-system 'mix-build-system)
+              ('inputs ('list 'erlang-fasel))
+              ('synopsis "Another cool package")
+              ('description "Another cool package")
+              ('home-page "https://hex.pm/packages/blubb")
+              ('license 'license:expat))
+            ('package
+              ('name "erlang-fasel")
+              ('version "1.2.1")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "fasel" 'version))
+                 ('sha256
+                  ('base32
+                   "1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha"))))
+              ('build-system 'gnu-build-system)
+              ('synopsis "Yet another cool package")
+              ('description "Yet another cool package")
+              ('home-page "https://hex.pm/packages/fasel")
+              ('license "GPL"))
+            ('package
+              ('name "erlang-bla")
+              ('version "1.5.0")
+              ('source
+               ('origin
+                 ('method 'url-fetch)
+                 ('uri ('hexpm-uri "bla" 'version))
+                 ('sha256
+                  ('base32
+                   "0d3gj746c4swbb1m6ycylxb239jsavvdcizag6bfbg2aqccxwij8"))))
+              ('build-system 'rebar3-build-system)
+              ('inputs ('list 'erlang-blubb 'erlang-fasel))
+              ('synopsis "A cool package")
+              ('description "This package provides a cool package")
+              ('home-page "https://hex.pm/packages/bla")
+              ('license ('list 'license:expat 'license:asl2.0))))
+           #t)
+          (x
+           (pk 'fail x #f))))))
+
+(test-end "hexpm")
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 02/22] build-system: Add 'rebar3-build-system'.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  2022-04-10 18:56   ` [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-29 13:06     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 03/22] gnu: Add erlang-cf Hartmut Goebel
                     ` (23 subsequent siblings)
  25 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* 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

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 03/22] gnu: Add erlang-cf.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
  2022-04-10 18:56   ` [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 02/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 04/22] gnu: Add erlang-certifi Hartmut Goebel
                     ` (22 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-cf): New variable.
---
 gnu/packages/erlang.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 04/22] gnu: Add erlang-certifi.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (2 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 03/22] gnu: Add erlang-cf Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 05/22] gnu: Add erlang-erlware-commons Hartmut Goebel
                     ` (21 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-certifi): New variable.
---
 gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 05/22] gnu: Add erlang-erlware-commons.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (3 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 04/22] gnu: Add erlang-certifi Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 06/22] gnu: Add erlang-cth-readable Hartmut Goebel
                     ` (20 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-erlware-commons): New variable.
---
 gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 06/22] gnu: Add erlang-cth-readable.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (4 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 05/22] gnu: Add erlang-erlware-commons Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 07/22] gnu: Add erlang-bbmustache Hartmut Goebel
                     ` (19 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-cth-readable): New variable.
---
 gnu/packages/erlang.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 07/22] gnu: Add erlang-bbmustache.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (5 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 06/22] gnu: Add erlang-cth-readable Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 08/22] gnu: Add erlang-getopt Hartmut Goebel
                     ` (18 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-bbmustache): New variable.
---
 gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 08/22] gnu: Add erlang-getopt.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (6 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 07/22] gnu: Add erlang-bbmustache Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 09/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
                     ` (17 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-getopt): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 09/22] gnu: Add erlang-eunit-formatters.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (7 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 08/22] gnu: Add erlang-getopt Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 10/22] gnu: Add erlang-providers Hartmut Goebel
                     ` (16 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-eunit-formatters): New variable.
---
 gnu/packages/erlang.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 10/22] gnu: Add erlang-providers.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (8 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 09/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 11/22] gnu: Add erlang-parse-trans Hartmut Goebel
                     ` (15 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-providers): New variable.
---
 gnu/packages/erlang.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 11/22] gnu: Add erlang-parse-trans.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (9 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 10/22] gnu: Add erlang-providers Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 12/22] gnu: Add erlang-hex-core Hartmut Goebel
                     ` (14 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-parse-trans): New variable.
---
 gnu/packages/erlang.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 12/22] gnu: Add erlang-hex-core.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (10 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 11/22] gnu: Add erlang-parse-trans Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 13/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
                     ` (13 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-hex-core): New variable.
---
 gnu/packages/erlang.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 13/22] gnu: Add erlang-ssl-verify-fun.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (11 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 12/22] gnu: Add erlang-hex-core Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 14/22] gnu: Add erlang-relx Hartmut Goebel
                     ` (12 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-ssl-verify-fun): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 14/22] gnu: Add erlang-relx.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (12 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 13/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 15/22] gnu: Add erlang-edown Hartmut Goebel
                     ` (11 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-relx): New variable.
---
 gnu/packages/erlang.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 15/22] gnu: Add erlang-edown.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (13 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 14/22] gnu: Add erlang-relx Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 16/22] gnu: Add erlang-jsone Hartmut Goebel
                     ` (10 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-edown): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 16/22] gnu: Add erlang-jsone.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (14 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 15/22] gnu: Add erlang-edown Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 17/22] gnu: Add erlang-proper Hartmut Goebel
                     ` (9 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-jsone): New variable.
---
 gnu/packages/erlang.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 17/22] gnu: Add erlang-proper.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (15 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 16/22] gnu: Add erlang-jsone Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 18/22] gnu: Add erlang-covertool Hartmut Goebel
                     ` (8 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-proper): New variable.
---
 gnu/packages/erlang.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 18/22] gnu: Add erlang-covertool.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (16 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 17/22] gnu: Add erlang-proper Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 19/22] gnu: Add rebar3 Hartmut Goebel
                     ` (7 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (erlang-covertool): New variable.
---
 gnu/packages/erlang.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 19/22] gnu: Add rebar3.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (17 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 18/22] gnu: Add erlang-covertool Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-29 13:16     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 20/22] gnu: Add rebar3-raw-deps Hartmut Goebel
                     ` (6 subsequent siblings)
  25 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3): New variable.
---
 gnu/packages/erlang.scm | 76 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 20/22] gnu: Add rebar3-raw-deps.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (18 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 19/22] gnu: Add rebar3 Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 21/22] gnu: Add rebar3-git-vsn Hartmut Goebel
                     ` (5 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-raw-deps): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                   ` (21 preceding siblings ...)
  2022-04-08 17:03 ` [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
@ 2022-04-10 18:57 ` Hartmut Goebel
  2022-04-10 18:56   ` [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer Hartmut Goebel
                     ` (25 more replies)
  22 siblings, 26 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

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





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 21/22] gnu: Add rebar3-git-vsn.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (19 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 20/22] gnu: Add rebar3-raw-deps Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 22/22] gnu: Add rebar3-proper Hartmut Goebel
                     ` (4 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-git-vsn): New variable.
---
 gnu/packages/erlang.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 22/22] gnu: Add rebar3-proper.
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (20 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 21/22] gnu: Add rebar3-git-vsn Hartmut Goebel
@ 2022-04-10 18:57   ` Hartmut Goebel
  2022-04-11 12:04   ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Maxime Devos
                     ` (3 subsequent siblings)
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-04-10 18:57 UTC (permalink / raw)
  To: 54796

* gnu/packages/erlang.scm (rebar3-proper): New variable.
---
 gnu/packages/erlang.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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





^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (21 preceding siblings ...)
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 22/22] gnu: Add rebar3-proper Hartmut Goebel
@ 2022-04-11 12:04   ` Maxime Devos
  2022-05-05 12:56     ` Hartmut Goebel
  2022-04-29 13:18   ` [bug#54796] [PATCH v3 " Ludovic Courtès
                     ` (2 subsequent siblings)
  25 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-11 12:04 UTC (permalink / raw)
  To: Hartmut Goebel, 54796

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Hartmut Goebel schreef op zo 10-04-2022 om 20:57 [+0200]:
> * 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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 02/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
@ 2022-04-29 13:06     ` Ludovic Courtès
  2022-05-05 12:46       ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-04-29 13:06 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796

Hi,

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

> * 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.

> +@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.”

> +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.”

> +       (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’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:56   ` [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer Hartmut Goebel
@ 2022-04-29 13:13     ` Ludovic Courtès
  2022-05-05 12:40       ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-04-29 13:13 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796

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

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


[...]

> +(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’.

> +++ 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.  :-)

> +  #:use-module (srfi srfi-11)
> +  #:use-module (srfi srfi-71)

I think you can drop these two imports.

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

Oops.  :-)

> +++ 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.

> +(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’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:57   ` [bug#54796] [PATCH v4 19/22] gnu: Add rebar3 Hartmut Goebel
@ 2022-04-29 13:16     ` Ludovic Courtès
  2022-05-06 14:58       ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-04-29 13:16 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796

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

> * gnu/packages/erlang.scm (rebar3): New variable.

[...]

> +    (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’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (22 preceding siblings ...)
  2022-04-11 12:04   ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Maxime Devos
@ 2022-04-29 13:18   ` Ludovic Courtès
  2022-04-29 14:33     ` Maxime Devos
  2022-06-15  9:20   ` bug#54796: [PATCH v4 " Hartmut Goebel
       [not found]   ` <1a53c4c0-3516-e337-2e51-ff45ee44cd8d@crazy-compilers.com>
  25 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-04-29 13:18 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796, Maxime Devos

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).

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

Thanks folks for all the work!

Ludo’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-29 13:18   ` [bug#54796] [PATCH v3 " Ludovic Courtès
@ 2022-04-29 14:33     ` Maxime Devos
  2022-06-14 21:29       ` Ludovic Courtès
  0 siblings, 1 reply; 98+ messages in thread
From: Maxime Devos @ 2022-04-29 14:33 UTC (permalink / raw)
  To: Ludovic Courtès, Hartmut Goebel; +Cc: 54796

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

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.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-29 13:13     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
@ 2022-05-05 12:40       ` Hartmut Goebel
  2022-05-05 20:48         ` Ludovic Courtès
  0 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-05 12:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54796

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.

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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-29 13:06     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
@ 2022-05-05 12:46       ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-05 12:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54796

Am 29.04.22 um 15:06 schrieb Ludovic Courtès:
> “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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-11 12:04   ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Maxime Devos
@ 2022-05-05 12:56     ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-05 12:56 UTC (permalink / raw)
  To: Maxime Devos, 54796

Am 11.04.22 um 14:04 schrieb Maxime Devos:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-05-05 12:40       ` Hartmut Goebel
@ 2022-05-05 20:48         ` Ludovic Courtès
  2022-05-05 21:06           ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-05-05 20:48 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796

Hello,

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

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

> 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’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-05-05 20:48         ` Ludovic Courtès
@ 2022-05-05 21:06           ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-05 21:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54796

Am 05.05.22 um 22:48 schrieb Ludovic Courtès:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-29 13:16     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
@ 2022-05-06 14:58       ` Hartmut Goebel
  2022-05-09  8:25         ` Ludovic Courtès
  0 siblings, 1 reply; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-06 14:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54796

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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-05-06 14:58       ` Hartmut Goebel
@ 2022-05-09  8:25         ` Ludovic Courtès
  2022-05-09 10:15           ` Hartmut Goebel
  0 siblings, 1 reply; 98+ messages in thread
From: Ludovic Courtès @ 2022-05-09  8:25 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796

Hi,

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

> 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’.





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-05-09  8:25         ` Ludovic Courtès
@ 2022-05-09 10:15           ` Hartmut Goebel
  0 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-05-09 10:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54796

Am 09.05.22 um 10:25 schrieb Ludovic Courtès:
> 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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-29 14:33     ` Maxime Devos
@ 2022-06-14 21:29       ` Ludovic Courtès
  0 siblings, 0 replies; 98+ messages in thread
From: Ludovic Courtès @ 2022-06-14 21:29 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796, Maxime Devos

Hi Hartmut,

Maxime Devos <maximedevos@telenet.be> skribis:

> 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’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

* bug#54796: [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
  2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
                     ` (23 preceding siblings ...)
  2022-04-29 13:18   ` [bug#54796] [PATCH v3 " Ludovic Courtès
@ 2022-06-15  9:20   ` Hartmut Goebel
       [not found]   ` <1a53c4c0-3516-e337-2e51-ff45ee44cd8d@crazy-compilers.com>
  25 siblings, 0 replies; 98+ messages in thread
From: Hartmut Goebel @ 2022-06-15  9:20 UTC (permalink / raw)
  To: 54796-close

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 |





^ permalink raw reply	[flat|nested] 98+ messages in thread

* [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang
       [not found]   ` <1a53c4c0-3516-e337-2e51-ff45ee44cd8d@crazy-compilers.com>
@ 2022-06-17 15:25     ` Ludovic Courtès
  0 siblings, 0 replies; 98+ messages in thread
From: Ludovic Courtès @ 2022-06-17 15:25 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 54796-done, Maxime Devos

Hi,

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

> Many thanks for the review. Finally I finished this patch series and
> pushed as 9cccf6490d98bd40ea1eb9e84ecf4a2b32614107

Yay, well done, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 98+ messages in thread

end of thread, other threads:[~2022-06-17 15:26 UTC | newest]

Thread overview: 98+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-08 17:01 [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 01/22] import: Add hex.pm importer Hartmut Goebel
2022-04-09 11:52   ` Maxime Devos
2022-04-09 16:31     ` Hartmut Goebel
2022-04-09 11:53   ` Maxime Devos
2022-04-09 11:55   ` Maxime Devos
2022-04-09 16:50     ` Hartmut Goebel
2022-04-09 11:56   ` Maxime Devos
2022-04-09 11:58   ` Maxime Devos
2022-04-09 16:01     ` Hartmut Goebel
2022-04-09 11:59   ` Maxime Devos
2022-04-10 11:22     ` Hartmut Goebel
2022-04-09 12:07   ` Maxime Devos
2022-04-10 10:36     ` Hartmut Goebel
2022-04-10 12:26       ` Maxime Devos
2022-04-08 17:03 ` [bug#54796] [PATCH v3 02/22] gnu: Add erlang-cf Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 03/22] gnu: Add erlang-certifi Hartmut Goebel
2022-04-09 11:39   ` Maxime Devos
2022-04-10 10:27     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 04/22] gnu: Add erlang-erlware-commons Hartmut Goebel
2022-04-09 10:58   ` Maxime Devos
2022-04-09 15:33     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 05/22] gnu: Add erlang-cth-readable Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 06/22] gnu: Add erlang-bbmustache Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 07/22] gnu: Add erlang-getopt Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 08/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 09/22] gnu: Add erlang-providers Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 10/22] gnu: Add erlang-parse-trans Hartmut Goebel
2022-04-09 11:41   ` Maxime Devos
2022-04-09 15:19     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 11/22] gnu: Add erlang-hex-core Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 12/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 13/22] gnu: Add erlang-relx Hartmut Goebel
2022-04-09 11:43   ` Maxime Devos
2022-04-09 15:32     ` Hartmut Goebel
2022-04-09 11:45   ` Maxime Devos
2022-04-09 15:18     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 14/22] gnu: Add erlang-edown Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 15/22] gnu: Add erlang-jsone Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 16/22] gnu: Add erlang-proper Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 17/22] gnu: Add erlang-covertool Hartmut Goebel
2022-04-09 11:48   ` Maxime Devos
2022-04-09 15:40     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 18/22] gnu: Add rebar3 Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 19/22] gnu: Add rebar3-raw-deps Hartmut Goebel
2022-04-09 11:49   ` Maxime Devos
2022-04-09 15:50     ` Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 20/22] gnu: Add rebar3-git-vsn Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 21/22] gnu: Add rebar3-proper Hartmut Goebel
2022-04-08 17:03 ` [bug#54796] [PATCH v3 22/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
2022-04-09 13:16   ` Maxime Devos
2022-04-09 16:04     ` Hartmut Goebel
2022-04-09 20:56       ` Maxime Devos
2022-04-10 18:49         ` Hartmut Goebel
2022-04-09 13:19   ` Maxime Devos
2022-04-09 16:28     ` Hartmut Goebel
2022-04-09 17:57       ` Maxime Devos
2022-04-10 18:47         ` Hartmut Goebel
2022-04-10 18:57 ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Hartmut Goebel
2022-04-10 18:56   ` [bug#54796] [PATCH v4 01/22] import: Add hex.pm importer Hartmut Goebel
2022-04-29 13:13     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
2022-05-05 12:40       ` Hartmut Goebel
2022-05-05 20:48         ` Ludovic Courtès
2022-05-05 21:06           ` Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 02/22] build-system: Add 'rebar3-build-system' Hartmut Goebel
2022-04-29 13:06     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
2022-05-05 12:46       ` Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 03/22] gnu: Add erlang-cf Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 04/22] gnu: Add erlang-certifi Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 05/22] gnu: Add erlang-erlware-commons Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 06/22] gnu: Add erlang-cth-readable Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 07/22] gnu: Add erlang-bbmustache Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 08/22] gnu: Add erlang-getopt Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 09/22] gnu: Add erlang-eunit-formatters Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 10/22] gnu: Add erlang-providers Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 11/22] gnu: Add erlang-parse-trans Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 12/22] gnu: Add erlang-hex-core Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 13/22] gnu: Add erlang-ssl-verify-fun Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 14/22] gnu: Add erlang-relx Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 15/22] gnu: Add erlang-edown Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 16/22] gnu: Add erlang-jsone Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 17/22] gnu: Add erlang-proper Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 18/22] gnu: Add erlang-covertool Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 19/22] gnu: Add rebar3 Hartmut Goebel
2022-04-29 13:16     ` [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Ludovic Courtès
2022-05-06 14:58       ` Hartmut Goebel
2022-05-09  8:25         ` Ludovic Courtès
2022-05-09 10:15           ` Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 20/22] gnu: Add rebar3-raw-deps Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 21/22] gnu: Add rebar3-git-vsn Hartmut Goebel
2022-04-10 18:57   ` [bug#54796] [PATCH v4 22/22] gnu: Add rebar3-proper Hartmut Goebel
2022-04-11 12:04   ` [bug#54796] [PATCH v4 00/22] Add importer for hex.pm and rebar3 build-system for Erlang Maxime Devos
2022-05-05 12:56     ` Hartmut Goebel
2022-04-29 13:18   ` [bug#54796] [PATCH v3 " Ludovic Courtès
2022-04-29 14:33     ` Maxime Devos
2022-06-14 21:29       ` Ludovic Courtès
2022-06-15  9:20   ` bug#54796: [PATCH v4 " Hartmut Goebel
     [not found]   ` <1a53c4c0-3516-e337-2e51-ff45ee44cd8d@crazy-compilers.com>
2022-06-17 15:25     ` [bug#54796] " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.