summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/file-systems.scm4
-rw-r--r--gnu/build/marionette.scm27
-rw-r--r--gnu/build/svg.scm11
3 files changed, 32 insertions, 10 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 3dd7358fd3..3f97afeedd 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -499,8 +499,8 @@ were found."
 
   (match spec
     ((? string?)
-     ;; Nothing to do.
-     spec)
+     ;; Nothing to do, but wait until SPEC shows up.
+     (resolve identity spec identity))
     ((? file-system-label?)
      ;; Resolve the label.
      (resolve find-partition-by-label
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 173a67cef9..bb018fc9c1 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -26,6 +26,7 @@
             make-marionette
             marionette-eval
             wait-for-file
+            wait-for-tcp-port
             marionette-control
             marionette-screen-text
             wait-for-screen-text
@@ -187,6 +188,32 @@ FILE has not shown up after TIMEOUT seconds, raise an error."
     ('failure
      (error "file didn't show up" file))))
 
+(define* (wait-for-tcp-port port marionette
+                            #:key (timeout 20))
+  "Wait for up to TIMEOUT seconds for PORT to accept connections in
+MARIONETTE.  Raise an error on failure."
+  ;; Note: The 'connect' loop has to run within the guest because, when we
+  ;; forward ports to the host, connecting to the host never raises
+  ;; ECONNREFUSED.
+  (match (marionette-eval
+          `(begin
+             (let ((sock (socket PF_INET SOCK_STREAM 0)))
+               (let loop ((i 0))
+                 (catch 'system-error
+                   (lambda ()
+                     (connect sock AF_INET INADDR_LOOPBACK ,port)
+                     'success)
+                   (lambda args
+                     (if (< i ,timeout)
+                         (begin
+                           (sleep 1)
+                           (loop (+ 1 i)))
+                         'failure))))))
+          marionette)
+    ('success #t)
+    ('failure
+     (error "nobody's listening on port" port))))
+
 (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)
diff --git a/gnu/build/svg.scm b/gnu/build/svg.scm
index b5474ec4a0..6f1f4b3684 100644
--- a/gnu/build/svg.scm
+++ b/gnu/build/svg.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -18,16 +18,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu build svg)
+  #:use-module (rsvg)
+  #:use-module (cairo)
   #:use-module (srfi srfi-11)
   #:export (svg->png))
 
-;; We need Guile-RSVG and Guile-Cairo.  Load them lazily, at run time, to
-;; allow compilation to proceed.  See also <http://bugs.gnu.org/12202>.
-(module-autoload! (current-module)
-                  '(rsvg) '(rsvg-handle-new-from-file))
-(module-autoload! (current-module)
-                  '(cairo) '(cairo-image-surface-create))
-
 (define* (downscaled-surface surface
                              #:key
                              source-width source-height