aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts/gc.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-06 18:56:04 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-06 19:05:56 +0200
commit7770aafc7561897ff1d3c706420f76843c5182c0 (patch)
tree1203a1451e93d9e89643966810e01523442d1a22 /guix/scripts/gc.scm
parentc63d94035f7cff02d885f9deaaf4011d52a1151d (diff)
downloadgnu-guix-7770aafc7561897ff1d3c706420f76843c5182c0.tar
gnu-guix-7770aafc7561897ff1d3c706420f76843c5182c0.tar.gz
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.
Diffstat (limited to 'guix/scripts/gc.scm')
-rw-r--r--guix/scripts/gc.scm22
1 files changed, 22 insertions, 0 deletions
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
@@ -58,6 +58,11 @@ Invoke the garbage collector.\n"))
--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 (_ "
-V, --version display version information and exit"))
@@ -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)))