From patchwork Fri Jul 19 18:38:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 29383 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B191E27BBE9; Fri, 19 Jul 2024 19:40:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0344327BBE2 for ; Fri, 19 Jul 2024 19:40:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUsWZ-0000Xw-Rl; Fri, 19 Jul 2024 14:40:11 -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 1sUsWY-0000TV-Ls for guix-patches@gnu.org; Fri, 19 Jul 2024 14:40:10 -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 1sUsWY-00034x-9w; Fri, 19 Jul 2024 14:40:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sUsWQ-0006ch-D2; Fri, 19 Jul 2024 14:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH v5 1/3] scripts: lint: Add 'dry-run' option. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 19 Jul 2024 18:40: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 , Ludovic =?utf-8?q?Court=C3=A8?= =?utf-8?q?s?= Cc: Josselin Poiret , Maxim Cournoyer , Mathieu Othacehe , Tobias Geerinckx-Rice , Florian Pelz , 71697@debbugs.gnu.org, Christopher Baines , Matthew Trzcinski , Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71697-submit@debbugs.gnu.org id=B71697.172141437525387 (code B ref 71697); Fri, 19 Jul 2024 18:40:02 +0000 Received: (at 71697) by debbugs.gnu.org; 19 Jul 2024 18:39:35 +0000 Received: from localhost ([127.0.0.1]:50872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVz-0006bO-6A for submit@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:35 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:38257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVx-0006bB-4u for 71697@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:33 -0400 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-36874d7f70bso137530f8f.1 for <71697@debbugs.gnu.org>; Fri, 19 Jul 2024 11:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721414308; x=1722019108; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pp0PurRNNpQ2QH8WxnFjzj2bl8wcDYkfZiT4CBoogTo=; b=CRLDa6NGSYz3FGQclsikDGTW4fSK12lJ47Sw8obhOVMW+Yu1FxCwei7bclDoAcz9H/ rxiRPiilK/ec8Z6Huaz8D9Az0HoFbY0V9yT/sEy/OR7JTn1NJji99QEZvm4JKoF57xqX iYhgNaFC49alBpoj4HlIWEv4I2fs2FJIHH5VFYKhjResiMLF3kAq3FY5CAUcZMnhaZk6 58zGHZvfbEGGmxtonBM6xSI1vvyjFcuesyKsMb+HBB4eUYMFYTZpz7HgqjLtM8z4U6Yx RJdVM+qZZny+b04vVNxhgjxM8urLV0o3E7/3laZZBUv5Z4rSL612qZM9CnvzAPv0918o ry2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721414308; x=1722019108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pp0PurRNNpQ2QH8WxnFjzj2bl8wcDYkfZiT4CBoogTo=; b=r1nimXdByOh1YS8XK0UVtdjgzeIyv2AvelbCOV1cWKWkzHbVz2uzHHkgjnLfenQ/TW 0OnxjLq+zvYhRGO11dQzwWUa0xF/AcT4iVZKYx8BP+kth6KIB6wJeBqALDOV80s6rU6e PVgqJTf+hndlQ8cdljan0ZSEyviD2nw7AfcUj0kRuQ4WrzNzlXWbBwaxQeDr5R8GV9W2 FQEbAMUd7IALCRzqegM0Eex/Cc+fYqzvngupLPee80bpKtA87s+y3vQHJ9gvFEmpBOf3 PHnZSoKZa/GmZckZLrKUiU2Z0raRna6r9ElVlIg5tFLGZNy6nVDqM4/G10ei5bOpVo+n k7PA== X-Forwarded-Encrypted: i=1; AJvYcCX6PNpIJmB8dGvSUqa9TnGzKxoRj7Ziadz4eyctn7LJKmwm3RPllvWWhMUsQzqY9vgw6bPSPfPFaTj74f+zFDmfKwc9GSw= X-Gm-Message-State: AOJu0Yzd0QQuaproswHIwQ+7qbtEdFp4yaOim1+MAB9nPFsplb1jju9M UPbDGfm2dCy0OVrEefa6jI8rF5xfqJnaAWxsA/pcEr4f/gSHWXMh X-Google-Smtp-Source: AGHT+IFcGaW9cefsVTD8Mc9xDb3LbhcedQYcLNdhLx1O5FLifzydA9+21D+3tptmInZ6NxyIus2TdA== X-Received: by 2002:a05:600c:3554:b0:426:6cd1:d104 with SMTP id 5b1f17b1804b1-427daa7be1amr1292545e9.4.1721414307827; Fri, 19 Jul 2024 11:38:27 -0700 (PDT) Received: from lili.univ-paris-diderot.fr (roam-nat-fw-prg-194-254-61-42.net.univ-paris-diderot.fr. [194.254.61.42]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e42bsm62855355e9.30.2024.07.19.11.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 11:38:27 -0700 (PDT) From: Simon Tournier Date: Fri, 19 Jul 2024 20:38:08 +0200 Message-ID: <29595ae1ec166885b3916f9239986da5a7fdad58.1721411923.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/lint.scm (guix-lint)[show-package-checkers]: New procedure. (show-help, %options): Add 'dry-run' option. * doc/guix.texi: Document it. Change-Id: I8c96e376d52c0961ccf2ab39f1fc856c762b089d --- doc/guix.texi | 3 +++ guix/scripts/lint.scm | 54 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5b77c84b4a..6043962038 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -15463,6 +15463,9 @@ Invoking guix lint List and describe all the available checkers that will be run on packages and exit. +@item --dry-run +Do not run the checkers. + @item --checkers @itemx -c Only enable the checkers specified in a comma-separated list using the diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index ee3de51fb1..10abb05cf0 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -100,6 +100,8 @@ (define (show-help) (display (G_ "Usage: guix lint [OPTION]... [PACKAGE]... Run a set of checkers on the specified package; if none is specified, run the checkers on all packages.\n")) + (display (G_ " + --dry-run do not run checkers ")) (display (G_ " -c, --checkers=CHECKER1,CHECKER2... only run the specified checkers")) @@ -154,6 +156,9 @@ (define %options (option '(#\n "no-network") #f #f (lambda (opt name arg result) (alist-cons 'no-network? #t result))) + (option '("dry-run") #f #f + (lambda (opt name arg result) + (alist-cons 'dry-run? #t result))) (find (lambda (option) (member "load-path" (option-names option))) %standard-build-options) @@ -218,14 +223,55 @@ (define-command (guix-lint . args) (proc store)) (proc #f))) + (define (show-package-checkers package checkers) + (let* ((name (package-name package)) + (version (package-version package)) + (loc (package-location package)) + (number-checkers (length checkers)) + (number-all-checkers (length %all-checkers))) + (cond + ((= number-all-checkers number-checkers) + (info loc (G_ "~a@~a: all the ~d checkers would run.~%") + name version + number-all-checkers)) + ((= 0 number-checkers) + (info loc (G_ "~a@~a: none of ~d checkers would run~%") + name version + number-all-checkers)) + (else + (let* ((excluded-checkers (lset-difference eq? %all-checkers checkers)) + (number-excluded-checkers (length excluded-checkers)) + (number-difference (- number-all-checkers number-excluded-checkers)) + (sorter (lambda (list-checkers) + (sort (map (compose symbol->string lint-checker-name) + list-checkers) + string