Browse Source

lint: Add '--load-path' option.

* guix/scripts/lint.scm (%options): Add '--load-path' option.
* doc/guix.texi: Document it.
* tests/guix-lint.sh: Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
wip-system-bootstrap
zimoun 2 years ago
committed by Ludovic Courtès
parent
commit
7282f94967
No known key found for this signature in database GPG Key ID: 90B11993D9AEBB5
  1. 8
      doc/guix.texi
  2. 8
      guix/scripts/lint.scm
  3. 11
      tests/guix-lint.sh

8
doc/guix.texi

@ -9676,6 +9676,14 @@ and exit.
Only enable the checkers specified in a comma-separated list using the
names returned by @code{--list-checkers}.
@item --load-path=@var{directory}
@itemx -L @var{directory}
Add @var{directory} to the front of the package module search path
(@pxref{Package Modules}).
This allows users to define their own packages and make them visible to
the command-line tools.
@end table
@node Invoking guix size

8
guix/scripts/lint.scm

@ -9,6 +9,7 @@
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; 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)

11
tests/guix-lint.sh

@ -76,3 +76,14 @@ 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
out=`guix lint -L $module_dir -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 $module_dir -c inputs-should-be-native dummy dummy@42 dummy
Loading…
Cancel
Save