From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:34673) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iO6Bn-0000WT-Ug for guix-patches@gnu.org; Fri, 25 Oct 2019 16:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iO6Bm-00044A-Ti for guix-patches@gnu.org; Fri, 25 Oct 2019 16:28:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58823) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iO6Bm-000446-Qm for guix-patches@gnu.org; Fri, 25 Oct 2019 16:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iO6Bm-0001Mg-Mk for guix-patches@gnu.org; Fri, 25 Oct 2019 16:28:02 -0400 Subject: [bug#37928] [PATCH] import: crate: Fix licenses. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:34611) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iO6BP-0007FH-83 for guix-patches@gnu.org; Fri, 25 Oct 2019 16:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iO6BN-0003xU-1Q for guix-patches@gnu.org; Fri, 25 Oct 2019 16:27:39 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:47827) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iO6BL-0003uV-1m for guix-patches@gnu.org; Fri, 25 Oct 2019 16:27:36 -0400 Received: from localhost (luy13-1-78-237-113-178.fbx.proxad.net [78.237.113.178]) (Authenticated sender: brice@waegenei.re) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 1855960004 for ; Fri, 25 Oct 2019 20:27:31 +0000 (UTC) From: Brice Waegeneire Date: Fri, 25 Oct 2019 22:27:13 +0200 Message-Id: <20191025202713.7739-2-brice@waegenei.re> In-Reply-To: <20191025202713.7739-1-brice@waegenei.re> References: <20191025202713.7739-1-brice@waegenei.re> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 37928@debbugs.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(-) 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