Subject: [bug#54796] [PATCH v3 00/22] Add importer for hex.pm and rebar3 build-system for Erlang

From: Ludovic Courtès <[email-masked]>
Date: Fri, 29 Apr 2022 15:13:04 +0200

Hartmut Goebel <[email-masked]> 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 <[email-masked]>
> +;;; Copyright © 2016 David Craven <[email-masked]>
> +;;; Copyright © 2019 Martin Becze <[email-masked]>
> +;;; Copyright © 2020, 2022 Hartmut Goebel <[email-masked]>

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 <[email-masked]>
> +;;; Copyright © 2016 Ricardo Wurmus <[email-masked]>
> +;;; Copyright © 2018 Oleg Pykhalov <[email-masked]>
> +;;; Copyright © 2021 Sarah Morgensen <[email-masked]>
> +;;; Copyright © 2022 Hartmut Goebel <[email-masked]>

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