[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] store: Add query-path-info operation.
From: |
David Thompson |
Subject: |
[PATCH 1/2] store: Add query-path-info operation. |
Date: |
Tue, 17 Mar 2015 11:00:59 -0400 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) |
>From e72bd43190bd561f7d96810a93f3b30f5f741343 Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
Date: Tue, 17 Mar 2015 10:19:36 -0400
Subject: [PATCH 1/2] store: Add query-path-info operation.
* guix/store.scm (<path-info>): New record type.
(read-path-info): New procedure.
(read-arg): Add 'path-info' syntax.
(query-path-info): New variable.
---
guix/store.scm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/guix/store.scm b/guix/store.scm
index a3f3cbf..8e1a180 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -60,6 +60,7 @@
valid-path?
query-path-hash
hash-part->path
+ query-path-info
add-text-to-store
add-to-store
build-things
@@ -79,6 +80,13 @@
substitutable-paths
substitutable-path-info
+ path-info?
+ path-info-deriver
+ path-info-hash
+ path-info-refs
+ path-info-reg-time
+ path-info-nar-size
+
references
requisites
referrers
@@ -212,6 +220,24 @@
(cons (substitutable path deriver refs dl-size nar-size)
result))))))
+;; Information about a store path.
+(define-record-type <path-info>
+ (path-info deriver hash refs reg-time nar-size)
+ path-info?
+ (deriver path-info-deriver)
+ (hash path-info-hash)
+ (refs path-info-refs)
+ (reg-time path-info-reg-time)
+ (nar-size path-info-nar-size))
+
+(define (read-path-info p)
+ (let ((deriver (read-store-path p))
+ (hash (base16-string->bytevector (read-string p)))
+ (refs (read-store-path-list p))
+ (reg-time (read-int p))
+ (nar-size (read-long-long p)))
+ (path-info deriver hash refs reg-time nar-size)))
+
(define-syntax write-arg
(syntax-rules (integer boolean file string string-list string-pairs
store-path store-path-list base16)
@@ -236,7 +262,7 @@
(define-syntax read-arg
(syntax-rules (integer boolean string store-path store-path-list
- substitutable-path-list base16)
+ substitutable-path-list path-info base16)
((_ integer p)
(read-int p))
((_ boolean p)
@@ -249,6 +275,8 @@
(read-store-path-list p))
((_ substitutable-path-list p)
(read-substitutable-path-list p))
+ ((_ path-info p)
+ (read-path-info p))
((_ base16 p)
(base16-string->bytevector (read-string p)))))
@@ -532,6 +560,10 @@ string). Raise an error if no such path exists."
;; /HASH.narinfo.
(query-path-from-hash-part server hash-part))))
+(define-operation (query-path-info (store-path path))
+ "Return the derivation store path for PATH."
+ path-info)
+
(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.
--
2.1.4
--
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate
- [PATCH 0/2] Add 'guix publish' command, David Thompson, 2015/03/17
- [PATCH 1/2] store: Add query-path-info operation.,
David Thompson <=
- [PATCH 2/2] scripts: Add 'publish' command., David Thompson, 2015/03/17
- Re: [PATCH 2/2] scripts: Add 'publish' command., Ludovic Courtès, 2015/03/18
- Re: [PATCH 2/2] scripts: Add 'publish' command., David Thompson, 2015/03/27
- Re: [PATCH 2/2] scripts: Add 'publish' command., Ludovic Courtès, 2015/03/27
- Re: [PATCH 2/2] scripts: Add 'publish' command., Mark H Weaver, 2015/03/29
- Re: [PATCH 2/2] scripts: Add 'publish' command., David Thompson, 2015/03/29
- Re: [PATCH 2/2] scripts: Add 'publish' command., Ludovic Courtès, 2015/03/30