Subject: [bug#76220] [PATCH] import/npm-binary: Handle vector of licenses.

From: Nicolas Graves <[email-masked]>
Date: Wed, 12 Feb 2025 01:03:10 +0100

I stumbled on this with the import of stream-spec.  I don't know
however if that only happens for very old packages because they
weren't aligned with current practises.

* guix/import/npm-binary.scm (<package-revision>)[license]: Handle the
case where a vector of licenses is used.
---
 guix/import/npm-binary.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/guix/import/npm-binary.scm b/guix/import/npm-binary.scm
index 92ac7d338e..bc5fd2d5d6 100644
--- a/guix/import/npm-binary.scm
+++ b/guix/import/npm-binary.scm
@@ -103,7 +103,17 @@ (define-json-mapping <package-revision> make-package-revision package-revision?
               (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
-- 
2.48.1

-- 
Best regards,
Nicolas Graves