From patchwork Wed Oct 28 16:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 24856 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 DC13527BBF3; Wed, 28 Oct 2020 17:09:08 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6824727BBF2 for ; Wed, 28 Oct 2020 17:09:08 +0000 (GMT) Received: from localhost ([::1]:35800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXowd-0007Qc-G2 for patchwork@mira.cbaines.net; Wed, 28 Oct 2020 13:09:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXog9-0003bF-7P for guix-patches@gnu.org; Wed, 28 Oct 2020 12:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXog5-0002a0-Uj for guix-patches@gnu.org; Wed, 28 Oct 2020 12:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXog5-0004zv-Ta for guix-patches@gnu.org; Wed, 28 Oct 2020 12:52:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43261] [PATCH v2 1/2] scripts: lint: Fix '--no-network' option. References: <20200907180229.29475-1-zimon.toutoune@gmail.com> In-Reply-To: <20200907180229.29475-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Oct 2020 16:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43261 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43261@debbugs.gnu.org Cc: ludo@gnu.org, zimoun Received: via spool by 43261-submit@debbugs.gnu.org id=B43261.160390388919161 (code B ref 43261); Wed, 28 Oct 2020 16:52:01 +0000 Received: (at 43261) by debbugs.gnu.org; 28 Oct 2020 16:51:29 +0000 Received: from localhost ([127.0.0.1]:50387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXofZ-0004yz-3x for submit@debbugs.gnu.org; Wed, 28 Oct 2020 12:51:29 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:33037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXofW-0004yd-U7 for 43261@debbugs.gnu.org; Wed, 28 Oct 2020 12:51:28 -0400 Received: by mail-wr1-f47.google.com with SMTP id b8so6488258wrn.0 for <43261@debbugs.gnu.org>; Wed, 28 Oct 2020 09:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cHH8s23wTNCPGK2CbwHM4rOyLtc7Hm8Pz25od2Hcdk4=; b=WPD8gjp01v3qSyLchrFQgYyAUUk3K2h94pCMmaCvLLUsmRdWsgEXeJiECIrixDxbaa OxJRpsYu5A7AbSPxJPb3aMDCHgWnUwYZA94tipPAn/ATkk5Vs6dlk7ok5oAY6TSvs3s9 ho3OReYjnbv1wWYDJTk1Pa2aVX2Y5WhlZszIyH/4Slx2JeDdwtaB7JeLamalEYQbis3N AciXPa3f1d42ohvqy3ZfKhic1pRSPJ+By9CI7LIUmdiko7UkHWZISEBLbii47YqYn4hh o++9/ARghNRDnsEpIAxmcr9jU4Wq4b/BXghxf+yI0Gprzz0I+bSxOeuh+oLBAX9CWTfX tZSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cHH8s23wTNCPGK2CbwHM4rOyLtc7Hm8Pz25od2Hcdk4=; b=Km+262Eb1G5ohcRv399v2i86Krs7fJIGmEnK7aOmjIiMVi/WIbvJpfPGgfphs7Ab7P hFvzSQBxL833/tLsrsQ1lH+44w4Abcp1JkKQ7C0ZVtao5radVQLPqED5yoXg6hBnyq6O Vg+85lv2sWFZpruvtVnpY1hakIaaJBW+COYRj4dGFvn/TtD3sZ1Pn+4ZbnK7+D1zRSCx 3t4NsZiy1CzxILEjNabvd+lx06g8ordwH8ubZxqaqCSTRc2XQl2SK7U4w2CTOuO9SJ9m pbqy2SpFjVtfF9czCjAeP8IxIx1ogrCC90QsbEEfK/xgyBQYDh8X1qk2Ob3O6UzzjTza gPJg== X-Gm-Message-State: AOAM531wGWd80ILPSX/oW1fhtzu5Esz5M6pDmHkMARQv6GCwZTLru2eV DEBy1DYXHspZ4sNXYJvwxXp4sRmy3BU= X-Google-Smtp-Source: ABdhPJz9zZLcEuzOCMRKbT1AkzGtiKnIoA6uj6tw7HwEV0w/4W3JJWgW8BoFeGncClILUvj5mMe1rg== X-Received: by 2002:a5d:490a:: with SMTP id x10mr157229wrq.289.1603903880753; Wed, 28 Oct 2020 09:51:20 -0700 (PDT) Received: from lili.univ-paris-diderot.fr ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id y206sm221247wmd.34.2020.10.28.09.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 09:51:20 -0700 (PDT) From: zimoun Date: Wed, 28 Oct 2020 17:51:11 +0100 Message-Id: <20201028165112.28575-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.28.0 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" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/lint.scm: (show-help): Add '--no-network' option message. (%options, parse-options): Fix argument order. * doc/guix.texi (Invoking guix lint): Document it. --- doc/guix.texi | 4 ++++ guix/scripts/lint.scm | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) base-commit: d22d129da903cf6c3382cff5226d81a881fed2aa diff --git a/doc/guix.texi b/doc/guix.texi index 22bddf10e3..19cf26572c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11528,6 +11528,10 @@ and exit. Only enable the checkers specified in a comma-separated list using the names returned by @option{--list-checkers}. +@item --no-network +@itemx -n +Only enable the checkers which do not dependent on Internet access. + @item --load-path=@var{directory} @itemx -L @var{directory} Add @var{directory} to the front of the package module search path diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 979d4f8363..1ab563a3fa 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2017, 2018 Efraim Flashner ;;; Copyright © 2018, 2019 Arun Isaac -;;; Copyright © 2019 Simon Tournier +;;; Copyright © 2019, 2020 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -98,6 +98,9 @@ run the checkers on all packages.\n")) (display (G_ " -c, --checkers=CHECKER1,CHECKER2... only run the specified checkers")) + (display (G_ " + -n, --no-network only run checkers which do not access to network")) + (display (G_ " -L, --load-path=DIR prepend DIR to the package module search path")) (newline) @@ -132,10 +135,7 @@ run the checkers on all packages.\n")) result)))) (option '(#\n "no-network") #f #f (lambda (opt name arg result) - (alist-cons 'checkers - %local-checkers - (alist-delete 'checkers - result)))) + (alist-cons 'no-network? #t result))) (find (lambda (option) (member "load-path" (option-names option))) %standard-build-options) @@ -172,7 +172,13 @@ run the checkers on all packages.\n")) value) (_ #f)) (reverse opts))) - (checkers (or (assoc-ref opts 'checkers) %all-checkers))) + (the-checkers (or (assoc-ref opts 'checkers) %all-checkers)) + (checkers + (if (assoc-ref opts 'no-network?) + (filter (lambda (checker) + (member checker %local-checkers)) + the-checkers) + the-checkers))) (when (assoc-ref opts 'list?) (list-checkers-and-exit checkers))