From mboxrd@z Thu Jan 1 00:00:00 1970 From: Deck Pickard Subject: [PATCH 4/4] guix build: Try to handle --cores and --max-jobs in a sane way. Date: Sat, 22 Nov 2014 23:35:54 +0100 Message-ID: References: <41991997306568388@unknownmsgid> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01494050390ad105087a2f23 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsJHZ-0006wl-9D for guix-devel@gnu.org; Sat, 22 Nov 2014 17:35:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsJHX-00047a-QC for guix-devel@gnu.org; Sat, 22 Nov 2014 17:35:57 -0500 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:53019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsJHX-00046T-G3 for guix-devel@gnu.org; Sat, 22 Nov 2014 17:35:55 -0500 Received: by mail-wi0-f182.google.com with SMTP id h11so2463053wiw.9 for ; Sat, 22 Nov 2014 14:35:54 -0800 (PST) In-Reply-To: <41991997306568388@unknownmsgid> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --089e01494050390ad105087a2f23 Content-Type: text/plain; charset=UTF-8 * 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 --089e01494050390ad105087a2f23 Content-Type: text/html; charset=UTF-8

* 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

--089e01494050390ad105087a2f23--