summaryrefslogtreecommitdiff
path: root/guix/store.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/store.scm')
-rw-r--r--guix/store.scm53
1 files changed, 43 insertions, 10 deletions
diff --git a/guix/store.scm b/guix/store.scm
index f88cdefe87..7785a53aa1 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -50,9 +50,11 @@
%default-substitute-urls
nix-server?
+ nix-server-version
nix-server-major-version
nix-server-minor-version
nix-server-socket
+ current-store-protocol-version ;for internal use
&nix-error nix-error?
&nix-connection-error nix-connection-error?
@@ -152,7 +154,7 @@
direct-store-path
log-file))
-(define %protocol-version #x161)
+(define %protocol-version #x162)
(define %worker-magic-1 #x6e697863) ; "nixc"
(define %worker-magic-2 #x6478696f) ; "dxio"
@@ -161,6 +163,8 @@
(logand magic #xff00))
(define (protocol-minor magic)
(logand magic #x00ff))
+(define (protocol-version major minor)
+ (logior major minor))
(define-syntax define-enumerate-type
(syntax-rules ()
@@ -540,6 +544,11 @@ connection. Use with care."
(make-hash-table 100)
(make-hash-table 100))))
+(define (nix-server-version store)
+ "Return the protocol version of STORE as an integer."
+ (protocol-version (nix-server-major-version store)
+ (nix-server-minor-version store)))
+
(define (write-buffered-output server)
"Flush SERVER's output port."
(force-output (nix-server-output-port server))
@@ -556,10 +565,20 @@ automatically close the store when the dynamic extent of EXP is left."
(dynamic-wind
(const #f)
(lambda ()
- exp ...)
+ (parameterize ((current-store-protocol-version
+ (nix-server-version store)))
+ exp) ...)
(lambda ()
(false-if-exception (close-connection store))))))
+(define current-store-protocol-version
+ ;; Protocol version of the store currently used. XXX: This is a hack to
+ ;; communicate the protocol version to the build output port. It's a hack
+ ;; because it could be inaccurrate, for instance if there's code that
+ ;; manipulates several store connections at once; it works well for the
+ ;; purposes of (guix status) though.
+ (make-parameter #f))
+
(define current-build-output-port
;; The port where build output is sent.
(make-parameter (current-error-port)))
@@ -682,6 +701,13 @@ encoding conversion errors."
(build-verbosity 0)
(log-type 0)
(print-build-trace #t)
+
+ ;; When true, provide machine-readable "build
+ ;; traces" for use by (guix status). Old clients
+ ;; are unable to make sense, which is why it's
+ ;; disabled by default.
+ print-extended-build-trace?
+
build-cores
(use-substitutes? #t)
@@ -725,7 +751,12 @@ encoding conversion errors."
(when (>= (nix-server-minor-version server) 10)
(send (boolean use-substitutes?)))
(when (>= (nix-server-minor-version server) 12)
- (let ((pairs `(,@(if timeout
+ (let ((pairs `(;; This option is honored by 'guix substitute' et al.
+ ,@(if print-build-trace
+ `(("print-extended-build-trace"
+ . ,(if print-extended-build-trace? "1" "0")))
+ '())
+ ,@(if timeout
`(("build-timeout" . ,(number->string timeout)))
'())
,@(if max-silent-time
@@ -1064,13 +1095,15 @@ an arbitrary directory layout in the store without creating a derivation."
outputs, and return when the worker is done building them. Elements of THINGS
that are not derivations can only be substituted and not built locally.
Return #t on success."
- (if (>= (nix-server-minor-version store) 15)
- (build store things mode)
- (if (= mode (build-mode normal))
- (build/old store things)
- (raise (condition (&nix-protocol-error
- (message "unsupported build mode")
- (status 1)))))))))
+ (parameterize ((current-store-protocol-version
+ (nix-server-version store)))
+ (if (>= (nix-server-minor-version store) 15)
+ (build store things mode)
+ (if (= mode (build-mode normal))
+ (build/old store things)
+ (raise (condition (&nix-protocol-error
+ (message "unsupported build mode")
+ (status 1))))))))))
(define-operation (add-temp-root (store-path path))
"Make PATH a temporary root for the duration of the current session.