From 63193ebfdc72eb11cfb1c50b8cd5dfc49d01361d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 3 Feb 2013 23:02:14 +0100 Subject: [PATCH] store: Update to protocol 1.12. * guix/store.scm (%protocol-version): Bump. (operation-id): Comment out `query-substitutable-path-info'. Rename `query-valid-paths' to `query-all-valid-paths'. Add `query-path-from-hash-part', `query-substitutable-path-infos', `query-valid-paths', and `query-substitutable-paths'. (set-build-options): Add `binary-caches' keyword parameter. When using a server >= 1.12, send the list of binary caches. (query-path-hash): Use the `store-path' type, for clarity. --- guix/store.scm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/guix/store.scm b/guix/store.scm index 4bb2270a59..0a6285deac 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -66,7 +66,7 @@ derivation-path? store-path-package-name)) -(define %protocol-version #x10b) +(define %protocol-version #x10c) (define %worker-magic-1 #x6e697863) (define %worker-magic-2 #x6478696f) @@ -103,14 +103,18 @@ (query-deriver 18) (set-options 19) (collect-garbage 20) - (query-substitutable-path-info 21) + ;;(query-substitutable-path-info 21) ; obsolete as of #x10c (query-derivation-outputs 22) - (query-valid-paths 23) + (query-all-valid-paths 23) (query-failed-paths 24) (clear-failed-paths 25) (query-path-info 26) (import-paths 27) - (query-derivation-output-names 28)) + (query-derivation-output-names 28) + (query-path-from-hash-part 29) + (query-substitutable-path-infos 30) + (query-valid-paths 31) + (query-substitutable-paths 32)) (define-enumerate-type hash-algo ;; hash.hh @@ -423,7 +427,8 @@ encoding conversion errors." (log-type 0) (print-build-trace #t) (build-cores 1) - (use-substitutes? #t)) + (use-substitutes? #t) + (binary-caches '())) ; client "untrusted" cache URLs ;; Must be called after `open-connection'. (define socket @@ -447,6 +452,13 @@ encoding conversion errors." (send (integer build-cores))) (if (>= (nix-server-minor-version server) 10) (send (boolean use-substitutes?))) + (if (>= (nix-server-minor-version server) 12) + (send (string-list (fold-right (lambda (pair result) + (match pair + ((h . t) + (cons* h t result)))) + '() + binary-caches)))) (let loop ((done? (process-stderr server))) (or done? (process-stderr server))))) @@ -474,7 +486,7 @@ encoding conversion errors." "Return #t when PATH is a valid store path." boolean) -(define-operation (query-path-hash (string path)) +(define-operation (query-path-hash (store-path path)) "Return the SHA256 hash of PATH as a bytevector." base16)