summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-01 00:09:47 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-01 00:09:47 +0200
commite036c31bc607ec1be8037294bdfd90723f3458a8 (patch)
treedd251fba9d51d7af5f4e795652ceb26cd6a6798f
parent6b1891b0a174f0fcbf26d4f404d3c2b4c63eb3e2 (diff)
downloadguix-e036c31bc607ec1be8037294bdfd90723f3458a8.tar.gz
Add missing `set-build-options' parameters.
* guix/store.scm (set-build-options)[build-cores, use-substitutes?]: New
  keyword parameters.
  [send]: Change to expect a type, and use `write-arg'.
  Send settings for BUILD-CORES and USE-SUBSTITUTES? when the server
  supports it.
-rw-r--r--guix/store.scm34
1 files changed, 18 insertions, 16 deletions
diff --git a/guix/store.scm b/guix/store.scm
index e00282ad8a..1ecb2cc359 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -331,30 +331,32 @@ again until #t is returned or an error is raised."
                             (use-build-hook? #t)
                             (build-verbosity 0)
                             (log-type 0)
-                            (print-build-trace #t))
+                            (print-build-trace #t)
+                            (build-cores 1)
+                            (use-substitutes? #t))
   ;; Must be called after `open-connection'.
 
   (define socket
     (nix-server-socket server))
 
   (let-syntax ((send (syntax-rules ()
-                       ((_ option ...)
-                        (for-each (lambda (i)
-                                    (cond ((boolean? i)
-                                           (write-int (if i 1 0) socket))
-                                          ((integer? i)
-                                           (write-int i socket))
-                                          (else
-                                           (error "invalid build option"
-                                                  i))))
-                                  (list option ...))))))
-    (send (operation-id set-options)
-          keep-failed? keep-going? try-fallback? verbosity
-          max-build-jobs max-silent-time)
+                       ((_ (type option) ...)
+                        (begin
+                          (write-arg type option socket)
+                          ...)))))
+    (write-int (operation-id set-options) socket)
+    (send (boolean keep-failed?) (boolean keep-going?)
+          (boolean try-fallback?) (integer verbosity)
+          (integer max-build-jobs) (integer max-silent-time))
     (if (>= (nix-server-minor-version server) 2)
-        (send use-build-hook?))
+        (send (boolean use-build-hook?)))
     (if (>= (nix-server-minor-version server) 4)
-        (send build-verbosity log-type print-build-trace))
+        (send (integer build-verbosity) (integer log-type)
+              (boolean print-build-trace)))
+    (if (>= (nix-server-minor-version server) 6)
+        (send (integer build-cores)))
+    (if (>= (nix-server-minor-version server) 10)
+        (send (boolean use-substitutes?)))
     (let loop ((done? (process-stderr server)))
       (or done? (process-stderr server)))))