(zilch nix daemon): Upgrade daemon version to 2.18-like
This is necessary for support with recent Lix. Change-Id: I6a6a69648db16e23ee82a5107cec858ccc06fb42
This commit is contained in:
parent
a80266d9d8
commit
e76c57a388
1 changed files with 30 additions and 20 deletions
|
|
@ -193,7 +193,7 @@
|
||||||
(set-daemon-link-protocol-minor! link protocol-minor)
|
(set-daemon-link-protocol-minor! link protocol-minor)
|
||||||
(unless (= worker-magic #x6478696f) (error "handshake: received wrong WORKER_MAGIC_2" worker-magic))
|
(unless (= worker-magic #x6478696f) (error "handshake: received wrong WORKER_MAGIC_2" worker-magic))
|
||||||
(unless (= protocol-major 1) (error "handshake: invalid major version protocol" protocol-major))
|
(unless (= protocol-major 1) (error "handshake: invalid major version protocol" protocol-major))
|
||||||
(daemon-write-u64 link #x121)
|
(daemon-write-u64 link #x123)
|
||||||
(daemon-write-u64 link 0) ; cpu affinity
|
(daemon-write-u64 link 0) ; cpu affinity
|
||||||
(daemon-write-u64 link 0)
|
(daemon-write-u64 link 0)
|
||||||
(daemon-flush link)
|
(daemon-flush link)
|
||||||
|
|
@ -202,6 +202,7 @@
|
||||||
(set! daemon-version (daemon-read-string link)))
|
(set! daemon-version (daemon-read-string link)))
|
||||||
(when (< protocol-minor #x20)
|
(when (< protocol-minor #x20)
|
||||||
(error (string-append "Nix daemon version " daemon-version " is too old!")))
|
(error (string-append "Nix daemon version " daemon-version " is too old!")))
|
||||||
|
(daemon-read-u64 link) ; trusted
|
||||||
(set-daemon-link-daemon-version! link daemon-version)
|
(set-daemon-link-daemon-version! link daemon-version)
|
||||||
(daemon-read-log-events link)
|
(daemon-read-log-events link)
|
||||||
(daemon-wop-set-options link))
|
(daemon-wop-set-options link))
|
||||||
|
|
@ -262,17 +263,40 @@
|
||||||
(daemon-read-log-events link)
|
(daemon-read-log-events link)
|
||||||
(daemon-read-u64 link)))
|
(daemon-read-u64 link)))
|
||||||
|
|
||||||
|
;; Process a framed sink.
|
||||||
|
;; `proc` will be called to provide the contents.
|
||||||
|
(define (handle-framed-sink link proc)
|
||||||
|
(define write-blob
|
||||||
|
(case-lambda
|
||||||
|
((bv) (daemon-write-u64 link (bytevector-length bv)) (write-bytevector bv (daemon-link-out-port link)))
|
||||||
|
((bv start) (daemon-write-u64 link (- (bytevector-length bv) start)) (write-bytevector bv (daemon-link-out-port link) start))
|
||||||
|
((bv start end) (daemon-write-u64 link (- end start)) (write-bytevector bv (daemon-link-out-port link) start end))))
|
||||||
|
|
||||||
|
(define data-thread
|
||||||
|
(make-thread
|
||||||
|
(lambda ()
|
||||||
|
(proc write-blob)
|
||||||
|
(daemon-write-u64 link 0) ; send an EOF
|
||||||
|
(daemon-flush link))))
|
||||||
|
(thread-start! data-thread)
|
||||||
|
(daemon-read-log-events link)
|
||||||
|
(thread-join! data-thread))
|
||||||
|
|
||||||
;; Write a simple text file to the store. `refs` is expected to be sorted.
|
;; Write a simple text file to the store. `refs` is expected to be sorted.
|
||||||
;; Returns the (string) store path at which the file has been created.
|
;; Returns the (string) store path at which the file has been created.
|
||||||
|
;; Actually calls `AddToStore` internally.
|
||||||
(define (daemon-wop-add-text-to-store link suffix s refs)
|
(define (daemon-wop-add-text-to-store link suffix s refs)
|
||||||
(daemon-write-u64 link 8)
|
(daemon-write-u64 link 7)
|
||||||
(daemon-write-string link suffix)
|
(daemon-write-string link suffix)
|
||||||
(daemon-write-string link s)
|
(daemon-write-string link "text:sha256")
|
||||||
(daemon-write-u64 link (length refs))
|
(daemon-write-u64 link (length refs))
|
||||||
(for-each (lambda (l) (daemon-write-string link l)) refs)
|
(for-each (lambda (l) (daemon-write-string link l)) refs)
|
||||||
|
(daemon-write-u64 link 0) ; repair flag
|
||||||
(daemon-flush link)
|
(daemon-flush link)
|
||||||
(daemon-read-log-events link)
|
(handle-framed-sink link (lambda (write-blob) (write-blob (string->utf8 s))))
|
||||||
(daemon-read-string link))
|
(define path (daemon-read-string link))
|
||||||
|
(daemon-read-valid-path-info link)
|
||||||
|
path)
|
||||||
|
|
||||||
;; Contains the information Nix stores about a valid store path.
|
;; Contains the information Nix stores about a valid store path.
|
||||||
(define-record-type <valid-path-info>
|
(define-record-type <valid-path-info>
|
||||||
|
|
@ -355,21 +379,7 @@
|
||||||
(daemon-write-u64 link 0) ; dontCheckSigs
|
(daemon-write-u64 link 0) ; dontCheckSigs
|
||||||
|
|
||||||
(daemon-flush link)
|
(daemon-flush link)
|
||||||
(define write-blob
|
(handle-framed-sink link proc))
|
||||||
(case-lambda
|
|
||||||
((bv) (daemon-write-u64 link (bytevector-length bv)) (write-bytevector bv (daemon-link-out-port link)))
|
|
||||||
((bv start) (daemon-write-u64 link (- (bytevector-length bv) start)) (write-bytevector bv (daemon-link-out-port link) start))
|
|
||||||
((bv start end) (daemon-write-u64 link (- end start)) (write-bytevector bv (daemon-link-out-port link) start end))))
|
|
||||||
|
|
||||||
(define data-thread
|
|
||||||
(make-thread
|
|
||||||
(lambda ()
|
|
||||||
(proc write-blob)
|
|
||||||
(daemon-write-u64 link 0) ; send an EOF
|
|
||||||
(daemon-flush link))))
|
|
||||||
(thread-start! data-thread)
|
|
||||||
(daemon-read-log-events link)
|
|
||||||
(thread-join! data-thread))
|
|
||||||
|
|
||||||
;; Requests an alist of output name to output store path for the derivation at `store-path`.
|
;; Requests an alist of output name to output store path for the derivation at `store-path`.
|
||||||
(define (daemon-wop-query-derivation-output-map link store-path)
|
(define (daemon-wop-query-derivation-output-map link store-path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue