summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-19 18:09:28 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-02-17 10:52:28 +0100
commitee2a5da80a9bda25542c00a7a35a9ddddcbd58af (patch)
treea578e04f14dad512d5f2bbc66aeedc463a3a94c5
parent43b2e440c38a39eb64088bd6c08771c060aa10fc (diff)
downloadguix-ee2a5da80a9bda25542c00a7a35a9ddddcbd58af.tar.gz
scripts: system: Remove 'vm-image' command.
Remove the 'vm-image' command that has been superseded by the 'image'
command.

* gnu/system/vm.scm (system-qemu-image): Remove it.
* guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image'
command as deprecated and use the image API to produce the VM image.
(perform-action, show-help): Adapt accordingly.
* tests/guix-system.sh: Ditto.
* doc/guix.texi (Invoking guix system,
Running Guix in a VM): Ditto.
* etc/completion/fish/guix.fish: Ditto.
* etc/completion/zsh/_guix: Ditto.
-rw-r--r--doc/guix.texi33
-rw-r--r--etc/completion/fish/guix.fish7
-rw-r--r--etc/completion/zsh/_guix2
-rw-r--r--gnu/system/vm.scm63
-rw-r--r--guix/scripts/system.scm24
-rw-r--r--tests/guix-system.sh2
6 files changed, 33 insertions, 98 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 942d5f93df..69897169bd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32575,8 +32575,7 @@ size of the image.
 
 @cindex System images, creation in various formats
 @cindex Creating system images in various formats
-@item vm-image
-@itemx image
+@item image
 @itemx docker-image
 Return a virtual machine, disk image, or Docker image of the operating
 system declared in @var{file} that stands alone.  By default,
@@ -32620,15 +32619,15 @@ the image to it using the following command:
 The @code{--list-image-types} command lists all the available image
 types.
 
-@cindex vm-image, creating virtual machine images
-When using @code{vm-image}, the returned image is in qcow2 format, which
-the QEMU emulator can efficiently use. @xref{Running Guix in a VM}, for
-more information on how to run the image in a virtual machine.  The
-@code{grub-bootloader} bootloader is always used independently of what
-is declared in the @code{operating-system} file passed as argument.
-This is to make it easier to work with QEMU, which uses the SeaBIOS BIOS
-by default, expecting a bootloader to be installed in the Master Boot
-Record (MBR).
+@cindex creating virtual machine images
+When using the @code{qcow2} image type, the returned image is in qcow2
+format, which the QEMU emulator can efficiently use. @xref{Running Guix
+in a VM}, for more information on how to run the image in a virtual
+machine.  The @code{grub-bootloader} bootloader is always used
+independently of what is declared in the @code{operating-system} file
+passed as argument.  This is to make it easier to work with QEMU, which
+uses the SeaBIOS BIOS by default, expecting a bootloader to be installed
+in the Master Boot Record (MBR).
 
 @cindex docker-image, creating docker images
 When using @code{docker-image}, a Docker image is produced.  Guix builds
@@ -32723,7 +32722,7 @@ create a virtual machine image that contains provenance information, you
 can run:
 
 @example
-guix system vm-image --save-provenance config.scm
+guix system image -t qcow2 --save-provenance config.scm
 @end example
 
 That way, the resulting image will effectively ``embed its own source''
@@ -32746,10 +32745,10 @@ When this option is omitted, @command{guix system} uses the
 for burning on CDs and DVDs.
 
 @item --image-size=@var{size}
-For the @code{vm-image} and @code{image} actions, create an image
-of the given @var{size}.  @var{size} may be a number of bytes, or it may
-include a unit as a suffix (@pxref{Block size, size specifications,,
-coreutils, GNU Coreutils}).
+For the @code{image} action, create an image of the given @var{size}.
+@var{size} may be a number of bytes, or it may include a unit as a
+suffix (@pxref{Block size, size specifications,, coreutils, GNU
+Coreutils}).
 
 When this option is omitted, @command{guix system} computes an estimate
 of the image size as a function of the size of the system declared in
@@ -33112,7 +33111,7 @@ If you built your own image, you must copy it out of the store
 before you can use it.  When invoking QEMU, you must choose a system
 emulator that is suitable for your hardware platform.  Here is a minimal
 QEMU invocation that will boot the result of @command{guix system
-vm-image} on x86_64 hardware:
+image -t qcow2} on x86_64 hardware:
 
 @example
 $ qemu-system-x86_64 \
diff --git a/etc/completion/fish/guix.fish b/etc/completion/fish/guix.fish
index 73bd176112..422baab4bb 100644
--- a/etc/completion/fish/guix.fish
+++ b/etc/completion/fish/guix.fish
@@ -133,7 +133,7 @@ complete -f -c guix -n '__fish_guix_using_command pull' -l url -d 'download the
 complete -f -c guix -n '__fish_guix_using_command pull' -l bootstrap -d 'use the bootstrap Guile to build the new Guix'
 
 #### system
