From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SFxkJM9oOGNSrwAAbAwnHQ (envelope-from ) for ; Sat, 01 Oct 2022 18:20:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IJhpJM9oOGNX9wAA9RJhRA (envelope-from ) for ; Sat, 01 Oct 2022 18:20:31 +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 8791F26F77 for ; Sat, 1 Oct 2022 18:20:30 +0200 (CEST) Received: from localhost ([::1]:50352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oefE5-0005Na-EU for larch@yhetil.org; Sat, 01 Oct 2022 12:20:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefDf-0005Mb-Pl for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oefDe-0005cH-PV for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oefDe-0003jv-LG for guix-patches@gnu.org; Sat, 01 Oct 2022 12:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58231] [PATCH 0/2] Checking the 'license' field of packages Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Oct 2022 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58231 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58231@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166464116614321 (code B ref -1); Sat, 01 Oct 2022 16:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Oct 2022 16:19:26 +0000 Received: from localhost ([127.0.0.1]:45621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oefD4-0003iv-DK for submit@debbugs.gnu.org; Sat, 01 Oct 2022 12:19:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:47482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oefD2-0003in-DD for submit@debbugs.gnu.org; Sat, 01 Oct 2022 12:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefD2-0005Cu-7X for guix-patches@gnu.org; Sat, 01 Oct 2022 12:19:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefD1-0005an-Uh; Sat, 01 Oct 2022 12:19:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=D0VaQ5FZtSqQcqV0tL1H4vviN/5uOJXgqNNleppnInM=; b=LR896TbkgKOOPO D6EPypu7Ca8GsMVGPnshsqLpu+ujXvCjRvqsZLI7u05gJdhtXGjYz8S9trm/3XxrmDTOzbq7kcZ4x fIsR404bgkYjS/2Aqr5sJhUGptuTiWsTCyhpc8E5071uggWZs4b4vi5NHhOqXb8kbKS9p9m4WOGLJ K7S+IGeyh0yiuJIi0arXL72Ux5hJAI8jtjVyAww6bA95wKBdRRSnVNYpwxAaPSd4q3gVcn7VuJszN C+r2cNakwTDT3nDdGz9i6/Gx8e6OcRcQMhgDf35yVHajzZsFEXqM7UD+ZfGOP57leVK6guh5lk66w mEZ6qbQ497al5vI/fpvw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:62741 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oefD1-0007vT-C6; Sat, 01 Oct 2022 12:19:23 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 1 Oct 2022 18:19:11 +0200 Message-Id: <20221001161911.8116-1-ludo@gnu.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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=1664641231; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=D0VaQ5FZtSqQcqV0tL1H4vviN/5uOJXgqNNleppnInM=; b=QaQBeXL4A1mPYiSCpVQExAs2+nv3O82PdQTbZ3DJG4mdkVUFlRyV07IbjoQnaDuwp5+GIQ Wdf9YSGHSmUYHJglH3U8bXhv8vV3AOnwpVxvHQ+6DcyL+e0bf2/iMADC2pmt9lxvxpDHAe qIsS2/BHoXCT4bIMrd3xFoP8Kk+fff9oD8g/oP9vWmvSXLweKwwRc9L+jJHqIQZ8y8RNTq P2USDkIaQm5H2bDaT7g7ARR8Rp/tyUGRErF1jwGSI0wvhvgj9sCJqU9+fjparfkAtoLXPo eS0YeOzbOkn+n53CI/xJpFv31HnRIcqozaPsse/QRGuDnAmNsHG+PZc/SLOLWw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664641231; a=rsa-sha256; cv=none; b=bRZjJpGRJF2xvjJHUPWe1jPLFMFJ2yAF/VxQm1Y7x9Tpo3bRWNZ4AmQyfkmF70gJojoUyW VPlD2yZEqz513huRg67DD1TaEe4KLCYCVtr+DK7ofEjFftnoUtbn2Am6VVHPUAw/GNnPUn tHlAve8C+E8JymN8WPuIfxOaZym5TmdfvcwZ4zchuoQsPTIV380wFWOZeLgZe673Q9Xku2 nqmmCvdA4cqazRhG7em7Or7PbUcApxbWzvT74159hUGgsO38u7jZ+tH/zFa0NQ5/sQvgvw a753IW5rq7Jw7sUfOn746eqMUMy2Az/ENx4lgg3n0RO4ip/DxArx0b34j4U7fA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=LR896Tbk; dmarc=pass (policy=none) header.from=gnu.org; 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.34 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=LR896Tbk; dmarc=pass (policy=none) header.from=gnu.org; 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: 8791F26F77 X-Spam-Score: -2.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5zq+U6ewQfX3 Hello Guix! We already have ‘guix lint -c license’ but that hasn’t prevented us from occasionally having invalid licenses committed. This patch adds add a ‘sanitize’ option to the ‘license’ field of to detect invalid licenses early on, as zimoun suggested at: https://lists.gnu.org/archive/html/guix-devel/2022-09/msg00067.html The funny part of this patch is that the license validation expands to #t in the majority of cases, meaning that it comes without run-time overhead (there is macro-expansion overhead, but I didn’t measure it). Kinda like static type checking, except that we can only tell when a value is definitely a valid license and cannot conclude in other cases. Feedback welcome! Thanks, Ludo’. Ludovic Courtès (2): licenses: Let 'license?' expand to #t in trivial cases. packages: Raise an exception for invalid 'license' values. guix/licenses.scm | 58 +++++++++++++++++++++++++++++++++++++++------- guix/packages.scm | 40 +++++++++++++++++++++++++++++++- tests/packages.scm | 7 ++++++ 3 files changed, 95 insertions(+), 10 deletions(-) base-commit: d9b7982ba58fdea0934b60a81f507440a56c82ee -- 2.37.3