image: Error out when passed an unsupported partition type.
authorLudovic Courtès <ludo@gnu.org>
Thu, 5 Nov 2020 13:56:16 +0000 (14:56 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 5 Nov 2020 15:13:50 +0000 (16:13 +0100)
* gnu/build/image.scm (make-partition-image): Use 'raise' instead of
'format' when TYPE is not supported.
(convert-disk-image): Remove unneeded 'begin'.

gnu/build/image.scm

index 8a2d0eb..640a784 100644 (file)
@@ -118,16 +118,16 @@ ROOT directory to populate the image."
      ((string=? type "vfat")
       (make-vfat-image partition target root))
      (else
-      (format (current-error-port)
-              "Unsupported partition type~%.")))))
+      (raise (condition
+              (&message
+               (message "unsupported partition type"))))))))
 
 (define (convert-disk-image image format output)
   "Convert IMAGE to OUTPUT according to the given FORMAT."
   (case format
     ((compressed-qcow2)
-     (begin
-       (invoke "qemu-img" "convert" "-c" "-f" "raw"
-               "-O" "qcow2" image output)))
+     (invoke "qemu-img" "convert" "-c" "-f" "raw"
+             "-O" "qcow2" image output))
     (else
      (copy-file image output))))