summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2017-06-18 02:36:51 -0400
committerMark H Weaver <mhw@netris.org>2017-06-18 02:36:51 -0400
commit9d4385634d098cc0fb35bfe58179f7d855352e39 (patch)
tree653cfd7a6faecaf42129b1aa47703e7bd01bc471 /gnu/build
parenta6aff3528c32cc921bddd78b254678a1fc121f21 (diff)
parent96fd87c96bd6987a967575aaa931c5a7b1c84e21 (diff)
downloadguix-9d4385634d098cc0fb35bfe58179f7d855352e39.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/file-systems.scm4
-rw-r--r--gnu/build/marionette.scm17
2 files changed, 20 insertions, 1 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 08f7d478ec..f9cc4088bb 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -419,6 +419,10 @@ warning and #f as the result."
                  #f)
                 ((= ENOMEDIUM errno)              ;for removable media
                  #f)
+                ((= EIO errno)                    ;unreadable hardware like audio CDs
+                 (format (current-error-port)
+                         "warning: failed to read from device '~a'~%" device)
+                 #f)
                 (else
                  (apply throw args))))))))
 
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 506d6da420..424f2b6713 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +25,7 @@
   #:export (marionette?
             make-marionette
             marionette-eval
+            wait-for-file
             marionette-control
             marionette-screen-text
             wait-for-screen-text
@@ -164,6 +165,20 @@ QEMU monitor and to the guest's backdoor REPL."
      (newline repl)
      (read repl))))
 
+(define* (wait-for-file file marionette #:key (timeout 10))
+  "Wait until FILE exists in MARIONETTE; 'read' its content and return it.  If
+FILE has not shown up after TIMEOUT seconds, raise an error."
+  (marionette-eval
+   `(let loop ((i ,timeout))
+      (cond ((file-exists? ,file)
+             (call-with-input-file ,file read))
+            ((> i 0)
+             (sleep 1)
+             (loop (- i 1)))
+            (else
+             (error "file didn't show up" ,file))))
+   marionette))
+
 (define (marionette-control command marionette)
   "Run COMMAND in the QEMU monitor of MARIONETTE.  COMMAND is a string such as
 \"sendkey ctrl-alt-f1\" or \"screendump foo.ppm\" (info \"(qemu-doc)