unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#45986] scripts: system: Remove 'vm-image' command.
@ 2021-01-19 18:09 Mathieu Othacehe
  2021-01-29 11:09 ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2021-01-19 18:09 UTC (permalink / raw)
  To: 45986

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]


Hello,

This patch removes the 'vm-image' command that has been superseded by
the 'image' command.

Thanks,

Mathieu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-scripts-system-Remove-vm-image-command.patch --]
[-- Type: text/x-diff, Size: 16464 bytes --]

From 5bb4ea792df2d4c946ca406bd79eebfc9e9bede1 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Tue, 19 Jan 2021 18:09:28 +0100
Subject: [PATCH] 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.
---
 doc/guix.texi                 | 33 +++++++++---------
 etc/completion/fish/guix.fish |  7 ++--
 etc/completion/zsh/_guix      |  2 +-
 gnu/system/vm.scm             | 63 -----------------------------------
 guix/scripts/system.scm       | 24 ++++++-------
 tests/guix-system.sh          |  2 +-
 6 files changed, 33 insertions(+), 98 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index f02353d9fa..0d9eae9512 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31392,8 +31392,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,
@@ -31437,15 +31436,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
@@ -31540,7 +31539,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''
@@ -31563,10 +31562,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
@@ -31929,7 +31928,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
@@ -557,68 +556,6 @@ the operating system."
      #:single-file-output? #t
      #:references-graphs `((,graph ,os)))))
 
-\f
-;;;
-;;; 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)))
-
 \f
 ;;;
 ;;; VMs that share file systems with the host.
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 66225bff35..9b75ac2fd0 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?
@@ -967,8 +969,6 @@ Some ACTIONS support additional ARGS.\n"))
    container        build a container that shares the host's store\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_ "\
@@ -998,7 +998,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_ "
@@ -1016,8 +1016,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 f5ddd1dda3..ddbdd0edcd 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -335,7 +335,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
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#45986] scripts: system: Remove 'vm-image' command.
  2021-01-19 18:09 [bug#45986] scripts: system: Remove 'vm-image' command Mathieu Othacehe
@ 2021-01-29 11:09 ` zimoun
  2021-02-17  9:53   ` bug#45986: " Mathieu Othacehe
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2021-01-29 11:09 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 45986

Hi Mathieu,

On Tue, 19 Jan 2021 at 19:55, Mathieu Othacehe <othacehe@gnu.org> wrote:

> This patch removes the 'vm-image' command that has been superseded by
> the 'image' command.

LGTM.  Maybe with an associated "news"?

Cheers,
simon




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#45986: scripts: system: Remove 'vm-image' command.
  2021-01-29 11:09 ` zimoun
@ 2021-02-17  9:53   ` Mathieu Othacehe
  0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Othacehe @ 2021-02-17  9:53 UTC (permalink / raw)
  To: zimoun; +Cc: 45986-done


Hello,

> LGTM.  Maybe with an associated "news"?

Pushed, thanks!

Mathieu




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-17  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 18:09 [bug#45986] scripts: system: Remove 'vm-image' command Mathieu Othacehe
2021-01-29 11:09 ` zimoun
2021-02-17  9:53   ` bug#45986: " Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).