guix-commits
[Top][All Lists]
Advanced

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

03/05: utils: Export 'parallel-job-count'.


From: Ludovic Courtès
Subject: 03/05: utils: Export 'parallel-job-count'.
Date: Sat, 22 Nov 2014 11:52:39 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit e6039b9c70c658d648723a2d331f1c9637b49126
Author: Ludovic Courtès <address@hidden>
Date:   Sat Nov 22 12:32:32 2014 +0100

    utils: Export 'parallel-job-count'.
    
    * guix/build/utils.scm (parallel-job-count): New procedure.
    * guix/build/gnu-build-system.scm (%parallel-job-count): Remove.
      (build, check): Use 'parallel-job-count' instead.
---
 guix/build/gnu-build-system.scm |   11 ++---------
 guix/build/utils.scm            |   10 ++++++++++
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 17fa7af..afed601 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -236,18 +236,11 @@ makefiles."
                   (string-append srcdir "/configure")
                   flags))))
 
-(define %parallel-job-count
-  ;; String to be passed next to GNU Make's `-j' argument.
-  (match (getenv "NIX_BUILD_CORES")
-    (#f "1")
-    ("0" (number->string (current-processor-count)))
-    (x x)))
-
 (define* (build #:key (make-flags '()) (parallel-build? #t)
                 #:allow-other-keys)
   (zero? (apply system* "make"
                 `(,@(if parallel-build?
-                        `("-j" ,%parallel-job-count)
+                        `("-j" ,(number->string (parallel-job-count)))
                         '())
                   ,@make-flags))))
 
@@ -257,7 +250,7 @@ makefiles."
   (if tests?
       (zero? (apply system* "make" test-target
                     `(,@(if parallel-tests?
-                            `("-j" ,%parallel-job-count)
+                            `("-j" ,(number->string (parallel-job-count)))
                             '())
                       ,@make-flags)))
       (begin
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index cda4fb1..bfbc4dd 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -31,6 +31,8 @@
   #:re-export (alist-cons
                alist-delete)
   #:export (%store-directory
+            parallel-job-count
+
             directory-exists?
             executable-file?
             call-with-ascii-input-file
@@ -69,6 +71,14 @@
   (or (getenv "NIX_STORE")
       "/gnu/store"))
 
+(define (parallel-job-count)
+  "Return the number of processes to be passed next to GNU Make's `-j'
+argument."
+  (match (getenv "NIX_BUILD_CORES")               ;set by the daemon
+    (#f  1)
+    ("0" (current-processor-count))
+    (x   (or (string->number x) 1))))
+
 (define (directory-exists? dir)
   "Return #t if DIR exists and is a directory."
   (let ((s (stat dir #f)))



reply via email to

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