GNU bug report logs - #37927
Better handle license expressions in 'guix import crate'

Previous Next

Package: guix-patches;

Reported by: Brice Waegeneire <brice <at> waegenei.re>

Date: Fri, 25 Oct 2019 20:28:01 UTC

Severity: normal

Tags: patch

Merged with 37928

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Brice Waegeneire <brice <at> waegenei.re>
Subject: bug#37928: closed (Re: [bug#37928] [PATCH v2] import: crate:
 Better handle license expressions.)
Date: Wed, 11 Dec 2019 13:02:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#37927: Better handle license expressions in 'guix import crate'

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 37928 <at> debbugs.gnu.org.

-- 
37927: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37927
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Brice Waegeneire <brice <at> waegenei.re>
Cc: 37927-done <at> debbugs.gnu.org, 37928-done <at> debbugs.gnu.org
Subject: Re: [bug#37928] [PATCH v2] import: crate: Better handle license
 expressions.
Date: Wed, 11 Dec 2019 12:24:04 +0100
Hi Brice,

Brice Waegeneire <brice <at> waegenei.re> skribis:

> * guix/import/crate.scm (%dual-license-rx): Removed function.
> (crate->guix-package): Handle most of the multi-licensing cases.
> * tests/crate.scm (licenses): Add tests for some licenses.

Thanks for the updated patch!

> +(define (string->license string)
> +    (map
> +     spdx-string->license
> +     (filter (lambda (license)
> +               (and (not (string-null? license))
> +                   (not (any (lambda (elem) (string=? elem license))
> +                             '("AND" "OR" "WITH")))))
> +            (string-split string (string->char-set " /")))))

I changed that to use ‘filter-map’ instead and pushed as
263a267b75e472cb84428571580dabd99d5dff0c.

Thanks!

Ludo’.

[Message part 3 (message/rfc822, inline)]
From: Brice Waegeneire <brice <at> waegenei.re>
To: guix-patches <at> gnu.org
Subject: [PATCH] import: crate: Fix licenses.
Date: Fri, 25 Oct 2019 22:27:13 +0200
* guix/import/crate.scm (%dual-license-rx): Removed function.
(crate->guix-package): Handle most of the multi-licensing cases.
---
 guix/import/crate.scm | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 8dc014d232..e08028db15 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -178,21 +178,18 @@ and LICENSE."
          (close-port port)
          pkg))
 
-(define %dual-license-rx
-  ;; Dual licensing is represented by a string such as "MIT OR Apache-2.0".
-  ;; This regexp matches that.
-  (make-regexp "^(.*) OR (.*)$"))
-
 (define* (crate->guix-package crate-name #:optional version)
   "Fetch the metadata for CRATE-NAME from crates.io, and return the
 `package' s-expression corresponding to that package, or #f on failure.
 When VERSION is specified, attempt to fetch that version; otherwise fetch the
 latest version of CRATE-NAME."
   (define (string->license string)
-    (match (regexp-exec %dual-license-rx string)
-      (#f (list (spdx-string->license string)))
-      (m  (list (spdx-string->license (match:substring m 1))
-                (spdx-string->license (match:substring m 2))))))
+    (filter
+     (lambda (word)
+       (and (not (string-null? word))
+            (not (any (lambda (elem) (string=? elem word))
+                      '("AND" "OR" "WITH"))) ))
+     (string-split string (string->char-set " /"))))
 
   (define (normal-dependency? dependency)
     (eq? (crate-dependency-kind dependency) 'normal))
-- 
2.19.2




This bug report was last modified 5 years and 214 days ago.

Previous Next


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