From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kAlJJ0oVBGCsWAAA0tVLHw (envelope-from ) for ; Sun, 17 Jan 2021 10:45:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id eBENI0oVBGAYEwAAB5/wlQ (envelope-from ) for ; Sun, 17 Jan 2021 10:45:30 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C3C089403A5 for ; Sun, 17 Jan 2021 10:45:29 +0000 (UTC) Received: from localhost ([::1]:58482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l15Ym-0007c1-PB for larch@yhetil.org; Sun, 17 Jan 2021 05:45:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l15YM-0007aY-4P for guix-patches@gnu.org; Sun, 17 Jan 2021 05:45:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33064) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l15YL-0004q1-RQ for guix-patches@gnu.org; Sun, 17 Jan 2021 05:45:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l15YL-0002fJ-QG for guix-patches@gnu.org; Sun, 17 Jan 2021 05:45:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45933] system: Rename 'disk-image' command to 'image'. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 17 Jan 2021 10:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45933 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 45933@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161088027910193 (code B ref -1); Sun, 17 Jan 2021 10:45:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jan 2021 10:44:39 +0000 Received: from localhost ([127.0.0.1]:44608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l15Xy-0002eK-Ub for submit@debbugs.gnu.org; Sun, 17 Jan 2021 05:44:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:52620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l15Xx-0002eC-8f for submit@debbugs.gnu.org; Sun, 17 Jan 2021 05:44:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l15Xx-0007ZK-14 for guix-patches@gnu.org; Sun, 17 Jan 2021 05:44:37 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35581) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l15Xw-0004eu-Qf for guix-patches@gnu.org; Sun, 17 Jan 2021 05:44:36 -0500 Received: from [2a01:e0a:19b:d9a0:1538:87ab:3a95:7600] (port=46800 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l15Xw-000895-Az for guix-patches@gnu.org; Sun, 17 Jan 2021 05:44:36 -0500 From: Mathieu Othacehe Date: Sun, 17 Jan 2021 11:44:35 +0100 Message-ID: <87h7nfx2p8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.86 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: C3C089403A5 X-Spam-Score: -2.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: l5fwzfqmi3aj --=-=-= Content-Type: text/plain 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 files as well as 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-system-Rename-disk-image-command-image.patch >From c58ced3271ef1a62642a3011f0a8020039a008bd Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe 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 --=-=-=--