[PATCH] import: crate: Fix licenses.
(address . guix-patches@gnu.org)
* 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(-)
Toggle diff (34 lines)
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