diff options
author | Nicolas Graves via Guix-patches via <guix-patches@gnu.org> | 2025-03-24 08:29:16 +0100 |
---|---|---|
committer | Andreas Enge <andreas@enge.fr> | 2025-04-13 14:19:43 +0200 |
commit | d3086f85e081c02b956cc6f01d0e3e7f28f3d61f (patch) | |
tree | 1572350ef9558f293746381d4891de102a1a8d1d /guix/import/npm-binary.scm | |
parent | 8aca24f41e6e5e0af9b38c27685515ea8c9ed1e7 (diff) |
import: npm-binary: Handle vector of licenses.
* guix/import/npm-binary.scm (<package-revision>)[license]: Handle the
case where a vector of licenses is used.
* tests/npm-binary.scm (foo-json): Redefine as a procedure with
license keyword.
(test-source-hash): Redefine with direct reference to test-source.
(foo-sexp): Redefine as a procedure with license keyword.
(npm-binary->guix-package test): Use foo-json and foo-sexp.
(npm-binary->guix-package with multiple licenses): Add test.
Change-Id: I9d6adb2ae2820678260fed1a67e91e22feb448b8
Signed-off-by: Jelle Licht <jlicht@fsfe.org>
Diffstat (limited to 'guix/import/npm-binary.scm')
-rw-r--r-- | guix/import/npm-binary.scm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/guix/import/npm-binary.scm b/guix/import/npm-binary.scm index 60d7c07a8e..01079c2814 100644 --- a/guix/import/npm-binary.scm +++ b/guix/import/npm-binary.scm @@ -105,7 +105,17 @@ (match (assoc "type" alist) ((_ . (? string? type)) (spdx-string->license type)) - (_ #f))))) + (_ #f))) + ((? vector? vector) + (match (filter-map + (match-lambda + ((? string? str) (spdx-string->license str)) + (_ #f)) + (vector->list vector)) + ((license rest ...) + (cons* license rest)) + ((license) + license))))) (description package-revision-description ;string "description" empty-or-string) (dist package-revision-dist "dist" json->dist)) ;dist @@ -250,7 +260,9 @@ (home-page ,home-page) (synopsis ,synopsis) (description ,description) - (license ,license)) + (license ,(if (list? license) + `(list ,@license) + license))) (map (match-lambda (($ <package-revision> name version) (list name (semver->string version)))) resolved-deps)))) |