From 80c7f02468c16778b5f08844546193a4243a7dae Mon Sep 17 00:00:00 2001 From: zimoun Date: Wed, 28 Oct 2020 17:51:11 +0100 Subject: scripts: lint: Fix '--no-network' option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. Signed-off-by: Ludovic Courtès --- doc/guix.texi | 4 ++++ guix/scripts/lint.scm | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f2d34d1254..e3b92d86f9 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 that do not depend 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..6833c60741 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 that do not access the 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)) -- cgit v1.2.3