From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sPC8GsuFT2PAdwEAbAwnHQ (envelope-from ) for ; Wed, 19 Oct 2022 07:06:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gB/1GsuFT2OnOgAA9RJhRA (envelope-from ) for ; Wed, 19 Oct 2022 07:06:19 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EA661372EB for ; Wed, 19 Oct 2022 07:06:18 +0200 (CEST) Received: from localhost ([::1]:32920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ol1HW-0006hq-1E for larch@yhetil.org; Wed, 19 Oct 2022 01:06:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol1HG-0006ga-MS for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ol1HG-0004u1-EZ for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ol1HG-0003Yo-9J for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58621] [PATCH 2/3] import/utils: spdx-string->license: Match case-insensitively. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 19 Oct 2022 05:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58621 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58621@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 58621-submit@debbugs.gnu.org id=B58621.166615591913619 (code B ref 58621); Wed, 19 Oct 2022 05:06:02 +0000 Received: (at 58621) by debbugs.gnu.org; 19 Oct 2022 05:05:19 +0000 Received: from localhost ([127.0.0.1]:55491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1GY-0003XZ-3p for submit@debbugs.gnu.org; Wed, 19 Oct 2022 01:05:18 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55411) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1GU-0003Wy-3O for 58621@debbugs.gnu.org; Wed, 19 Oct 2022 01:05:15 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 112E45C018D; Wed, 19 Oct 2022 01:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 19 Oct 2022 01:05:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1666155909; x=1666242309; bh=2KoWng5h3GnQj1kAz2f4QMu1h1ksF7xyzdt 423gGh4w=; b=OWinxBjdOhfRsI8CTdlO1WAvjaIL2n1FnY/B86F3YW6GDHcDVfV jGZR9DWRnSXi62XqZhi+W2VSQfECDSap8AE7madqZbbFgiGD6l6IwyVVDuBEVc1a u+kSQL0gw/3zGH1GoGiTSu7zM4nJqHsnqcacp1en7c3/YU0uAcSl3yyVK1YyXmv9 uJI8DBNqqRbMNnbK0XZufVsf8giJpV+7QGvJxRoDOvNpLsL6Qy6EO5enR4FpleUy eok3F5P7SVNYo50/Yts5FtoRKDzsK4YwOjvPJYas6xVnoGkKpMd9zOsAo9IuGITJ iDhSlqK1J2GM7qaetpqszP4zvuwT2B617QA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1666155909; x=1666242309; bh=2KoWng5h3GnQj 1kAz2f4QMu1h1ksF7xyzdt423gGh4w=; b=bQgb9bFyNfxv8YLfel8szsQ9Mx1SF xHC91NxF+1zSMyLey40Zvzl8sI3hU8i9G9snJl71PgGWBi0BaHC0uLfEsk2vymG6 TL+x9p6aNmpyFrG19a7K/luHFXZC/MYaSKKiYZO5Zs7e15DXakMtpDpn4SQp1e1c c8BAiywMLH3J6wVNpPwy1cp8fvKck8T1B1ILygkC/5XlLDruTJ7ukS4tQiPE5NLw 5m73uJDIlKhPUFIbF7d6dug2gP44BxZgGCa5bQk2n6lnWoze2YUiCXe53UPvHlLc uxdDwXnCkQXKqYg9QRS0+pdZIsjy2Fo37zeMTG1v/6N8PUhIZJPSGRpcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelfedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheprfhhihhl ihhpucfotgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtoh hmqeenucggtffrrghtthgvrhhnpedtkeelvedvtedvjeduvdejkeejvdethfelleejffdu veeigeevffffuedttdelueenucffohhmrghinhepshhpugigrdhorhhgpdhgihhthhhusg drihhonecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep phhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtohhm X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Oct 2022 01:05:08 -0400 (EDT) From: Philip McGrath Date: Wed, 19 Oct 2022 01:04:48 -0400 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666155979; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=2KoWng5h3GnQj1kAz2f4QMu1h1ksF7xyzdt423gGh4w=; b=vCmX+eqIuMVl/E13xWNyVIa1vkRxi0o9nhIh9lEpDwwNvyleu+QOWl04ZKzT3VlXxyDlbj A+O4axdz9ALpnZY+y9v37nOIyOQI4PvuBomnbTw70sJzbjVXmN6ZCzq6tLBjq2SZ/AwntS sB4SQReT8tLoHrDalCJxGoPTbvIvLnamYxstiARJFGUftspUSUY98q91G5TBqeV/TLiYh4 7w55glTkxE2cn0K3dNAZsAYxvfKsIUAtRiOyO4eqlq9qJytdfmtVuXdvKeSCOgl3Zwr8kZ 7NHGA654KmDPGsFzRNGUEFbLPJ6YCGLS9HcXsl7glmKuyrfP9LPg6HwxRM4uDw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666155979; a=rsa-sha256; cv=none; b=SfE9ttPvxCXYWT3p+PiaEe1DXgGWny+XtwSCQR4lt5jqHwBk3fn3/PKfN5sn9uFhCycNay DsBpcdGi7kjFKUgBwW/2OVwLFRoaAqhrv7P0OmYIcBUz08ZffcJ7ejYiKcACailEJ2j8eA QOIkeBqklt6PlRF8NKoKuLZOiNuR7q3V5EccAWh1zaNM9JUO81sixrCZhJoSIik0m3DYwA geZrGH/gNsSpjnWZPDqWztiapYPJ0TG++6UimZLzhE4SOu0UlJKo6isAplwQIL/wz8UeqF 78J8tezRkf/d2eNE5nW3OGXFNMH5YKkPF3BpECwM+x2mwA4zp/1bSWO79FPGJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm3 header.b=OWinxBjd; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=bQgb9bFy; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.27 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm3 header.b=OWinxBjd; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=bQgb9bFy; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EA661372EB X-Spam-Score: 3.27 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3zBvmYumhpDz SPDX specifies that license identifiers (unlike the 'AND', 'OR', and 'WITH' operators) are matched case-insensitively. * guix/import/utils.scm (%spdx-license-identifiers): New variable. (spdx-string->license): Search in '%spdx-license-identifiers' using 'string-ci=?'. --- guix/import/utils.scm | 250 ++++++++++++++++++++++-------------------- 1 file changed, 130 insertions(+), 120 deletions(-) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 6afb009a00..9944b606f3 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -131,132 +131,142 @@ (define (guix-hash-url filename) "Return the hash of FILENAME in nix-base32 format." (bytevector->nix-base32-string (file-sha256 filename))) -(define (spdx-string->license str) - "Convert STR, an SPDX license identifier, to a symbol like 'license:gpl3+ -giving the prefixed name of a license object exported from (guix licenses). -Return #f if STR does not match any known SPDX license identifiers." +(define %spdx-license-identifiers ;; https://spdx.org/licenses/ ;; The gfl1.0, nmap, repoze ;; licenses doesn't have SPDX identifiers ;; ;; Please update guix/licenses.scm when modifying ;; this list to avoid mismatches. - (match str - ;; "GPL-N+" has been deprecated in favour of "GPL-N-or-later". - ;; "GPL-N" has been deprecated in favour of "GPL-N-only" - ;; or "GPL-N-or-later" as appropriate. Likewise for LGPL - ;; and AGPL - ("AGPL-1.0" 'license:agpl1) - ("AGPL-1.0-only" 'license:agpl1) - ("AGPL-3.0" 'license:agpl3) - ("AGPL-3.0-only" 'license:agpl3) - ("AGPL-3.0-or-later" 'license:agpl3+) - ("Apache-1.1" 'license:asl1.1) - ("Apache-2.0" 'license:asl2.0) - ("APSL-2.0" 'license:apsl2) - ("BSL-1.0" 'license:boost1.0) - ("0BSD" 'license:bsd-0) - ("BSD-2-Clause" 'license:bsd-2) - ("BSD-2-Clause-FreeBSD" 'license:bsd-2) ;flagged as deprecated on spdx - ("BSD-3-Clause" 'license:bsd-3) - ("BSD-4-Clause" 'license:bsd-4) - ("CC0-1.0" 'license:cc0) - ("CC-BY-2.0" 'license:cc-by2.0) - ("CC-BY-3.0" 'license:cc-by3.0) - ("CC-BY-4.0" 'license:cc-by4.0) - ("CC-BY-SA-2.0" 'license:cc-by-sa2.0) - ("CC-BY-SA-3.0" 'license:cc-by-sa3.0) - ("CC-BY-SA-4.0" 'license:cc-by-sa4.0) - ("CDDL-1.0" 'license:cddl1.0) - ("CDDL-1.1" 'license:cddl1.1) - ("CECILL-2.1" 'license:cecill) - ("CECILL-B" 'license:cecill-b) - ("CECILL-C" 'license:cecill-c) - ("Artistic-2.0" 'license:artistic2.0) - ("ClArtistic" 'license:clarified-artistic) - ("copyleft-next-0.3.0" 'license:copyleft-next) - ("CPL-1.0" 'license:cpl1.0) - ("EPL-1.0" 'license:epl1.0) - ("EPL-2.0" 'license:epl2.0) - ("EUPL-1.2" 'license:eupl1.2) - ("MIT" 'license:expat) - ("MIT-0" 'license:expat-0) - ("FTL" 'license:freetype) - ("FreeBSD-DOC" 'license:freebsd-doc) - ("Freetype" 'license:freetype) - ("FSFAP" 'license:fsf-free) - ("FSFUL" 'license:fsf-free) - ("GFDL-1.1" 'license:fdl1.1+) - ("GFDL-1.1-or-later" 'license:fdl1.1+) - ("GFDL-1.2" 'license:fdl1.2+) - ("GFDL-1.2-or-later" 'license:fdl1.2+) - ("GFDL-1.3" 'license:fdl1.3+) - ("GFDL-1.3-or-later" 'license:fdl1.3+) - ("Giftware" 'license:giftware) - ("GPL-1.0" 'license:gpl1) - ("GPL-1.0-only" 'license:gpl1) - ("GPL-1.0+" 'license:gpl1+) - ("GPL-1.0-or-later" 'license:gpl1+) - ("GPL-2.0" 'license:gpl2) - ("GPL-2.0-only" 'license:gpl2) - ("GPL-2.0+" 'license:gpl2+) - ("GPL-2.0-or-later" 'license:gpl2+) - ("GPL-3.0" 'license:gpl3) - ("GPL-3.0-only" 'license:gpl3) - ("GPL-3.0+" 'license:gpl3+) - ("GPL-3.0-or-later" 'license:gpl3+) - ("HPND" 'license:hpnd) - ("ISC" 'license:isc) - ("IJG" 'license:ijg) - ("Imlib2" 'license:imlib2) - ("IPA" 'license:ipa) - ("IPL-1.0" 'license:ibmpl1.0) - ("LAL-1.3" 'license:lal1.3) - ("LGPL-2.0" 'license:lgpl2.0) - ("LGPL-2.0-only" 'license:lgpl2.0) - ("LGPL-2.0+" 'license:lgpl2.0+) - ("LGPL-2.0-or-later" 'license:lgpl2.0+) - ("LGPL-2.1" 'license:lgpl2.1) - ("LGPL-2.1-only" 'license:lgpl2.1) - ("LGPL-2.1+" 'license:lgpl2.1+) - ("LGPL-2.1-or-later" 'license:lgpl2.1+) - ("LGPL-3.0" 'license:lgpl3) - ("LGPL-3.0-only" 'license:lgpl3) - ("LGPL-3.0+" 'license:lgpl3+) - ("LGPL-3.0-or-later" 'license:lgpl3+) - ("LPPL-1.0" 'license:lppl) - ("LPPL-1.1" 'license:lppl) - ("LPPL-1.2" 'license:lppl1.2) - ("LPPL-1.3a" 'license:lppl1.3a) - ("LPPL-1.3c" 'license:lppl1.3c) - ("MirOS" 'license:miros) - ("MPL-1.0" 'license:mpl1.0) - ("MPL-1.1" 'license:mpl1.1) - ("MPL-2.0" 'license:mpl2.0) - ("MS-PL" 'license:ms-pl) - ("NCSA" 'license:ncsa) - ("OGL-UK-1.0" 'license:ogl-psi1.0) - ("OpenSSL" 'license:openssl) - ("OLDAP-2.8" 'license:openldap2.8) - ("OPL-1.0" 'license:opl1.0+) - ("CUA-OPL-1.0" 'license:cua-opl1.0) - ("PSF-2.0" 'license:psfl) - ("OSL-2.1" 'license:osl2.1) - ("QPL-1.0" 'license:qpl) - ("Ruby" 'license:ruby) - ("SGI-B-2.0" 'license:sgifreeb2.0) - ("OFL-1.1" 'license:silofl1.1) - ("Sleepycat" 'license:sleepycat) - ("TCL" 'license:tcl/tk) - ("Unlicense" 'license:unlicense) - ("Vim" 'license:vim) - ("W3C" 'license:w3c) - ("WTFPL" 'license:wtfpl2) - ("wxWindow" 'license:wxwindows3.1+) ;flagged as deprecated on spdx - ("X11" 'license:x11) - ("ZPL-2.1" 'license:zpl2.1) - ("Zlib" 'license:zlib) - (_ #f))) + ;; + ;; "GPL-N+" has been deprecated in favour of "GPL-N-or-later". + ;; "GPL-N" has been deprecated in favour of "GPL-N-only" + ;; or "GPL-N-or-later" as appropriate. Likewise for LGPL + ;; and AGPL. + '(("AGPL-1.0" . license:agpl1) + ("AGPL-1.0-only" . license:agpl1) + ("AGPL-3.0" . license:agpl3) + ("AGPL-3.0-only" . license:agpl3) + ("AGPL-3.0-or-later" . license:agpl3+) + ("Apache-1.1" . license:asl1.1) + ("Apache-2.0" . license:asl2.0) + ("APSL-2.0" . license:apsl2) + ("BSL-1.0" . license:boost1.0) + ("0BSD" . license:bsd-0) + ("BSD-2-Clause" . license:bsd-2) + ("BSD-2-Clause-FreeBSD" . license:bsd-2) ;flagged as deprecated on spdx + ("BSD-3-Clause" . license:bsd-3) + ("BSD-4-Clause" . license:bsd-4) + ("CC0-1.0" . license:cc0) + ("CC-BY-2.0" . license:cc-by2.0) + ("CC-BY-3.0" . license:cc-by3.0) + ("CC-BY-4.0" . license:cc-by4.0) + ("CC-BY-SA-2.0" . license:cc-by-sa2.0) + ("CC-BY-SA-3.0" . license:cc-by-sa3.0) + ("CC-BY-SA-4.0" . license:cc-by-sa4.0) + ("CDDL-1.0" . license:cddl1.0) + ("CDDL-1.1" . license:cddl1.1) + ("CECILL-2.1" . license:cecill) + ("CECILL-B" . license:cecill-b) + ("CECILL-C" . license:cecill-c) + ("Artistic-2.0" . license:artistic2.0) + ("ClArtistic" . license:clarified-artistic) + ("copyleft-next-0.3.0" . license:copyleft-next) + ("CPL-1.0" . license:cpl1.0) + ("EPL-1.0" . license:epl1.0) + ("EPL-2.0" . license:epl2.0) + ("EUPL-1.2" . license:eupl1.2) + ("MIT" . license:expat) + ("MIT-0" . license:expat-0) + ("FTL" . license:freetype) + ("FreeBSD-DOC" . license:freebsd-doc) + ("Freetype" . license:freetype) + ("FSFAP" . license:fsf-free) + ("FSFUL" . license:fsf-free) + ("GFDL-1.1" . license:fdl1.1+) + ("GFDL-1.1-or-later" . license:fdl1.1+) + ("GFDL-1.2" . license:fdl1.2+) + ("GFDL-1.2-or-later" . license:fdl1.2+) + ("GFDL-1.3" . license:fdl1.3+) + ("GFDL-1.3-or-later" . license:fdl1.3+) + ("Giftware" . license:giftware) + ("GPL-1.0" . license:gpl1) + ("GPL-1.0-only" . license:gpl1) + ("GPL-1.0+" . license:gpl1+) + ("GPL-1.0-or-later" . license:gpl1+) + ("GPL-2.0" . license:gpl2) + ("GPL-2.0-only" . license:gpl2) + ("GPL-2.0+" . license:gpl2+) + ("GPL-2.0-or-later" . license:gpl2+) + ("GPL-3.0" . license:gpl3) + ("GPL-3.0-only" . license:gpl3) + ("GPL-3.0+" . license:gpl3+) + ("GPL-3.0-or-later" . license:gpl3+) + ("HPND" . license:hpnd) + ("ISC" . license:isc) + ("IJG" . license:ijg) + ("Imlib2" . license:imlib2) + ("IPA" . license:ipa) + ("IPL-1.0" . license:ibmpl1.0) + ("LAL-1.3" . license:lal1.3) + ("LGPL-2.0" . license:lgpl2.0) + ("LGPL-2.0-only" . license:lgpl2.0) + ("LGPL-2.0+" . license:lgpl2.0+) + ("LGPL-2.0-or-later" . license:lgpl2.0+) + ("LGPL-2.1" . license:lgpl2.1) + ("LGPL-2.1-only" . license:lgpl2.1) + ("LGPL-2.1+" . license:lgpl2.1+) + ("LGPL-2.1-or-later" . license:lgpl2.1+) + ("LGPL-3.0" . license:lgpl3) + ("LGPL-3.0-only" . license:lgpl3) + ("LGPL-3.0+" . license:lgpl3+) + ("LGPL-3.0-or-later" . license:lgpl3+) + ("LPPL-1.0" . license:lppl) + ("LPPL-1.1" . license:lppl) + ("LPPL-1.2" . license:lppl1.2) + ("LPPL-1.3a" . license:lppl1.3a) + ("LPPL-1.3c" . license:lppl1.3c) + ("MirOS" . license:miros) + ("MPL-1.0" . license:mpl1.0) + ("MPL-1.1" . license:mpl1.1) + ("MPL-2.0" . license:mpl2.0) + ("MS-PL" . license:ms-pl) + ("NCSA" . license:ncsa) + ("OGL-UK-1.0" . license:ogl-psi1.0) + ("OpenSSL" . license:openssl) + ("OLDAP-2.8" . license:openldap2.8) + ("OPL-1.0" . license:opl1.0+) + ("CUA-OPL-1.0" . license:cua-opl1.0) + ("PSF-2.0" . license:psfl) + ("OSL-2.1" . license:osl2.1) + ("QPL-1.0" . license:qpl) + ("Ruby" . license:ruby) + ("SGI-B-2.0" . license:sgifreeb2.0) + ("OFL-1.1" . license:silofl1.1) + ("Sleepycat" . license:sleepycat) + ("TCL" . license:tcl/tk) + ("Unlicense" . license:unlicense) + ("Vim" . license:vim) + ("W3C" . license:w3c) + ("WTFPL" . license:wtfpl2) + ("wxWindow" . license:wxwindows3.1+) ;flagged as deprecated on spdx + ("X11" . license:x11) + ("ZPL-2.1" . license:zpl2.1) + ("Zlib" . license:zlib))) + +(define (spdx-string->license str) + "Convert STR, an SPDX license identifier, to a symbol like 'license:gpl3+ +giving the prefixed name of a license object exported from (guix licenses). +Return #f if STR does not match any known SPDX license identifiers. Per the +SPDX specification, license identifiers are compared case-insensitively." + ;; https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/#d2-case-sensitivity + ;; Operators AND, OR, and WITH are case-sensitive, but identifiers are + ;; case-insensitive for matching, though the canonical case is used in URIs. + (match (assoc str %spdx-license-identifiers string-ci=?) + ((_ . license) + license) + (#f + #f))) (define (license->symbol license) "Convert LICENSE object to a prefixed symbol representing the variable the -- 2.38.0