From 7770aafc7561897ff1d3c706420f76843c5182c0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 6 Jun 2015 18:56:04 +0200 Subject: guix gc: Add '--verify'. * guix/scripts/gc.scm (show-help, %options): Add --verify. (guix-gc): Handle it. * doc/guix.texi (Invoking guix gc): Document --verify, and move --optimize description right below it. --- guix/scripts/gc.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'guix') diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index a250cdc197..6403893687 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -57,6 +57,11 @@ Invoke the garbage collector.\n")) (display (_ " --referrers list the referrers of PATHS")) (newline) + (display (_ " + --verify[=OPTS] verify the integrity of the store; OPTS is a + comma-separated combination of 'repair' and + 'contents'")) + (newline) (display (_ " -h, --help display this help and exit")) (display (_ " @@ -94,6 +99,17 @@ Invoke the garbage collector.\n")) (lambda (opt name arg result) (alist-cons 'action 'optimize (alist-delete 'action result)))) + (option '("verify") #f #t + (let ((not-comma (char-set-complement (char-set #\,)))) + (lambda (opt name arg result) + (let ((options (if arg + (map string->symbol + (string-tokenize arg not-comma)) + '()))) + (alist-cons 'action 'verify + (alist-cons 'verify-options options + (alist-delete 'action + result))))))) (option '("list-dead") #f #f (lambda (opt name arg result) (alist-cons 'action 'list-dead @@ -177,6 +193,12 @@ Invoke the garbage collector.\n")) (list-relatives referrers)) ((optimize) (optimize-store store)) + ((verify) + (let ((options (assoc-ref opts 'verify-options))) + (exit + (verify-store store + #:check-contents? (memq 'contents options) + #:repair? (memq 'repair options))))) ((list-dead) (for-each (cut simple-format #t "~a~%" <>) (dead-paths store))) -- cgit v1.2.3