store: Add 'query-path-info*'.
* guix/scripts/size.scm (query-path-info*): Move to... * guix/store.scm (query-path-info*): ... here.
This commit is contained in:
		
							parent
							
								
									24420f5ffa
								
							
						
					
					
						commit
						0744a9f002
					
				
					 2 changed files with 11 additions and 10 deletions
				
			
		| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
;;; GNU Guix --- Functional package management for GNU
 | 
					;;; GNU Guix --- Functional package management for GNU
 | 
				
			||||||
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 | 
					;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; This file is part of GNU Guix.
 | 
					;;; This file is part of GNU Guix.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
| 
						 | 
					@ -53,15 +53,6 @@
 | 
				
			||||||
(define substitutable-path-info*
 | 
					(define substitutable-path-info*
 | 
				
			||||||
  (store-lift substitutable-path-info))
 | 
					  (store-lift substitutable-path-info))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(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 (file-size item)
 | 
					(define (file-size item)
 | 
				
			||||||
  "Return the size in bytes of ITEM, resorting to information from substitutes
 | 
					  "Return the size in bytes of ITEM, resorting to information from substitutes
 | 
				
			||||||
if ITEM is not in the store."
 | 
					if ITEM is not in the store."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +107,7 @@
 | 
				
			||||||
            references
 | 
					            references
 | 
				
			||||||
            references/substitutes
 | 
					            references/substitutes
 | 
				
			||||||
            references*
 | 
					            references*
 | 
				
			||||||
 | 
					            query-path-info*
 | 
				
			||||||
            requisites
 | 
					            requisites
 | 
				
			||||||
            referrers
 | 
					            referrers
 | 
				
			||||||
            optimize-store
 | 
					            optimize-store
 | 
				
			||||||
| 
						 | 
					@ -1398,6 +1399,15 @@ where FILE is the entry's absolute file name and STAT is the result of
 | 
				
			||||||
(define references*
 | 
					(define references*
 | 
				
			||||||
  (store-lift 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)
 | 
					(define-inlinable (current-system)
 | 
				
			||||||
  ;; Consult the %CURRENT-SYSTEM fluid at bind time.  This is equivalent to
 | 
					  ;; Consult the %CURRENT-SYSTEM fluid at bind time.  This is equivalent to
 | 
				
			||||||
  ;; (lift0 %current-system %store-monad), but inlinable, thus avoiding
 | 
					  ;; (lift0 %current-system %store-monad), but inlinable, thus avoiding
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue