From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:59518) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRkpP-00082C-27 for guix-patches@gnu.org; Mon, 04 Nov 2019 17:28:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRkpO-00070P-06 for guix-patches@gnu.org; Mon, 04 Nov 2019 17:28:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iRkpN-000706-ST for guix-patches@gnu.org; Mon, 04 Nov 2019 17:28:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iRkpN-000766-LQ for guix-patches@gnu.org; Mon, 04 Nov 2019 17:28:01 -0500 Subject: [bug#37927] [bug#37928] [PATCH] import: crate: Fix licenses. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20191025202713.7739-1-brice@waegenei.re> <20191025202713.7739-2-brice@waegenei.re> Date: Mon, 04 Nov 2019 23:27:24 +0100 In-Reply-To: <20191025202713.7739-2-brice@waegenei.re> (Brice Waegeneire's message of "Fri, 25 Oct 2019 22:27:13 +0200") Message-ID: <87mudb46r7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Brice Waegeneire Cc: 37927@debbugs.gnu.org, 37928@debbugs.gnu.org Hi Brice, Brice Waegeneire skribis: > * guix/import/crate.scm (%dual-license-rx): Removed function. > (crate->guix-package): Handle most of the multi-licensing cases. Nice! > (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 fetc= h 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=3D? elem word)) > + '("AND" "OR" "WITH"))) )) > + (string-split string (string->char-set " /")))) It would be great to have tests for that in tests/crate.scm. To that end, I think you could lift =E2=80=98string->license=E2=80=99 to the top le= vel (that is, outside =E2=80=98crate->guix-package=E2=80=99), and then have a few tests a= long these lines: (define string->license (@@ (guix import crate) string->license)) (test-equal "GPL OR LGPL" (list license:gpl3+ license:lgpl3+) (string->license "GPL OR LGPL")) (See .) Let me know if anything is unclear. Could you send an updated patch? Thanks, Ludo=E2=80=99.