summaryrefslogtreecommitdiff
path: root/guix/import/npm-binary.scm
diff options
context:
space:
mode:
authorNicolas Graves via Guix-patches via <guix-patches@gnu.org>2025-03-24 08:29:16 +0100
committerChristopher Baines <mail@cbaines.net>2025-04-12 11:23:56 +0100
commitec6fe7608c2708208280b2be9f9640d99820e57b (patch)
treedad17cf80d7e60a525bacf8da8776126be5e9c24 /guix/import/npm-binary.scm
parentd66a95e5f3a9df1de3e693a40ea809183b71da3c (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.scm16
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))))