From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:57875) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibspX-0007ux-HV for guix-patches@gnu.org; Mon, 02 Dec 2019 16:02:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibspW-0002UU-8q for guix-patches@gnu.org; Mon, 02 Dec 2019 16:02:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibspW-0002UA-3S for guix-patches@gnu.org; Mon, 02 Dec 2019 16:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibspW-0000HL-1D for guix-patches@gnu.org; Mon, 02 Dec 2019 16:02:02 -0500 Subject: [bug#38460] [PATCH 1/1] lint: Add '--load-path' option. References: <20191202204759.28329-1-zimon.toutoune@gmail.com> In-Reply-To: <20191202204759.28329-1-zimon.toutoune@gmail.com> Resent-Message-ID: From: zimoun Date: Mon, 2 Dec 2019 22:01:27 +0100 Message-Id: <20191202210127.28466-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 38460@debbugs.gnu.org Cc: zimoun * guix/scripts/lint.scm (%options): Add '--load-path' option. * tests/guix-lint.sh: Test it. --- guix/scripts/lint.scm | 8 ++++++++ tests/guix-lint.sh | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 1668d02992..8d08c484f5 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2017, 2018 Efraim Flashner ;;; Copyright © 2018, 2019 Arun Isaac +;;; Copyright © 2019 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,6 +31,7 @@ #:use-module (guix lint) #:use-module (guix ui) #:use-module (guix scripts) + #:use-module (guix scripts build) #:use-module (gnu packages) #:use-module (ice-9 match) #:use-module (ice-9 format) @@ -94,6 +96,9 @@ run the checkers on all packages.\n")) -c, --checkers=CHECKER1,CHECKER2... only run the specified checkers")) (display (G_ " + -L, --load-path=DIR prepend DIR to the package module search path")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -l, --list-checkers display the list of available lint checkers")) @@ -128,6 +133,9 @@ run the checkers on all packages.\n")) %local-checkers (alist-delete 'checkers result)))) + (find (lambda (option) + (member "load-path" (option-names option))) + %standard-build-options) (option '(#\h "help") #f #f (lambda args (show-help) diff --git a/tests/guix-lint.sh b/tests/guix-lint.sh index 7ddc7c265b..f07ccb4e1a 100644 --- a/tests/guix-lint.sh +++ b/tests/guix-lint.sh @@ -76,3 +76,15 @@ then true; else false; fi # Make sure specifying multiple packages works. guix lint -c inputs-should-be-native dummy dummy@42 dummy + + +# Use --load-path instead. +unset GUIX_PACKAGE_PATH +LOAD_PATH="$module_dir" + +out=`guix lint -L $LOAD_PATH -c synopsis,description dummy 2>&1` +if [ `grep_warning "$out"` -ne 3 ] +then false; else true; fi + +# Make sure specifying multiple packages works. +guix lint -L $LOAD_PATH -c inputs-should-be-native dummy dummy@42 dummy -- 2.23.0