summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-14 17:16:10 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-14 17:16:10 +0100
commit11e7a6cf4612b83f3fe3ecfcce3e7c0b21ecf953 (patch)
tree929ef045e3f5be4e938a58b09d700052afe142e9 /guix
parent1a8ea0a1885ca5fff85eb00fc79d6c6bcd47818a (diff)
store: Add 'hash-part->path'.
* guix/store.scm (hash-part->path): New procedure. * tests/store.scm ("hash-part->path"): New test.
Diffstat (limited to 'guix')
-rw-r--r--guix/store.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 909ef195de..58f7e36762 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -57,6 +57,7 @@
set-build-options
valid-path?
query-path-hash
+ hash-part->path
add-text-to-store
add-to-store
build-derivations
@@ -501,6 +502,18 @@ encoding conversion errors."
"Return the SHA256 hash of PATH as a bytevector."
base16)
+(define hash-part->path
+ (let ((query-path-from-hash-part
+ (operation (query-path-from-hash-part (string hash))
+ #f
+ store-path)))
+ (lambda (server hash-part)
+ "Return the store path whose hash part is HASH-PART (a nix-base32
+string). Raise an error if no such path exists."
+ ;; This RPC is primarily used by Hydra to reply to HTTP GETs of
+ ;; /HASH.narinfo.
+ (query-path-from-hash-part server hash-part))))
+
(define add-text-to-store
;; A memoizing version of `add-to-store', to avoid repeated RPCs with
;; the very same arguments during a given session.