Subject: [bug#48697] [PATCH v3] import: Add CHICKEN egg importer.

From: Ludovic Courtès <[email-masked]>
Date: Tue, 01 Jun 2021 23:10:54 +0200

Hi!

Xinglu Chen <[email-masked]> skribis:

> * guix/import/egg.scm: New file.
> * guix/scripts/import/egg.scm: New file.
> * tests/egg.scm: New file.
> * Makefile.am (MODULES, SCM_TESTS): Register them.
> * po/guix/POTFILES.in: Likewise.
> * guix/scripts/import.scm (importers): Add egg importer.
> * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it.
> ---
> Changes since v2:
> * Remove message telling the user that the egg doesn’t exist, ‘guix
>   import’ will already throw an error if this happens.
>
> * Fixed the failing test, I just had to change (license (list 'a 'b)) to
>   (license '(a b)), duh.

This LGTM, except this last bit, as shown here:

> +(define-package-matcher match-chicken-foo
> +  ('package
> +    ('name "chicken-foo")
> +    ('version "1.0.0")
> +    ('source (? file-like? source))
> +    ('build-system 'chicken-build-system)
> +    ('arguments ('quasiquote ('#:egg-name "foo")))
> +    ('native-inputs
> +     ('quasiquote
> +      (("chicken-test" ('unquote chicken-test))
> +       ("chicken-srfi-1" ('unquote chicken-srfi-1))
> +       ("chicken-begin-syntax" ('unquote chicken-begin-syntax)))))
> +    ('inputs
> +     ('quasiquote
> +      (("libgit2" ('unquote libgit2)))))
> +    ('propagated-inputs
> +     ('quasiquote
> +      (("chicken-datatype" ('unquote chicken-datatype)))))
> +    ('home-page "https://wiki.call-cc.org/egg/foo")
> +    ('synopsis "Example egg")
> +    ('description #f)
> +    ('license '(license:gpl3 license:expat))))

The generated ‘license’ team is incorrect.  For multiple licenses, the
generated code should look like:

  (package
    ;; …
    (license (list license:gpl3 license:expat)))

For a single license:

  (package
    ;; …
    (license license:gpl3+))

Compare with:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix import egg sourcehut | tail -1

Starting download of /tmp/guix-file.N300R0
>From https://code.call-cc.org/egg-tarballs/5/sourcehut/sourcehut-0.3.3.tar.gz...
 ….3.3.tar.gz  20KiB                  678KiB/s 00:00 [##################] 100.0%
  (license (license:bsd?)))
--8<---------------cut here---------------end--------------->8---

That’s the last remaining issue in my view.  Could you send a v3?

BTW, if you want, you can also send a snippet for ‘etc/news.scm’ to
announce ‘guix import egg’ to fellow users!  You can take inspiration
from the ‘guix import go’ news entry; I’ll fix up the commit ID when
committing.

Thanks!

Ludo’.