summaryrefslogtreecommitdiff
path: root/guix/scripts/system.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
commit706ae8e15c8d36b0aee7c19c54c143d3e17f5784 (patch)
treee9fe8ebfb1417d30979b5413165599f066a1c504 /guix/scripts/system.scm
parent3e95125e9bd0676d4a9add9105217ad3eaef3ff0 (diff)
parent8440db459a10daa24282038f35bc0b6771bd51ab (diff)
downloadguix-patches-706ae8e15c8d36b0aee7c19c54c143d3e17f5784.tar
guix-patches-706ae8e15c8d36b0aee7c19c54c143d3e17f5784.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/system.scm')
-rw-r--r--guix/scripts/system.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 14aedceac1..69bd05b516 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -126,7 +126,11 @@ REFERENCES as its set of references."
;; Remove DEST if it exists to make sure that (1) we do not fail badly
;; while trying to overwrite it (see <http://bugs.gnu.org/20722>), and
;; (2) we end up with the right contents.
- (when (file-exists? dest)
+ (when (false-if-exception (lstat dest))
+ (for-each make-file-writable
+ (find-files dest (lambda (file stat)
+ (eq? 'directory (stat:type stat)))
+ #:directories? #t))
(delete-file-recursively dest))
(copy-recursively item dest
@@ -148,12 +152,18 @@ REFERENCES as its set of references."
"Copy ITEM and all its dependencies to the store under root directory
TARGET, and register them."
(mlet* %store-monad ((to-copy (topologically-sorted* (list item)))
- (refs (mapm %store-monad references* to-copy)))
+ (refs (mapm %store-monad references* to-copy))
+ (info (mapm %store-monad query-path-info*
+ (delete-duplicates
+ (append to-copy (concatenate refs)))))
+ (size -> (reduce + 0 (map path-info-nar-size info))))
(define progress-bar
(progress-reporter/bar (length to-copy)
(format #f (G_ "copying to '~a'...")
target)))
+ (check-available-space size target)
+
(call-with-progress-reporter progress-bar
(lambda (report)
(let ((void (%make-void-port "w")))