emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#45933: closed (system: Rename 'disk-image' command to 'image'.)


From: GNU bug Tracking System
Subject: bug#45933: closed (system: Rename 'disk-image' command to 'image'.)
Date: Tue, 19 Jan 2021 16:20:02 +0000

Your message dated Tue, 19 Jan 2021 17:19:09 +0100
with message-id <87y2gox5ky.fsf@gnu.org>
and subject line Re: bug#45933: system: Rename 'disk-image' command to 'image'.
has caused the debbugs.gnu.org bug report #45933,
regarding system: Rename 'disk-image' command to 'image'.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
45933: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=45933
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: system: Rename 'disk-image' command to 'image'. Date: Sun, 17 Jan 2021 11:44:35 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Hello,

With the new image API, the disk-image command is able to produce raw
disk-images, ISO9660 images and maybe in the future docker images. Hence
I feel that 'disk-image' in not the better command name anymore.

This patch renames the command name to 'image' and deprecates the old
command. I think it would also be nice for this command to be able to
process both <operating-system> files as well as <image> files, this
way:

--8<---------------cut here---------------start------------->8---
gnu system image my-os.scm
gnu system image my-image.scm
--8<---------------cut here---------------end--------------->8---

When my-image.scm could be for instance:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu system image)
             (gnu system images pinebook-pro))

(define my-os
  (operating-system
    (host-name "viso")
    (timezone "Europe/Paris")
    (locale "en_US.utf8")
    (bootloader (bootloader-configuration
                 (bootloader u-boot-pinebook-pro-rk3399-bootloader)
                 (target "/dev/vda")))
    (initrd-modules '())
    (kernel linux-libre-arm64-generic)
    (file-systems (cons (file-system
                          (device (file-system-label "my-root"))
                          (mount-point "/")
                          (type "ext4"))
                        %base-file-systems))
    (services (cons (service agetty-service-type
                             (agetty-configuration
                              (extra-options '("-L")) ; no carrier detect
                              (baud-rate "115200")
                              (term "vt100")
                              (tty "ttyS0")))
                    %base-services))))

(image
 (inherit
  (os->image my-os #:type pinebook-pro-image-type))
 (name 'my-pinebook-pro-raw-image))
--8<---------------cut here---------------end--------------->8---

Thanks,

Mathieu
>From c58ced3271ef1a62642a3011f0a8020039a008bd Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Sun, 17 Jan 2021 11:32:51 +0100
Subject: [PATCH] system: Rename 'disk-image' command 'image'.

* guix/scripts/system.scm (system-derivation-for-action): Rename 'disk-image'
command 'image'. Warn when using the now deprecated 'disk-image' command.
(show-help): Adapt accordingly.
(guix-system): Ditto.
* tests/guix-system.sh: Ditto.
* gnu/system/examples/bare-hurd.tmpl: Ditto.
* doc/guix.texi: Adapt documentation.
---
 doc/guix.texi                      | 24 ++++++++++++------------
 gnu/system/examples/bare-hurd.tmpl |  2 +-
 guix/scripts/system.scm            | 21 ++++++++++++---------
 tests/guix-system.sh               |  4 ++--
 4 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index dc41fe9aea..e2e22759cc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2661,7 +2661,7 @@ The installation image described above was built using 
the @command{guix
 system} command, specifically:
 
 @example
-guix system disk-image -t iso9660 gnu/system/install.scm
+guix system image -t iso9660 gnu/system/install.scm
 @end example
 
 Have a look at @file{gnu/system/install.scm} in the source tree,
@@ -2678,7 +2678,7 @@ If you build a disk image and the bootloader is not 
available otherwise
 includes the bootloader, specifically:
 
 @example
-guix system disk-image --system=armhf-linux -e '((@@ (gnu system install) 
os-with-u-boot) (@@ (gnu system install) installation-os) 
"A20-OLinuXino-Lime2")'
+guix system image --system=armhf-linux -e '((@@ (gnu system install) 
os-with-u-boot) (@@ (gnu system install) installation-os) 
"A20-OLinuXino-Lime2")'
 @end example
 
 @code{A20-OLinuXino-Lime2} is the name of the board.  If you specify an invalid
@@ -31393,7 +31393,7 @@ size of the image.
 @cindex System images, creation in various formats
 @cindex Creating system images in various formats
 @item vm-image
-@itemx disk-image
+@itemx 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,
@@ -31403,22 +31403,22 @@ a value.  Docker images are built to contain exactly 
what they need, so
 the @option{--image-size} option is ignored in the case of
 @code{docker-image}.
 
-@cindex disk-image, creating disk images
-The @code{disk-image} command can produce various image types.  The
+@cindex image, creating disk images
+The @code{image} command can produce various image types.  The
 image type can be selected using the @option{--image-type} option.  It
 defaults to @code{efi-raw}.  When its value is @code{iso9660}, the
 @option{--label} option can be used to specify a volume ID with
-@code{disk-image}.  By default, the root file system of a disk image is
+@code{image}.  By default, the root file system of a disk image is
 mounted non-volatile; the @option{--volatile} option can be provided to
-make it volatile instead.  When using @code{disk-image}, the bootloader
+make it volatile instead.  When using @code{image}, the bootloader
 installed on the generated image is taken from the provided
 @code{operating-system} definition.  The following example demonstrates
 how to generate an image that uses the @code{grub-efi-bootloader}
 bootloader and boot it with QEMU:
 
 @example
-image=$(guix system disk-image --image-type=qcow2 \
-             gnu/system/examples/lightweight-desktop.tmpl)
+image=$(guix system image --image-type=qcow2 \
+        gnu/system/examples/lightweight-desktop.tmpl)
 cp $image /tmp/my-image.qcow2
 chmod +w /tmp/my-image.qcow2
 qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \
@@ -31431,7 +31431,7 @@ it can be copied as is to a USB stick, for instance.  
Assuming
 the image to it using the following command:
 
 @example
-# dd if=$(guix system disk-image my-os.scm) of=/dev/sdc status=progress
+# dd if=$(guix system image my-os.scm) of=/dev/sdc status=progress
 @end example
 
 The @code{--list-image-types} command lists all the available image
@@ -31551,7 +31551,7 @@ of the image.
 
 @item --image-type=@var{type}
 @itemx -t @var{type}
-For the @code{disk-image} action, create an image with given @var{type}.
+For the @code{image} action, create an image with given @var{type}.
 
 When this option is omitted, @command{guix system} uses the
 @code{efi-raw} image type.
@@ -31563,7 +31563,7 @@ 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{disk-image} actions, create an image
+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}).
diff --git a/gnu/system/examples/bare-hurd.tmpl 
b/gnu/system/examples/bare-hurd.tmpl
index e4b795ff27..135ed23cb6 100644
--- a/gnu/system/examples/bare-hurd.tmpl
+++ b/gnu/system/examples/bare-hurd.tmpl
@@ -5,7 +5,7 @@
 
 ;; To build a disk image for a virtual machine, do
 ;;
