* guix/scripts/build.scm (set-build-options-from-command-line): use
make-schedule-sane to parse and set "scheduling" options.
---
guix/scripts/build.scm | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index d10b95b..31f17d2 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -20,6 +20,7 @@
(define-module (guix scripts build)
#:use-module (guix ui)
#:use-module (guix store)
+ #:use-module (guix schedule)
#:use-module (guix derivations)
#:use-module (guix packages)
#:use-module (guix utils)
@@ -127,16 +128,19 @@ options handled by
'set-build-options-from-command-line', and listed in
"Given OPTS, an alist as returned by 'args-fold' given
'%standard-build-options', set the corresponding build options on STORE."
;; TODO: Add more options.
- (set-build-options store
- #:keep-failed? (assoc-ref opts 'keep-failed?)
- #:build-cores (or (assoc-ref opts 'cores) 0)
- #:fallback? (assoc-ref opts 'fallback?)
- #:use-substitutes? (assoc-ref opts 'substitutes?)
- #:use-build-hook? (assoc-ref opts 'build-hook?)
- #:max-silent-time (assoc-ref opts 'max-silent-time)
- #:timeout (assoc-ref opts 'timeout)
- #:print-build-trace (assoc-ref opts 'print-build-trace?)
- #:verbosity (assoc-ref opts 'verbosity)))
+ (let ((sched (make-schedule-sane #:max-cores (assoc-ref opts 'cores)
+ #:max-jobs (assoc-ref opts 'max-jobs))))
+ (set-build-options store
+ #:keep-failed? (assoc-ref opts 'keep-failed?)
+ #:build-cores (schedule-max-cores sched)
+ #:max-build-jobs (schedule-max-jobs sched)
+ #:fallback? (assoc-ref opts 'fallback?)
+ #:use-substitutes? (assoc-ref opts 'substitutes?)
+ #:use-build-hook? (assoc-ref opts 'build-hook?)
+ #:max-silent-time (assoc-ref opts 'max-silent-time)
+ #:timeout (assoc-ref opts 'timeout)
+ #:print-build-trace (assoc-ref opts 'print-build-trace?)
+ #:verbosity (assoc-ref opts 'verbosity))))

(define %standard-build-options
;; List of standard command-line options for tools that build something.
-- 
2.1.2

Reply via email to