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

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Wed, 12 Feb 2025 08:23:02 UTC

Severity: normal

Tags: patch

Done: Nicolas Graves <ngraves <at> ngraves.fr>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Subject: [PATCH] import/npm-binary: Handle vector of licenses.
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




This bug report was last modified 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.