summaryrefslogtreecommitdiff
path: root/guix/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-02 23:50:38 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-03 00:39:10 +0200
commit0744a9f0029b2f78cc86b193214004b4501fa847 (patch)
tree5c063b17909770bd7b09be6bbca9debf99e7cac3 /guix/store.scm
parent24420f5ffabfbdbe913a5765e5c00e17de18fb4c (diff)
downloadgnu-guix-0744a9f0029b2f78cc86b193214004b4501fa847.tar
gnu-guix-0744a9f0029b2f78cc86b193214004b4501fa847.tar.gz
store: Add 'query-path-info*'.
* guix/scripts/size.scm (query-path-info*): Move to... * guix/store.scm (query-path-info*): ... here.
Diffstat (limited to 'guix/store.scm')
-rw-r--r--guix/store.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 3bf56573bf..bac42f2738 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -107,6 +107,7 @@
references
references/substitutes
references*
+ query-path-info*
requisites
referrers
optimize-store
@@ -1398,6 +1399,15 @@ where FILE is the entry's absolute file name and STAT is the result of
(define references*
(store-lift references))
+(define (query-path-info* item)
+ "Monadic version of 'query-path-info' that returns #f when ITEM is not in
+the store."
+ (lambda (store)
+ (guard (c ((nix-protocol-error? c)
+ ;; ITEM is not in the store; return #f.
+ (values #f store)))
+ (values (query-path-info store item) store))))
+
(define-inlinable (current-system)
;; Consult the %CURRENT-SYSTEM fluid at bind time. This is equivalent to
;; (lift0 %current-system %store-monad), but inlinable, thus avoiding