From 10b135cef54348e48805bd9c64b463c465c65eb5 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 31 Jul 2020 16:49:28 +0200 Subject: system: image: Add image-type support. * gnu/system/image.scm (image-with-os): New macro. Rename the old "image-with-os" procedure to ... (image-with-os*): ... this new procedure, (system-image): adapt according, (raw-image-type, iso-image-type, uncompressed-iso-image-type %image-types): new variables, (lookup-image-type-by-name): new procedure. (find-image): remove it. * gnu/system/images/hurd.scm (hurd-image-type): New variable, use it to define ... (hurd-disk-image): ... this variable, using "os->image" procedure. * gnu/tests/install.scm (run-install): Rename installation-disk-image-file-system-type parameter to installation-image-type, use os->config instead of find-image to compute the image passed to system-image, (%test-iso-image-installer) adapt accordingly, (guided-installation-test): ditto. Signed-off-by: Mathieu Othacehe --- gnu/tests/install.scm | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 5b7f9bf671..dee2b870e8 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -218,7 +218,7 @@ (define* (run-install target-os target-os-source #:imported-modules '((gnu services herd) (gnu installer tests) (guix combinators)))) - (installation-disk-image-file-system-type "ext4") + (installation-image-type 'raw) (install-size 'guess) (target-size (* 2200 MiB))) "Run SCRIPT (a shell script following the system installation procedure) in @@ -228,10 +228,6 @@ (define* (run-install target-os target-os-source (mlet* %store-monad ((_ (set-grafting #f)) (system (current-system)) - (target (current-target-system)) - (base-image -> (find-image - installation-disk-image-file-system-type - target)) ;; Since the installation system has no network access, ;; we cheat a little bit by adding TARGET to its GC @@ -239,18 +235,20 @@ (define* (run-install target-os target-os-source ;; succeed. Also add guile-final, which is pulled in ;; through provenance.drv and may not always be present. (target (operating-system-derivation target-os)) + (base-image -> + (os->image + (operating-system-with-gc-roots + os (list target guile-final)) + #:type (lookup-image-type-by-name + installation-image-type))) (image -> - (system-image - (image - (inherit base-image) - (size install-size) - (operating-system - (operating-system-with-gc-roots - os (list target guile-final))) - ;; Do not compress to speed-up the tests. - (compression? #f) - ;; Don't provide substitutes; too big. - (substitutable? #f))))) + (system-image + (image + (inherit base-image) + (size install-size) + + ;; Don't provide substitutes; too big. + (substitutable? #f))))) (define install (with-imported-modules '((guix build utils) (gnu build marionette)) @@ -270,16 +268,16 @@ (define marionette "-no-reboot" "-m" "1200" #$@(cond - ((string=? "ext4" installation-disk-image-file-system-type) + ((eq? 'raw installation-image-type) #~("-drive" ,(string-append "file=" #$image ",if=virtio,readonly"))) - ((string=? "iso9660" installation-disk-image-file-system-type) + ((eq? 'uncompressed-iso9660 installation-image-type) #~("-cdrom" #$image)) (else (error - "unsupported installation-disk-image-file-system-type:" - installation-disk-image-file-system-type))) + "unsupported installation-image-type:" + installation-image-type))) "-drive" ,(string-append "file=" #$output ",if=virtio") ,@(if (file-exists? "/dev/kvm") @@ -443,8 +441,8 @@ (define %test-iso-image-installer %minimal-os-on-vda-source #:script %simple-installation-script-for-/dev/vda - #:installation-disk-image-file-system-type - "iso9660")) + #:installation-image-type + 'uncompressed-iso9660)) (command (qemu-command/writable-image image))) (run-basic-test %minimal-os-on-vda command name))))) @@ -1309,8 +1307,8 @@ (define* (guided-installation-test name #:os installation-os-for-gui-tests #:install-size install-size #:target-size target-size - #:installation-disk-image-file-system-type - "iso9660" + #:installation-image-type + 'uncompressed-iso9660 #:gui-test (lambda (marionette) (gui-test-program -- cgit v1.2.3