-;;     ./pre-inst-env guix system disk-image --target=i586-pc-gnu \
+;;     ./pre-inst-env guix system image --target=i586-pc-gnu \
 ;;         gnu/system/examples/bare-hurd.tmpl
 ;;
 ;; You may run it like so
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index eb7137b7a9..3b69a41d8a 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -705,9 +705,11 @@ checking this by themselves in their 'check' procedure."
                                                   image-size
                                                   (* 70 (expt 2 20)))
                                               #:mappings mappings))
-      ((disk-image)
+      ((image disk-image)
        (let* ((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~%")))
          (lower-object
           (system-image
            (image
@@ -779,7 +781,7 @@ 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 'disk-image' actions.  IMAGE-TYPE is the type of image to
+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.
 
@@ -968,7 +970,7 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "\
    vm-image         build a freestanding virtual machine image\n"))
   (display (G_ "\
-   disk-image       build a disk image, suitable for a USB stick\n"))
+   image            build a Guix System image\n"))
   (display (G_ "\
    docker-image     build a Docker image\n"))
   (display (G_ "\
@@ -994,15 +996,15 @@ Some ACTIONS support additional ARGS.\n"))
   (display (G_ "
       --list-image-types list available image types"))
   (display (G_ "
-  -t, --image-type=TYPE  for 'disk-image', produce an image of TYPE"))
+  -t, --image-type=TYPE  for 'image', produce an image of TYPE"))
   (display (G_ "
       --image-size=SIZE  for 'vm-image', produce an image of SIZE"))
   (display (G_ "
       --no-bootloader    for 'init', do not install a bootloader"))
   (display (G_ "
-      --volatile         for 'disk-image', make the root file system 
volatile"))
+      --volatile         for 'image', make the root file system volatile"))
   (display (G_ "
-      --label=LABEL      for 'disk-image', label disk image with LABEL"))
+      --label=LABEL      for 'image', label disk image with LABEL"))
   (display (G_ "
       --save-provenance  save provenance information"))
   (display (G_ "
@@ -1014,7 +1016,7 @@ 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', 'disk-image', 'container',
+  -r, --root=FILE        for 'vm', 'vm-image', 'image', 'container',
                          and 'build', make FILE a symlink to the result, and
                          register it as a garbage collector root"))
   (display (G_ "
@@ -1335,7 +1337,7 @@ argument list and OPTS is the option alist."
         (alist-cons 'argument arg result)
         (let ((action (string->symbol arg)))
           (case action
-            ((build container vm vm-image disk-image reconfigure init
+            ((build container vm vm-image image disk-image reconfigure init
               extension-graph shepherd-graph
               list-generations describe
               delete-generations roll-back
@@ -1368,7 +1370,8 @@ argument list and OPTS is the option alist."
         (exit 1))
 
       (case action
-        ((build container vm vm-image disk-image docker-image reconfigure)
+        ((build container vm vm-image image disk-image docker-image
+                reconfigure)
          (unless (or (= count 1)
                      (and expr (= count 0)))
            (fail)))
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index e7e4c17e39..f5ddd1dda3 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -262,8 +262,8 @@ guix system vm "$tmpfile" -d | grep '\.drv$'
 drv1="`guix system vm "$tmpfile" -d`"
 drv2="`guix system vm "$tmpfile" -d`"
 test "$drv1" = "$drv2"
-drv1="`guix system disk-image -t iso9660 "$tmpfile" -d`"
-drv2="`guix system disk-image -t iso9660 "$tmpfile" -d`"
+drv1="`guix system image -t iso9660 "$tmpfile" -d`"
+drv2="`guix system image -t iso9660 "$tmpfile" -d`"
 test "$drv1" = "$drv2"
 
 make_user_config "group-that-does-not-exist" "users"
-- 
2.29.2


--- End Message ---
--- Begin Message --- Subject: Re: bug#45933: system: Rename 'disk-image' command to 'image'. Date: Tue, 19 Jan 2021 17:19:09 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Hey Ludo,

> That makes sense to me.  IIUC, the semantics could be:
>
>   1. If given an OS, wrap it in a “default” image.
>
>   2. Interpret command-line options like ‘--file-system-type’ as changes
>      to the <image>.
>
> How does that sound?

Totally agree :).

> Rather semicolon (I think).
>
> Otherwise LGTM, thanks!

Fixed and pushed, thanks for the fast review!

Mathieu


--- End Message ---

reply via email to

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