guix-commits
[Top][All Lists]
Advanced

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

02/02: mapped-devices: raid-device-mapping: Avoid non-top-level 'use-mod


From: Ludovic Courtès
Subject: 02/02: mapped-devices: raid-device-mapping: Avoid non-top-level 'use-modules'.
Date: Tue, 2 Aug 2016 22:09:19 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 10618627bfe210f4ec84ab3018f12840704a11e0
Author: Ludovic Courtès <address@hidden>
Date:   Wed Aug 3 00:07:06 2016 +0200

    mapped-devices: raid-device-mapping: Avoid non-top-level 'use-modules'.
    
    Fixes <http://bugs.gnu.org/24135>.
    Reported by myglc2 <address@hidden>.
    
    * gnu/system/mapped-devices.scm (open-raid-device): Avoid non-top-level
    'use-modules' form.
---
 gnu/system/mapped-devices.scm |   37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm
index ce0a78a..7b91fcf 100644
--- a/gnu/system/mapped-devices.scm
+++ b/gnu/system/mapped-devices.scm
@@ -131,23 +131,26 @@
 (define (open-raid-device sources target)
   "Return a gexp that assembles SOURCES (a list of devices) to the RAID device
 TARGET (e.g., \"/dev/md0\"), using 'mdadm'."
-  #~(begin
-      (use-modules (srfi srfi-1) (ice-9 format))
-
-      (let ((sources '#$sources))
-        (let loop ((attempts 0))
-          (unless (every file-exists? sources)
-            (when (> attempts 20)
-              (error "RAID devices did not show up; bailing out"
-                     sources))
-
-            (format #t "waiting for RAID source devices~{ ~a~}...~%"
-                    sources)
-            (sleep 1)
-            (loop (+ 1 attempts))))
-
-        (zero? (system* (string-append #$mdadm "/sbin/mdadm")
-                        "--assemble" #$target sources)))))
+  #~(let ((sources '#$sources)
+
+          ;; XXX: We're not at the top level here.  We could use a
+          ;; non-top-level 'use-modules' form but that doesn't work when the
+          ;; code is eval'd, like the Shepherd does.
+          (every   (@ (srfi srfi-1) every))
+          (format  (@ (ice-9 format) format)))
+      (let loop ((attempts 0))
+        (unless (every file-exists? sources)
+          (when (> attempts 20)
+            (error "RAID devices did not show up; bailing out"
+                   sources))
+
+          (format #t "waiting for RAID source devices~{ ~a~}...~%"
+                  sources)
+          (sleep 1)
+          (loop (+ 1 attempts))))
+
+      (zero? (system* (string-append #$mdadm "/sbin/mdadm")
+                      "--assemble" #$target sources))))
 
 (define (close-raid-device sources target)
   "Return a gexp that stops the RAID device TARGET."



reply via email to

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