From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ueMFJNOFT2OqBgEAbAwnHQ (envelope-from ) for ; Wed, 19 Oct 2022 07:06:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IJ7xItOFT2N7hQAAauVa8A (envelope-from ) for ; Wed, 19 Oct 2022 07:06:27 +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 43DEC2A58A for ; Wed, 19 Oct 2022 07:06:27 +0200 (CEST) Received: from localhost ([::1]:32936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ol1He-0006ht-Dr for larch@yhetil.org; Wed, 19 Oct 2022 01:06:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol1HJ-0006hA-6T for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ol1HH-0004u9-Un for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ol1HG-0003Yv-No for guix-patches@gnu.org; Wed, 19 Oct 2022 01:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58621] [PATCH 3/3] import/utils: spdx-string->license: Support '+' operator. 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.166615591913625 (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]:55493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1GY-0003Xc-Sk for submit@debbugs.gnu.org; Wed, 19 Oct 2022 01:05:19 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ol1GU-0003Wz-Lt for 58621@debbugs.gnu.org; Wed, 19 Oct 2022 01:05:15 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9E7935C0182; Wed, 19 Oct 2022 01:05:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.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=NSlQHlhhE6pwUxXhIwzpwykYucp3Dq4GEdi 0vPQb7Go=; b=eOjw2+uQzhhVaeQ8zsvV+DEhGBWLsfNrlOLLzS2BB3oMPSMUpYD NVx8KsXi3ENwp3u+Yfg9uVtf8tlGM0uJAlK25WJvu/RGrZYLGHHGPKzjmZOijcEK djSUQuasyo4rfVxtan163Agq3OmN4kkC0KiFpSS85WFFSLPIecKqi8x8KJnApGS7 hLsEKFYep2s3zat/rR3j4yqd0OCo/RnrJJBV8bLlnuCRGNjwjFeFe1g4khIY0jxh KJSSwN2mepWaQbeHrJFpGIPy4PcsLzb/nsoFPy27wJMzyuRn0CfSOyRJkKJ0pmwj 4OIKpr7IFRxpeTCoXSKKKtyPyYIki1TGjkg== 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=NSlQHlhhE6pwU xXhIwzpwykYucp3Dq4GEdi0vPQb7Go=; b=dFLHbDTnFhRki1FeR+pPAS+iIGH1m 7FOe3KCCILIAW8EK5yXlzWAP0OV0o5WuorFOrEllmtfG68pKpfwd0ldb3VdX9mf4 360kpXcsBz5ocPhyk6+SrolaXMjzCQiidL3ce6T+Ulv5zUDJF4Rq8uMjqtEMmC2B EahNW92Ws64ixd4PVXRerZCEXTPIxW6vwxv2zxPy410cMlteyGPf7g0zW7DdddUC ijdpZfC/tLYGHf+zU4fdByvbu21Ee+8ZwXoUFvIBDbZc7WmNweT3IlUcRqX224S/ HGrL5/1NaBcAwApiQkgPxApb+FT7Bk1QGbhRyElu0TzbqQQT9FY9740VQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelfedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheprfhhihhl ihhpucfotgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeugeetteehjefgkeffvedukeelffeitdefvdeffedu geefgeeiteehjeeludeiteenucffohhmrghinhepghhithhhuhgsrdhiohenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesphhh ihhlihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Oct 2022 01:05:09 -0400 (EDT) From: Philip McGrath Date: Wed, 19 Oct 2022 01:04:49 -0400 Message-Id: <13f3bbfbd88f0e9c984fd61a5c936de08d814ce0.1666146461.git.philip@philipmcgrath.com> 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=1666155987; 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=NSlQHlhhE6pwUxXhIwzpwykYucp3Dq4GEdi0vPQb7Go=; b=TP53hNhh/CzI4p73nTqLo0HyE6QoDBZKB9PB8la3PuDxcp0AbjKHsy1aCcQ+VhO+ndTVss wHMeT2bgGIghmj+fxaYVu1bI/vozbNjZkjlZV+a5rzeYnK9d0lA36vL43b4I4ENaNy6ZKm uMZ6+Q8FBwfYNbsmqShXToYmgZh2Bpp9raCVvbSy0uHyGemreILoi9x8ikQY8yS+dMF+iQ ZDvsqgHPxEyvCelAS6EyMroxQG1m1m5H7NceMPPOamyTWKcwZLmZ9xVA2K5xnnYTQ4bLGw Kf8v3rrAXqdnnddUU+I3MKJOO8BFvRDreCX+atuoZyE32udB6ILs7tY7EaX+1A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666155987; a=rsa-sha256; cv=none; b=lZquC9VEt6AhplZte9YetH8pxhKnXvqsuAK3HZh6kpH3dgzUe9uvVh6nXgqRwUSm+sys+r i9juYAmO7dRg2300XdBqyyH8MxNCbFi3aCdQ78y05T3v9bbBWKVrY3a2FbjAIkGiSxFuAX PeyUe1okfgoGXeMDEZxsHYde76U3dc8gp9NLmFYn4BozPETUBE4KIVSFmjtCKivhbd2K/g VPjg7XMkaX0sYrLBPvAWGqKmRiezzJ60kvBD/8/bY1k9aPghhgj8WFcPuWuLgZZ8Jawcx+ Jwaf0PsXXASFBkDKb0Jhh10tMm1XuBBMJRvYk9ux2rD/yAvcnHC0XRV3ex4DSA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm3 header.b=eOjw2+uQ; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=dFLHbDTn; 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: 2.77 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm3 header.b=eOjw2+uQ; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=dFLHbDTn; 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: 43DEC2A58A X-Spam-Score: 2.77 X-Migadu-Scanner: scn0.migadu.com X-TUID: 7ZT83xfiBc5u Previously, '+' was supported only via special cases for deprecated GNU identifiers like 'GPL-N+'. This commit adds support for other uses of '+', such as 'AFL-2.0+' and 'LPPL-1.0+'. Strictly speaking, '+' is an operator, not part of the SPDX license identifier, but it is useful to handle it here. * guix/import/utils.scm (spdx-string->license): Support '+' operator. --- guix/import/utils.scm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 9944b606f3..a32fa4857e 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -139,10 +139,11 @@ (define %spdx-license-identifiers ;; Please update guix/licenses.scm when modifying ;; this list to avoid mismatches. ;; - ;; "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. + ;; "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. However, we list the + ;; deprecated forms here (with and without the "+" operator) to get better + ;; results from old license expressions. '(("AGPL-1.0" . license:agpl1) ("AGPL-1.0-only" . license:agpl1) ("AGPL-3.0" . license:agpl3) @@ -255,10 +256,11 @@ (define %spdx-license-identifiers ("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." + "Convert STR, an SPDX license identifier (possibly with a postfix + +operator), 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. @@ -266,7 +268,11 @@ (define (spdx-string->license str) ((_ . license) license) (#f - #f))) + (and (string-suffix? "+" str) + ;; We try the form with the + to support deprecated identifiers for + ;; GNU licenses (see above). Here, we handle other uses of +. + (spdx-string->license + (substring str 0 (- (string-length str) 1))))))) (define (license->symbol license) "Convert LICENSE object to a prefixed symbol representing the variable the -- 2.38.0