guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 84b0e85c3ce82e904389a5b77cbfc383215829e9
Author: Hugo Buddelmeijer <[email protected]>
AuthorDate: Tue Aug 18 21:39:21 2026 +0200
scripts: lint: Add --manifest option.
* guix/scrips/lint.scm (show-help): Describe option.
(%options): Add 'manifest'option.
(guix-lint): Run checkers on packages defined in manifest.
* doc/guix.texi (Invoking guix lint): Document option.
* tests/guix-lint.sh: Test option. Normalize whitespace.
* guix/scripts/refresh.scm: Export packages-from-manifest.
Signed-off-by: Ludovic Courtès <[email protected]>
Modified-by: Ludovic Courtès <[email protected]>
Merges: #10653
---
doc/guix.texi | 10 ++++++++++
guix/scripts/lint.scm | 22 ++++++++++++++++------
guix/scripts/refresh.scm | 3 ++-
tests/guix-lint.sh | 12 ++++++++++--
4 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 73d616aa1b..8f09adf950 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16927,6 +16927,12 @@ guix lint @var{options} @var{package}@dots{}
@end example
If no package is given on the command line, then all packages are checked.
+To check packages in a particular manifest, use:
+
+@example
+guix lint @var{options} --manifest=@var{file} @dots{}
+@end example
+
To check packages in particular source files, the syntax is:
@example
@@ -16961,6 +16967,10 @@ This is useful to unambiguously designate packages, as
in this example:
guix lint -c archival -e '(@@ (gnu packages guile) guile-3.0)'
@end example
+@item --manifest=@var{file}
+@itemx -m @var{file}
+Run checkers on packages in manifest @var{file} (@pxref{Writing Manifests}).
+
@item --no-network
@itemx -n
Only enable the checkers that do not depend on Internet access.
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 6a317bf64d..40df87e523 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -37,6 +37,8 @@
#:use-module (guix store)
#:use-module (guix scripts)
#:use-module (guix scripts build)
+ #:autoload (guix scripts refresh) (packages-from-manifest)
+ #:use-module (guix scripts refresh)
#:use-module (gnu packages)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
@@ -136,6 +138,9 @@ run the checkers on all packages.\n"))
(display (G_ "
-e, --expression=EXPR consider the package EXPR evaluates to"))
+ (display (G_ "
+ -m, --manifest=FILE build the packages that the manifest given in FILE
+ evaluates to"))
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
(newline)
@@ -198,6 +203,9 @@ run the checkers on all packages.\n"))
(option '(#\e "expression") #t #f
(lambda (opt name arg result)
(alist-cons 'expression arg result)))
+ (option '(#\m "manifest") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'manifest arg result)))
(option '(#\V "version") #f #f
(lambda args
@@ -219,16 +227,18 @@ run the checkers on all packages.\n"))
(let* ((opts (parse-options))
(whole-file? (assoc-ref opts 'whole-file?))
- (args (filter-map (if whole-file?
+ (args (append-map (if whole-file?
(match-lambda
- (('argument . file) file)
- (_ #f))
+ (('argument . file) (list file))
+ (_ '()))
(match-lambda
(('argument . spec)
- (specification->package spec))
+ (list (specification->package spec)))
(('expression . exp)
- (read/eval-package-expression exp))
- (_ #f)))
+ (list (read/eval-package-expression exp)))
+ (('manifest . man)
+ (packages-from-manifest man))
+ (_ '())))
(reverse opts)))
(no-checkers (or (assoc-ref opts 'exclude) '()))
(the-checkers (filter (lambda (checker)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 60fba71c3e..4b0044d0ea 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -52,7 +52,8 @@
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-37)
#:use-module (srfi srfi-71)
- #:export (guix-refresh))
+ #:export (guix-refresh
+ packages-from-manifest))
;;;
diff --git a/tests/guix-lint.sh b/tests/guix-lint.sh
index 4a77315b3a..2b36649a8b 100644
--- a/tests/guix-lint.sh
+++ b/tests/guix-lint.sh
@@ -52,6 +52,10 @@ cat > "$module_dir/foo.scm"<<EOF
(name "bar")))
EOF
+cat > "${module_dir}/foomanifest.scm"<<EOF
+(specifications->manifest '("dummy"))
+EOF
+
GUIX_PACKAGE_PATH="$module_dir"
export GUIX_PACKAGE_PATH
@@ -64,8 +68,8 @@ grep_warning ()
# Issues with the dummy package:
# 1) the synopsis starts with the package name;
# 2) the synopsis starts with a lower-case letter;
-# 3) the description has a single space following the end-of-sentence period;
-# 4) the alphabetically lesser bar package succeeds it.
+# 3) the description has a single space following the end-of-sentence period;
+# 4) the alphabetically lesser bar package succeeds it.
out=`guix lint -c synopsis,description dummy 2>&1`
test `grep_warning "$out"` -eq 3
@@ -79,6 +83,10 @@ test `grep_warning "$out"` -eq 1
out=`guix lint -c description,synopsis dummy 2>&1`
test `grep_warning "$out"` -eq 3
+# Test specifying a manifest.
+out=`guix lint -c synopsis,description -m ${module_dir}/foomanifest.scm 2>&1`
+test `grep_warning "$out"` -eq 3
+
working_dir="$(pwd)"
cd "$module_dir"
out=`guix lint -c name -f foo.scm 2>&1`