guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: guix build: Add '--max-jobs' option.


From: Ludovic Courtès
Subject: 02/02: guix build: Add '--max-jobs' option.
Date: Tue, 25 Nov 2014 21:37:54 +0000

civodul pushed a commit to branch master
in repository guix.

commit f6526eb330c6be9c20cf9486b59d7f9ea84ffda3
Author: Ludovic Courtès <address@hidden>
Date:   Tue Nov 25 22:32:26 2014 +0100

    guix build: Add '--max-jobs' option.
    
    Suggested by Deck Pickard <address@hidden>.
    
    * guix/scripts/build.scm (show-build-options-help): Document
      --max-jobs.
      (set-build-options-from-command-line): Pass #:max-build-jobs.
      (%standard-build-options): Add --max-jobs.
    * doc/guix.texi (Invoking guix-daemon): Document the meaning of
      '--max-jobs 0'.
      (Invoking guix build): Document --max-jobs, with a reference to
      "Invoking guix-daemon'.
---
 doc/guix.texi          |   10 +++++++++-
 guix/scripts/build.scm |   15 +++++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a88b774..fe1f8a8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -596,7 +596,9 @@ parallelism---for instance, by running @code{make 
-j$NIX_BUILD_CORES}.
 @item address@hidden
 @itemx -M @var{n}
 Allow at most @var{n} build jobs in parallel.  The default value is
address@hidden
address@hidden  Setting it to @code{0} means that no builds will be performed
+locally; instead, the daemon will offload builds (@pxref{Daemon Offload
+Setup}), or simply fail.
 
 @item --debug
 Produce debugging output.
@@ -2765,6 +2767,12 @@ may be helpful when debugging setup issues with the 
build daemon.
 Allow the use of up to @var{n} CPU cores for the build.  The special
 value @code{0} means to use as many CPU cores as available.
 
address@hidden address@hidden
address@hidden -M @var{n}
+Allow at most @var{n} build jobs in parallel.  @xref{Invoking
+guix-daemon, @code{--max-jobs}}, for details about this option and the
+equivalent @command{guix-daemon} option.
+
 @end table
 
 Behind the scenes, @command{guix build} is essentially an interface to
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 7b7f419..b4aa33b 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -119,7 +119,9 @@ options handled by 'set-build-options-from-command-line', 
and listed in
   (display (_ "
       --verbosity=LEVEL  use the given verbosity LEVEL"))
   (display (_ "
-  -c, --cores=N          allow the use of up to N CPU cores for the build")))
+  -c, --cores=N          allow the use of up to N CPU cores for the build"))
+  (display (_ "
+  -M, --max-jobs=N       allow at most N build jobs")))
 
 (define (set-build-options-from-command-line store opts)
   "Given OPTS, an alist as returned by 'args-fold' given
@@ -128,6 +130,7 @@ options handled by 'set-build-options-from-command-line', 
and listed in
   (set-build-options store
                      #:keep-failed? (assoc-ref opts 'keep-failed?)
                      #:build-cores (or (assoc-ref opts 'cores) 0)
+                     #:max-build-jobs (or (assoc-ref opts 'max-jobs) 1)
                      #:fallback? (assoc-ref opts 'fallback?)
                      #:use-substitutes? (assoc-ref opts 'substitutes?)
                      #:use-build-hook? (assoc-ref opts 'build-hook?)
@@ -192,7 +195,15 @@ options handled by 'set-build-options-from-command-line', 
and listed in
                   (let ((c (false-if-exception (string->number arg))))
                     (if c
                         (apply values (alist-cons 'cores c result) rest)
-                        (leave (_ "~a: not a number~%") arg)))))))
+                        (leave (_ "not a number: '~a' option argument: ~a~%")
+                               name arg)))))
+        (option '(#\M "max-jobs") #t #f
+                (lambda (opt name arg result . rest)
+                  (let ((c (false-if-exception (string->number arg))))
+                    (if c
+                        (apply values (alist-cons 'max-jobs c result) rest)
+                        (leave (_ "not a number: '~a' option argument: ~a~%")
+                               name arg)))))))
 
 
 ;;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]