guix build: Add '--repair'.

* guix/scripts/build.scm (show-help, %options): Add '--repair'.
* doc/guix.texi (Invoking guix gc): Mention 'guix build --repair'.
(Additional Build Options): Document it.
This commit is contained in:
Ludovic Courtès 2017-01-15 22:28:24 +01:00
parent abdc5f345c
commit 6da5bb7b1b
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 20 additions and 1 deletions

View File

@ -2274,11 +2274,14 @@ traverses @emph{all the files in the store}, this command can take a
long time, especially on systems with a slow disk drive. long time, especially on systems with a slow disk drive.
@cindex repairing the store @cindex repairing the store
@cindex corruption, recovering from
Using @option{--verify=repair} or @option{--verify=contents,repair} Using @option{--verify=repair} or @option{--verify=contents,repair}
causes the daemon to try to repair corrupt store items by fetching causes the daemon to try to repair corrupt store items by fetching
substitutes for them (@pxref{Substitutes}). Because repairing is not substitutes for them (@pxref{Substitutes}). Because repairing is not
atomic, and thus potentially dangerous, it is available only to the atomic, and thus potentially dangerous, it is available only to the
system administrator. system administrator. A lightweight alternative, when you know exactly
which items in the store are corrupt, is @command{guix build --repair}
(@pxref{Invoking guix build}).
@item --optimize @item --optimize
@cindex deduplication @cindex deduplication
@ -4859,6 +4862,14 @@ When used in conjunction with @option{--keep-failed}, the differing
output is kept in the store, under @file{/gnu/store/@dots{}-check}. output is kept in the store, under @file{/gnu/store/@dots{}-check}.
This makes it easy to look for differences between the two results. This makes it easy to look for differences between the two results.
@item --repair
@cindex repairing store items
@cindex corruption, recovering from
Attempt to repair the specified store items, if they are corrupt, by
re-downloading or rebuilding them.
This operation is not atomic and thus restricted to @code{root}.
@item --derivations @item --derivations
@itemx -d @itemx -d
Return the derivation paths, not the output paths, of the given Return the derivation paths, not the output paths, of the given

View File

@ -485,6 +485,8 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n"))
-d, --derivations return the derivation paths of the given packages")) -d, --derivations return the derivation paths of the given packages"))
(display (_ " (display (_ "
--check rebuild items to check for non-determinism issues")) --check rebuild items to check for non-determinism issues"))
(display (_ "
--repair repair the specified items"))
(display (_ " (display (_ "
-r, --root=FILE make FILE a symlink to the result, and register it -r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root")) as a garbage collector root"))
@ -535,6 +537,12 @@ must be one of 'package', 'all', or 'transitive'~%")
(alist-cons 'build-mode (build-mode check) (alist-cons 'build-mode (build-mode check)
result) result)
rest))) rest)))
(option '("repair") #f #f
(lambda (opt name arg result . rest)
(apply values
(alist-cons 'build-mode (build-mode repair)
result)
rest)))
(option '(#\s "system") #t #f (option '(#\s "system") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'system arg (alist-cons 'system arg