From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EApBMXO1eGbPswAA62LTzQ:P1 (envelope-from ) for ; Sun, 23 Jun 2024 23:53:23 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id EApBMXO1eGbPswAA62LTzQ (envelope-from ) for ; Mon, 24 Jun 2024 01:53:23 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=ctSaylqA; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1719186803; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JW9UIF6XKk/xhKo3HJme4+lReq5a+ff/nGdCRvQWiHk=; b=u1TVfQKcvxFNycKbH7264R0+L82axxnVi+Wrwu2VMvW/dSYPAMB20xXkS5HyVAr1r+uanj XQBYOUwovB3EGFB8Y0j5STMuKNqMLpIhuzmCskHZZaggH+df6RlnU6Aaeqa1BSIEHc0yte Nxyg0gGekvCOQKiD4GM1nS2z64ID9F1E0xRtBCPhoQUYh6FNg2wLYJUoUyb7F65CJe8DsP AleQRvuxEGgnZ0bj+c3THiqFahDuQ9iy6LMZIVtim7C5mJNYlBkP1rSVB/LUY7R3qk3/Gw RcHjrQH4GjtBK9hPZfh3xzB820BPHQMWrw42Mjv1WLMj/YSKpw5J2NvZQtA4HQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=ctSaylqA; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1719186803; a=rsa-sha256; cv=none; b=GssVcn3g7mMJeg5Wh6YsrDa0ZjD9jKXfWWjBvBJhnA4+Ix7flw3Q0qkc0Ck4QM3P5pJM1q /7I6hH7jID6IXDa5gCd03biRUSZbER9K5nta3HM0931+IJkcXDDABBPr0v8Xk5YyvROtK6 Wq2+nPbirP9qrCCSFbLYWRv3B+/2tA+lB1l3NHF5LQKmZ8mELNycOnl7vLglJNgwWQgI8b JY2juUkEuZ9Npac54RyQhPYdE8RMPSNIWnNAa8o/9JV4LToFJ8Suczrojt2zIlLyM/uwKQ d1XjfFvhF9PznQeeICTB5Camufi5coN1Dks2esk185WQ8xpIowP0MCmeA72yxQ== 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 603C020E9C for ; Mon, 24 Jun 2024 01:53:23 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLX14-0003V9-Lg; Sun, 23 Jun 2024 19:53:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sLX13-0003Uw-Ud for guix-patches@gnu.org; Sun, 23 Jun 2024 19:53:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLX13-0006Yg-Mw for guix-patches@gnu.org; Sun, 23 Jun 2024 19:53:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sLX14-0001Xx-A2 for guix-patches@gnu.org; Sun, 23 Jun 2024 19:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH v3 2/2] scripts: lint: Honor package property to exclude checkers. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jun 2024 23:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: Josselin Poiret , Mathieu Othacehe , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Tobias Geerinckx-Rice , Florian Pelz , Ricardo Wurmus , 71697@debbugs.gnu.org, Christopher Baines , Matthew Trzcinski Received: via spool by 71697-submit@debbugs.gnu.org id=B71697.17191867655913 (code B ref 71697); Sun, 23 Jun 2024 23:53:02 +0000 Received: (at 71697) by debbugs.gnu.org; 23 Jun 2024 23:52:45 +0000 Received: from localhost ([127.0.0.1]:57220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sLX0m-0001XH-Kb for submit@debbugs.gnu.org; Sun, 23 Jun 2024 19:52:45 -0400 Received: from mail-ot1-f41.google.com ([209.85.210.41]:44181) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sLX0k-0001X0-Be for 71697@debbugs.gnu.org; Sun, 23 Jun 2024 19:52:43 -0400 Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6f9a4f9923aso2172756a34.0 for <71697@debbugs.gnu.org>; Sun, 23 Jun 2024 16:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719186696; x=1719791496; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JW9UIF6XKk/xhKo3HJme4+lReq5a+ff/nGdCRvQWiHk=; b=ctSaylqARNqaM5x3nJC9M8/09IQW+LObsouYIcPWnu8IyRT+sQ+Z8AvsgPFeIsC8W7 Rx53VriWnV0ZNK3+lL2Es+Zed5vnsvDGD03d5LtREgJpAsPntj8t31JiniSPtaADa87a ITiQ5j0mjKL5htTEwFh7s85yQwmFmtivf6KzPFt1SeMJLOc9a9iNVNlPI3hA/928MY7y A7dcNGi71iYD8HExfHW6xT5Xn36STgV1NrYwjpPFBOwethihIA2LN6n4sW9im1ftsStK jsqftS1SUeXcP82EOHyjSCpCI/Pps2QQP1wxkeQIFVuXeSZWYTZl8cBq/EQjVvut2FxB 7MHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719186696; x=1719791496; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JW9UIF6XKk/xhKo3HJme4+lReq5a+ff/nGdCRvQWiHk=; b=SFbj9ILVFPqwoVML1WzDQYnkpH+MUMQKOijdGhiZBeOiXOktba6qmlB1QWB339WGCP MQy/tYHVz0E6t2uUCzFS3ybs4B4hpLJqi5jnYAj9GPr2BUniEWBeT9EBr1XnuQGV+/Zi dbg7ohAS5h1IdiuT2K4b5wWd2RP6GCDCsHpYpSizdLHoBXp4TW2EdxIzbF7vOkrdwgXZ ImRoPcLVpCs1JZWPryiqLWV9F+ZT/0yVdUfu9UhjFL1c/G01mRsj3Gb5KOc/+OiZZFFy o2xNSHIazHAcGyOYEt0Gfg4J8WGjXaDI8wn62TjuRsTPsAEaRdDvdPAB90uwxn2j9KpY Ju7A== X-Gm-Message-State: AOJu0YxP+l6Tw3svWRl0vNWHpHhFHA/UsJ6SIq9xOnetmbJRiYXQ7/wF 6cr5YtAN0XgbU9RF0UqGVi8/Hw/yheQJgmnxTb4GsTCpfQ+wq7aA X-Google-Smtp-Source: AGHT+IHVUPVIGDi5atuOtLUOTjIU5VJ7T9rgGY93dIokweasFWLiDPuOwogevCkMSl42+EnvHV/Wuw== X-Received: by 2002:a9d:7387:0:b0:6fa:128a:5582 with SMTP id 46e09a7af769-700ac4be336mr4331407a34.13.1719186695849; Sun, 23 Jun 2024 16:51:35 -0700 (PDT) Received: from hurd (dsl-205-233-124-241.b2b2c.ca. [205.233.124.241]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-444c2ba6b39sm35948311cf.55.2024.06.23.16.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jun 2024 16:51:34 -0700 (PDT) From: Maxim Cournoyer In-Reply-To: (Simon Tournier's message of "Sat, 22 Jun 2024 17:27:08 +0200") References: <1f9e0a732fff5c6460e6da9500ea5b748882e38d.1719069966.git.zimon.toutoune@gmail.com> Date: Sun, 23 Jun 2024 19:51:33 -0400 Message-ID: <87bk3rb4l6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: 3.23 X-Migadu-Queue-Id: 603C020E9C X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: 3.23 X-TUID: DQhnglfTCdZ3 Hi Simon, Simon Tournier writes: > * guix/scripts/lint.scm (exclude-package-checkers): New procedure, filter= the > checker if the package is marked. > (guix-lint)[show-package-checkers]: New procedure. > * doc/guix.texi: Document it. > > Change-Id: Idf8e5c67102a1701ebd917bbc6212cfeb6ea2054 > --- > doc/guix.texi | 17 ++++++++++++++++- > guix/scripts/lint.scm | 26 +++++++++++++++++++++++++- > 2 files changed, 41 insertions(+), 2 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 037b1a2f24..1baf3fafe6 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -71,7 +71,7 @@ > Copyright @copyright{} 2019 Alex Griffin@* > Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@* > Copyright @copyright{} 2020 Liliana Marie Prikler@* > -Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@* > +Copyright @copyright{} 2019, 2020, 2021, 2022, 2023, 2024 Simon Tournier= @* > Copyright @copyright{} 2020 Wiktor =C5=BBelazny@* > Copyright @copyright{} 2020 Damien Cassou@* > Copyright @copyright{} 2020 Jakub K=C4=85dzio=C5=82ka@* > @@ -15444,6 +15444,21 @@ Invoking guix lint > to the new style. > @end table > > +Sometimes it is not desired to run the same checker each time > +@command{guix lint} is invoked---e.g., because the checker takes time or > +to avoid to send again and again the same request for archiving. The rationale sounds odd in the context of creating Guix packages for Guix -- I wouldn't want someone to start adding random lint exclusions to package properties because some check "takes time". I think it'd be better to give as an example which problem the mechanism was created for, which is, to opt out of the Software Heritage archival requests. >From there the text could mention that the mechanism is general can be used to disable other lint checks as well, such as the home page check. > +Instead of excluding the checker at the command-line via the option > +@code{--exclude}, the package might be marked to skip the checker by > +honoring the property in package definition, e.g., > + > +@lisp > +(package > + (name "python-scikit-learn") > + ;; @dots{} > + (properties '((lint-exclude-archival? . #t) > + (lint-exclude-home-page? . #t)))) > +@end lisp > + > The general syntax is: > > @example > diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm > index b98266c831..7aed467eae 100644 > --- a/guix/scripts/lint.scm > +++ b/guix/scripts/lint.scm > @@ -9,7 +9,7 @@ > ;;; Copyright =C2=A9 2017 Tobias Geerinckx-Rice > ;;; Copyright =C2=A9 2017, 2018 Efraim Flashner > ;;; Copyright =C2=A9 2018, 2019 Arun Isaac > -;;; Copyright =C2=A9 2019, 2020 Simon Tournier > +;;; Copyright =C2=A9 2019, 2020, 2024 Simon Tournier > ;;; Copyright =C2=A9 2020 Brice Waegeneire > ;;; > ;;; This file is part of GNU Guix. > @@ -39,6 +39,7 @@ (define-module (guix scripts lint) > #:use-module (ice-9 format) > #:use-module (srfi srfi-1) > #:use-module (srfi srfi-37) > + #:use-module (srfi srfi-26) > #:export (guix-lint > run-checkers)) > > @@ -59,6 +60,18 @@ (define (emit-warnings warnings) > name version message)))) > warnings)) > > +(define (exclude-package-checkers package checkers) > + "Filter the CHECKERS list using PACKAGE properties field." > + (let ((properties (package-properties package))) > + (filter (lambda (checker) > + (not (assq-ref properties > + ((compose string->symbol > + (cut string-append "lint-exclude-= " <> "?") > + symbol->string > + lint-checker-name) > + checker)))) > + checkers))) Instead of using filter + a negated test, I'd use 'remove' (from SRFI 1). > (define* (run-checkers package checkers #:key store) > "Run the given CHECKERS on PACKAGE." > (let ((tty? (isatty? (current-error-port)))) > @@ -223,16 +236,27 @@ (define-command (guix-lint . args) > (proc store)) > (proc #f))) > > + (define (show-package-checkers package checkers) > + (format (current-error-port) "~a@~a checked by~{ ~a~}.~%" > + (package-name package) > + (package-version package) > + (sort (map (compose symbol->string lint-checker-name) > + (exclude-package-checkers > + package checkers)) > + string + > (call-maybe-with-store > (lambda (store) > (cond > ((null? args) > (fold-packages (lambda (p r) > + (show-package-checkers p checkers) > (when (not (assoc-ref opts 'dry-run?)) > (run-checkers p checkers > #:store store))) '())) > (else > (for-each (lambda (package) > + (show-package-checkers package checkers) > (when (not (assoc-ref opts 'dry-run?)) > (run-checkers package checkers > #:store store))) I haven't tried it, but this looks reasonable to me. --=20 Thanks, Maxim