mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
guix gc: '--verify=foo' is reported as an error.
Fixes <https://bugs.gnu.org/29761>. Reported by Martin Castillo <castilma@uni-bremen.de>. * guix/scripts/gc.scm (argument->verify-options): New procedure. (%options) ["verify"]: Adjust to use it. * tests/guix-gc.sh: Add test.
This commit is contained in:
parent
147d42fc03
commit
3caab236c4
2 changed files with 24 additions and 10 deletions
|
@ -78,6 +78,21 @@ (define (show-help)
|
||||||
(newline)
|
(newline)
|
||||||
(show-bug-report-information))
|
(show-bug-report-information))
|
||||||
|
|
||||||
|
(define argument->verify-options
|
||||||
|
(let ((not-comma (char-set-complement (char-set #\,)))
|
||||||
|
(validate (lambda (option)
|
||||||
|
(unless (memq option '(repair contents))
|
||||||
|
(leave (G_ "~a: invalid '--verify' option~%")
|
||||||
|
option)))))
|
||||||
|
(lambda (arg)
|
||||||
|
"Turn ARG into a list of symbols denoting '--verify' options."
|
||||||
|
(if arg
|
||||||
|
(let ((lst (map string->symbol
|
||||||
|
(string-tokenize arg not-comma))))
|
||||||
|
(for-each validate lst)
|
||||||
|
lst)
|
||||||
|
'()))))
|
||||||
|
|
||||||
(define %options
|
(define %options
|
||||||
;; Specification of the command-line options.
|
;; Specification of the command-line options.
|
||||||
(list (option '(#\h "help") #f #f
|
(list (option '(#\h "help") #f #f
|
||||||
|
@ -112,16 +127,12 @@ (define %options
|
||||||
(alist-cons 'action 'optimize
|
(alist-cons 'action 'optimize
|
||||||
(alist-delete 'action result))))
|
(alist-delete 'action result))))
|
||||||
(option '("verify") #f #t
|
(option '("verify") #f #t
|
||||||
(let ((not-comma (char-set-complement (char-set #\,))))
|
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(let ((options (if arg
|
(let ((options (argument->verify-options arg)))
|
||||||
(map string->symbol
|
|
||||||
(string-tokenize arg not-comma))
|
|
||||||
'())))
|
|
||||||
(alist-cons 'action 'verify
|
(alist-cons 'action 'verify
|
||||||
(alist-cons 'verify-options options
|
(alist-cons 'verify-options options
|
||||||
(alist-delete 'action
|
(alist-delete 'action
|
||||||
result)))))))
|
result))))))
|
||||||
(option '("list-dead") #f #f
|
(option '("list-dead") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'action 'list-dead
|
(alist-cons 'action 'list-dead
|
||||||
|
|
|
@ -39,6 +39,9 @@ do
|
||||||
if guix gc $option whatever; then false; else true; fi
|
if guix gc $option whatever; then false; else true; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# This should fail.
|
||||||
|
if guix gc --verify=foo; then false; else true; fi
|
||||||
|
|
||||||
# Check the references of a .drv.
|
# Check the references of a .drv.
|
||||||
drv="`guix build guile-bootstrap -d`"
|
drv="`guix build guile-bootstrap -d`"
|
||||||
out="`guix build guile-bootstrap`"
|
out="`guix build guile-bootstrap`"
|
||||||
|
|
Loading…
Reference in a new issue