-set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm vm-image disk-image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot
+set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot
 complete -f -c guix -n '__fish_guix_needs_command' -a system -d 'Build the operating system declared in FILE according to ACTION.'
 complete -f -c guix -n '__fish_guix_using_command system' -l reconfigure -d 'switch to a new operating system configuration'
 complete -f -c guix -n '__fish_guix_using_command system' -l roll-back -d 'switch to the previous operating system configuration'
@@ -142,8 +142,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -l list-generations -d
 complete -f -c guix -n '__fish_guix_using_command system' -l build -d 'build the operating system without installing anything'
 complete -f -c guix -n '__fish_guix_using_command system' -l container -d 'build a container that shares the host\'s store'
 complete -f -c guix -n '__fish_guix_using_command system' -l vm -d 'build a virtual machine image that shares the host\'s store'
-complete -f -c guix -n '__fish_guix_using_command system' -l vm-image -d 'build a freestanding virtual machine image'
-complete -f -c guix -n '__fish_guix_using_command system' -l disk-image -d 'build a disk image, suitable for a USB stick'
+complete -f -c guix -n '__fish_guix_using_command system' -l image -d 'build a disk image, suitable for a USB stick'
 complete -f -c guix -n '__fish_guix_using_command system' -l init -d 'initialize a root file system to run GNU'
 complete -f -c guix -n '__fish_guix_using_command system' -l extension-graph -d 'emit the service extension graph in Dot format'
 complete -f -c guix -n '__fish_guix_using_command system' -l shepherd-graph -d 'emit the graph of shepherd services in Dot format'
@@ -167,7 +166,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -s M -d 'allow at most
 complete -f -c guix -n '__fish_guix_using_command system' -a "--max-jobs=" -d 'allow at most N build jobs'
 complete -f -c guix -n '__fish_guix_using_command system' -s d -l derivation -d 'return the derivation of the given system'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--on-error=" -d 'apply STRATEGY when an error occurs while reading FILE'
-complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'vm-image\', produce an image of SIZE'
+complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'image\', produce an image of SIZE'
 complete -f -c guix -n '__fish_guix_using_command system' -l no-grub -d 'for \'init\', do not install GRUB'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--share=" -d 'for \'vm\', share host file system according to SPEC'
 complete -f -c guix -n '__fish_guix_using_command system' -a "--expose=" -d 'for \'vm\', expose host file system according to SPEC'
diff --git a/etc/completion/zsh/_guix b/etc/completion/zsh/_guix
index ae93b62b1d..aa1a859e0d 100644
--- a/etc/completion/zsh/_guix
+++ b/etc/completion/zsh/_guix
@@ -383,7 +383,7 @@ _guix_list_installed_packages()
         '--max-jobs=[allow at most N build jobs]:N' \
         '--derivation[return the derivation of the given system]' \
         '--on-error=[apply STRATEGY when an error occurs while reading FILE]:STRATEGY' \
-        '--image-size=[for "vm-image", produce an image of SIZE]:SIZE' \
+        '--image-size=[for "image", produce an image of SIZE]:SIZE' \
         '--no-grub[for "init", do not install GRUB]' \
         '--share=[for "vm", share host file system according to SPEC]:SPEC' \
         '--expose=[for "vm", expose host file system according to SPEC]:SPEC' \
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 1afae6b4ed..d7ae048b81 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -73,7 +73,6 @@
   #:export (expression->derivation-in-linux-vm
             qemu-image
             virtualized-operating-system
-            system-qemu-image
 
             system-qemu-image/shared-store
             system-qemu-image/shared-store-script
@@ -559,68 +558,6 @@ the operating system."
 
 
 ;;;
