From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:59297) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iW15H-0001ye-PR for guix-patches@gnu.org; Sat, 16 Nov 2019 11:38:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iW15G-0006mC-Kr for guix-patches@gnu.org; Sat, 16 Nov 2019 11:38:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iW15G-0006m6-HQ for guix-patches@gnu.org; Sat, 16 Nov 2019 11:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iW15G-0007jM-Ce for guix-patches@gnu.org; Sat, 16 Nov 2019 11:38:02 -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> <87mudb46r7.fsf@gnu.org> Date: Sat, 16 Nov 2019 17:37:09 +0100 In-Reply-To: <87mudb46r7.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 04 Nov 2019 23:27:24 +0100") Message-ID: <87bltbwzey.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 Hi Brice, Did you have a chance to look into this? (See for context.) Thanks in advance. :-) Ludo=E2=80=99. Ludovic Court=C3=A8s skribis: > 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 fet= ch 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 = level (that is, > outside =E2=80=98crate->guix-package=E2=80=99), and then have a few tests= along 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.