build, package: Add `--fallback' option.

* guix/scripts/build.scm (%options, show-help): Add `--fallback'.
  (guix-build): Call `set-build-options' with #:fallback?.
* guix/scripts/package.scm (%options, show-help): Add `--fallback'.
  (guix-package): Call `set-build-options' with #:fallback?.
* doc/guix.texi (Invoking guix package, Invoking guix build): Document
  `--fallback'.
This commit is contained in:
Ludovic Courtès 2013-05-29 23:08:06 +02:00
parent c3eb878f0b
commit 56b1f4b780
3 changed files with 22 additions and 0 deletions

View file

@ -595,6 +595,10 @@ Use @var{profile} instead of the user's default profile.
@itemx -n @itemx -n
Show what would be done without actually doing it. Show what would be done without actually doing it.
@item --fallback
When substituting a pre-built binary fails, fall back to building
packages locally.
@item --no-substitutes @item --no-substitutes
@itemx --max-silent-time=@var{seconds} @itemx --max-silent-time=@var{seconds}
Same as for @command{guix build} (@pxref{Invoking guix build}). Same as for @command{guix build} (@pxref{Invoking guix build}).
@ -1219,6 +1223,10 @@ the end of the build log. This is useful when debugging build issues.
@itemx -n @itemx -n
Do not build the derivations. Do not build the derivations.
@item --fallback
When substituting a pre-built binary fails, fall back to building
packages locally.
@item --no-substitutes @item --no-substitutes
Build instead of resorting to pre-built substitutes. Build instead of resorting to pre-built substitutes.

View file

@ -81,6 +81,8 @@ (define (show-help)
-K, --keep-failed keep build tree of failed builds")) -K, --keep-failed keep build tree of failed builds"))
(display (_ " (display (_ "
-n, --dry-run do not build the derivations")) -n, --dry-run do not build the derivations"))
(display (_ "
--fallback fall back to building when the substituter fails"))
(display (_ " (display (_ "
--no-substitutes build instead of resorting to pre-built substitutes")) --no-substitutes build instead of resorting to pre-built substitutes"))
(display (_ " (display (_ "
@ -140,6 +142,10 @@ (define %options
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t result))) (alist-cons 'dry-run? #t result)))
(option '("fallback") #f #f
(lambda (opt name arg result)
(alist-cons 'fallback? #t
(alist-delete 'fallback? result))))
(option '("no-substitutes") #f #f (option '("no-substitutes") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'substitutes? #f (alist-cons 'substitutes? #f
@ -267,6 +273,7 @@ (define package->derivation
(set-build-options (%store) (set-build-options (%store)
#:keep-failed? (assoc-ref opts 'keep-failed?) #:keep-failed? (assoc-ref opts 'keep-failed?)
#:build-cores (or (assoc-ref opts 'cores) 0) #:build-cores (or (assoc-ref opts 'cores) 0)
#:fallback? (assoc-ref opts 'fallback?)
#:use-substitutes? (assoc-ref opts 'substitutes?) #:use-substitutes? (assoc-ref opts 'substitutes?)
#:max-silent-time (assoc-ref opts 'max-silent-time) #:max-silent-time (assoc-ref opts 'max-silent-time)
#:verbosity (assoc-ref opts 'verbosity)) #:verbosity (assoc-ref opts 'verbosity))

View file

@ -437,6 +437,8 @@ (define (show-help)
-p, --profile=PROFILE use PROFILE instead of the user's default profile")) -p, --profile=PROFILE use PROFILE instead of the user's default profile"))
(display (_ " (display (_ "
-n, --dry-run show what would be done without actually doing it")) -n, --dry-run show what would be done without actually doing it"))
(display (_ "
--fallback fall back to building when the substituter fails"))
(display (_ " (display (_ "
--no-substitutes build instead of resorting to pre-built substitutes")) --no-substitutes build instead of resorting to pre-built substitutes"))
(display (_ " (display (_ "
@ -499,6 +501,10 @@ (define %options
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t result))) (alist-cons 'dry-run? #t result)))
(option '("fallback") #f #f
(lambda (opt name arg result)
(alist-cons 'fallback? #t
(alist-delete 'fallback? result))))
(option '("no-substitutes") #f #f (option '("no-substitutes") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'substitutes? #f (alist-cons 'substitutes? #f
@ -909,6 +915,7 @@ (define (process-query opts)
(with-error-handling (with-error-handling
(parameterize ((%store (open-connection))) (parameterize ((%store (open-connection)))
(set-build-options (%store) (set-build-options (%store)
#:fallback? (assoc-ref opts 'fallback?)
#:use-substitutes? #:use-substitutes?
(assoc-ref opts 'substitutes?) (assoc-ref opts 'substitutes?)
#:max-silent-time #:max-silent-time