lint: Add '-e'.
* guix/scripts/lint.scm (show-help, %options): Add '-e'. (guix-lint): Call 'specification->package' while traversing OPTS. Add case for 'expression pair. Adjust 'for-each' loop to expect packages. * doc/guix.texi (Invoking guix lint): Document it.
This commit is contained in:
		
							parent
							
								
									bde902cb78
								
							
						
					
					
						commit
						ad8beb6325
					
				
					 2 changed files with 24 additions and 8 deletions
				
			
		| 
						 | 
					@ -14359,6 +14359,16 @@ names returned by @option{--list-checkers}.
 | 
				
			||||||
Only disable the checkers specified in a comma-separated list using the
 | 
					Only disable the checkers specified in a comma-separated list using the
 | 
				
			||||||
names returned by @option{--list-checkers}.
 | 
					names returned by @option{--list-checkers}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@item --expression=@var{expr}
 | 
				
			||||||
 | 
					@itemx -e @var{expr}
 | 
				
			||||||
 | 
					Consider the package @var{expr} evaluates to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is useful to unambiguously designate packages, as in this example:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@example
 | 
				
			||||||
 | 
					guix lint -c archival -e '(@@ (gnu packages guile) guile-3.0)'
 | 
				
			||||||
 | 
					@end example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@item --no-network
 | 
					@item --no-network
 | 
				
			||||||
@itemx -n
 | 
					@itemx -n
 | 
				
			||||||
Only enable the checkers that do not depend on Internet access.
 | 
					Only enable the checkers that do not depend on Internet access.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
;;; GNU Guix --- Functional package management for GNU
 | 
					;;; GNU Guix --- Functional package management for GNU
 | 
				
			||||||
;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
 | 
					;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
 | 
				
			||||||
;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 | 
					;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
 | 
				
			||||||
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 | 
					;;; Copyright © 2013-2020, 2022 Ludovic Courtès <ludo@gnu.org>
 | 
				
			||||||
;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
 | 
					;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
 | 
				
			||||||
;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
 | 
					;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
 | 
				
			||||||
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 | 
					;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 | 
				
			||||||
| 
						 | 
					@ -108,6 +108,8 @@ run the checkers on all packages.\n"))
 | 
				
			||||||
                         exclude the specified checkers"))
 | 
					                         exclude the specified checkers"))
 | 
				
			||||||
  (display (G_ "
 | 
					  (display (G_ "
 | 
				
			||||||
  -n, --no-network       only run checkers that do not access the network"))
 | 
					  -n, --no-network       only run checkers that do not access the network"))
 | 
				
			||||||
 | 
					  (display (G_ "
 | 
				
			||||||
 | 
					  -e, --expression=EXPR  consider the package EXPR evaluates to"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (display (G_ "
 | 
					  (display (G_ "
 | 
				
			||||||
  -L, --load-path=DIR    prepend DIR to the package module search path"))
 | 
					  -L, --load-path=DIR    prepend DIR to the package module search path"))
 | 
				
			||||||
| 
						 | 
					@ -161,9 +163,11 @@ run the checkers on all packages.\n"))
 | 
				
			||||||
                  (exit 0)))
 | 
					                  (exit 0)))
 | 
				
			||||||
        (option '(#\l "list-checkers") #f #f
 | 
					        (option '(#\l "list-checkers") #f #f
 | 
				
			||||||
                (lambda (opt name arg result)
 | 
					                (lambda (opt name arg result)
 | 
				
			||||||
                  (alist-cons 'list?
 | 
					                  (alist-cons 'list? #t result)))
 | 
				
			||||||
                              #t
 | 
					        (option '(#\e "expression") #t #f
 | 
				
			||||||
                              result)))
 | 
					                (lambda (opt name arg result)
 | 
				
			||||||
 | 
					                  (alist-cons 'expression arg result)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        (option '(#\V "version") #f #f
 | 
					        (option '(#\V "version") #f #f
 | 
				
			||||||
                (lambda args
 | 
					                (lambda args
 | 
				
			||||||
                  (show-version-and-exit "guix lint")))))
 | 
					                  (show-version-and-exit "guix lint")))))
 | 
				
			||||||
| 
						 | 
					@ -184,8 +188,10 @@ run the checkers on all packages.\n"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (let* ((opts (parse-options))
 | 
					  (let* ((opts (parse-options))
 | 
				
			||||||
         (args (filter-map (match-lambda
 | 
					         (args (filter-map (match-lambda
 | 
				
			||||||
                             (('argument . value)
 | 
					                             (('argument . spec)
 | 
				
			||||||
                              value)
 | 
					                              (specification->package spec))
 | 
				
			||||||
 | 
					                             (('expression . exp)
 | 
				
			||||||
 | 
					                              (read/eval-package-expression exp))
 | 
				
			||||||
                             (_ #f))
 | 
					                             (_ #f))
 | 
				
			||||||
                           (reverse opts)))
 | 
					                           (reverse opts)))
 | 
				
			||||||
         (no-checkers (or (assoc-ref opts 'exclude) '()))
 | 
					         (no-checkers (or (assoc-ref opts 'exclude) '()))
 | 
				
			||||||
| 
						 | 
					@ -219,7 +225,7 @@ run the checkers on all packages.\n"))
 | 
				
			||||||
             (fold-packages (lambda (p r) (run-checkers p checkers
 | 
					             (fold-packages (lambda (p r) (run-checkers p checkers
 | 
				
			||||||
                                                        #:store store)) '()))
 | 
					                                                        #:store store)) '()))
 | 
				
			||||||
            (else
 | 
					            (else
 | 
				
			||||||
             (for-each (lambda (spec)
 | 
					             (for-each (lambda (package)
 | 
				
			||||||
                         (run-checkers (specification->package spec) checkers
 | 
					                         (run-checkers package checkers
 | 
				
			||||||
                                       #:store store))
 | 
					                                       #:store store))
 | 
				
			||||||
                       args)))))))))
 | 
					                       args)))))))))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue