guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/06: ui: Make 'check-available-space' public.


From: Ludovic Courtès
Subject: 03/06: ui: Make 'check-available-space' public.
Date: Mon, 2 Jul 2018 18:39:20 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8120b23e51d8a21056cf982c6740234b8f858633
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jul 2 23:51:20 2018 +0200

    ui: Make 'check-available-space' public.
    
    * guix/ui.scm (check-available-space): Add optional 'directory'
    parameter, defaulting to (%store-prefix).  Honor it.  Make public.
---
 guix/ui.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 6996b7f..c1101eb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -87,6 +87,7 @@
             leave-on-EPIPE
             read/eval
             read/eval-package-expression
+            check-available-space
             location->string
             fill-paragraph
             %text-width
@@ -795,16 +796,17 @@ error."
                   (derivation->output-path derivation out-name)))
                (derivation-outputs derivation))))
 
-(define (check-available-space need)
-  "Make sure at least NEED bytes are available in the store.  Otherwise emit a
+(define* (check-available-space need
+                                #:optional (directory (%store-prefix)))
+  "Make sure at least NEED bytes are available in DIRECTORY.  Otherwise emit a
 warning."
   (let ((free (catch 'system-error
                 (lambda ()
-                  (free-disk-space (%store-prefix)))
+                  (free-disk-space directory))
                 (const #f))))
     (when (and free (>= need free))
       (warning (G_ "at least ~,1h MB needed but only ~,1h MB available in 
~a~%")
-               (/ need 1e6) (/ free 1e6) (%store-prefix)))))
+               (/ need 1e6) (/ free 1e6) directory))))
 
 (define* (show-what-to-build store drv
                              #:key dry-run? (use-substitutes? #t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]