-;;; VM and disk images.
-;;;
-
-(define* (system-qemu-image os
-                            #:key
-                            (file-system-type "ext4")
-                            (disk-image-size (* 900 (expt 2 20))))
-  "Return the derivation of a freestanding QEMU image of DISK-IMAGE-SIZE bytes
-of the GNU system as described by OS."
-  (define file-systems-to-keep
-    ;; Keep only file systems other than root and not normally bound to real
-    ;; devices.
-    (remove (lambda (fs)
-              (let ((target (file-system-mount-point fs))
-                    (source (file-system-device fs)))
-                (or (string=? target "/")
-                    (and (string? source)
-                         (string-prefix? "/dev/" source))
-                    (uuid? source)
-                    (file-system-label? source))))
-            (operating-system-file-systems os)))
-
-  (define root-uuid
-    ;; UUID of the root file system.
-    (operating-system-uuid os
-                           (if (string=? file-system-type "iso9660")
-                               'iso9660
-                               'dce)))
-
-
-  (let* ((os (operating-system
-               (inherit os)
-
-               ;; As in 'virtualized-operating-system', use BIOS-style GRUB.
-               (bootloader (bootloader-configuration
-                            (bootloader grub-bootloader)
-                            (target "/dev/vda")))
-
-               ;; Assume we have an initrd with the whole QEMU shebang.
-
-               ;; Force our own root file system.  Refer to it by UUID so that
-               ;; it works regardless of how the image is used ("qemu -hda",
-               ;; Xen, etc.).
-               (file-systems (cons (file-system
-                                     (mount-point "/")
-                                     (device root-uuid)
-                                     (type file-system-type))
-                                   file-systems-to-keep))))
-         (bootcfg (operating-system-bootcfg os)))
-    (qemu-image  #:os os
-                 #:bootcfg-drv bootcfg
-                 #:bootloader (bootloader-configuration-bootloader
-                               (operating-system-bootloader os))
-                 #:disk-image-size disk-image-size
-                 #:file-system-type file-system-type
-                 #:file-system-uuid root-uuid
-                 #:inputs `(("system" ,os)
-                            ("bootcfg" ,bootcfg))
-                 #:copy-inputs? #t)))
-
-
-;;;
 ;;; VMs that share file systems with the host.
 ;;;
 
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 19b8c5163c..ead20a071e 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -695,8 +695,6 @@ checking this by themselves in their 'check' procedure."
         os
         #:mappings mappings
         #:shared-network? container-shared-network?))
-      ((vm-image)
-       (system-qemu-image os #:disk-image-size image-size))
       ((vm)
        (system-qemu-image/shared-store-script os
                                               #:full-boot? full-boot?
@@ -705,11 +703,16 @@ checking this by themselves in their 'check' procedure."
                                                   image-size
                                                   (* 70 (expt 2 20)))
                                               #:mappings mappings))
-      ((image disk-image)
-       (let* ((base-image (os->image os #:type image-type))
+      ((image disk-image vm-image)
+       (let* ((image-type (if (eq? action 'vm-image)
+                              qcow2-image-type
+                              image-type))
+              (base-image (os->image os #:type image-type))
               (base-target (image-target base-image)))
          (when (eq? action 'disk-image)
            (warning (G_ "'disk-image' is deprecated: use 'image' instead~%")))
+         (when (eq? action 'vm-image)
+           (warning (G_ "'vm-image' is deprecated: use 'image' instead~%")))
          (lower-object
           (system-image
            (image
@@ -781,9 +784,8 @@ and TARGET arguments."
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
 bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the
 target root directory; IMAGE-SIZE is the size of the image to be built, for
-the 'vm-image' and 'image' actions.  IMAGE-TYPE is the type of image to
-be built.  When VOLATILE-ROOT? is #t, the root file system is mounted
-volatile.
+the 'image' action.  IMAGE-TYPE is the type of image to be built.  When
+VOLATILE-ROOT? is #t, the root file system is mounted volatile.
 
 FULL-BOOT? is used for the 'vm' action; it determines whether to
 boot directly to the kernel or to the bootloader.  CONTAINER-SHARED-NETWORK?
@@ -969,8 +971,6 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "\
    vm               build a virtual machine image that shares the host's store\n"))
   (display (G_ "\
-   vm-image         build a freestanding virtual machine image\n"))
-  (display (G_ "\
    image            build a Guix System image\n"))
   (display (G_ "\
    docker-image     build a Docker image\n"))
@@ -999,7 +999,7 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
   -t, --image-type=TYPE  for 'image', produce an image of TYPE"))
   (display (G_ "
-      --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
+      --image-size=SIZE  for 'image', produce an image of SIZE"))
   (display (G_ "
       --no-bootloader    for 'init', do not install a bootloader"))
   (display (G_ "
@@ -1017,8 +1017,8 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
   -N, --network          for 'container', allow containers to access the network"))
   (display (G_ "
-  -r, --root=FILE        for 'vm', 'vm-image', 'image', 'container',
-                         and 'build', make FILE a symlink to the result, and
+  -r, --root=FILE        for 'vm', 'image', 'container' and 'build',
+                         make FILE a symlink to the result, and
                          register it as a garbage collector root"))
   (display (G_ "
       --full-boot        for 'vm', make a full boot sequence"))
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index 24cc2591d5..8bc0dcf2fc 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -339,7 +339,7 @@ done
 
 # Verify that the disk image types can be built.
 guix system -n vm gnu/system/examples/vm-image.tmpl
-guix system -n vm-image gnu/system/examples/vm-image.tmpl
+guix system -n image -t qcow2 gnu/system/examples/vm-image.tmpl
 # This invocation was taken care of in the loop above:
 # guix system -n disk-image gnu/system/examples/bare-bones.tmpl
 guix system -n disk-image -t iso9660 gnu/system/examples/bare-bones.tmpl