system: Rename 'disk-image' command to 'image'.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Mathieu Othacehe
Severity
normal
M
M
Mathieu Othacehe wrote on 17 Jan 2021 11:44
(address . guix-patches@gnu.org)
87h7nfx2p8.fsf@gnu.org
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:

Toggle snippet (4 lines)
gnu system image my-os.scm
gnu system image my-image.scm

When my-image.scm could be for instance:

Toggle snippet (32 lines)
(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))

Thanks,

Mathieu
L
L
Ludovic Courtès wrote on 19 Jan 2021 15:23
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 45933@debbugs.gnu.org)
87k0s9huoh.fsf@gnu.org
Hi!

Mathieu Othacehe <othacehe@gnu.org> skribis:

Toggle quote (4 lines)
> 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.

+1

Toggle quote (12 lines)
> 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:
>
> gnu system image my-os.scm
> gnu system image my-image.scm
>
>
> When my-image.scm could be for instance:
>

[...]

Toggle quote (5 lines)
> (image
> (inherit
> (os->image my-os #:type pinebook-pro-image-type))
> (name 'my-pinebook-pro-raw-image))

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?

Toggle quote (12 lines)
>>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.
^
Nitpick: please specify the Texinfo node name(s) here.

Toggle quote (5 lines)
> + ((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~%")))
^
Rather semicolon (I think).

Otherwise LGTM, thanks!

Ludo’.
M
M
Mathieu Othacehe wrote on 19 Jan 2021 17:19
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 45933-done@debbugs.gnu.org)
87y2gox5ky.fsf@gnu.org
Hey Ludo,

Toggle quote (9 lines)
> 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 :).

Toggle quote (4 lines)
> Rather semicolon (I think).
>
> Otherwise LGTM, thanks!

Fixed and pushed, thanks for the fast review!

Mathieu
Closed
?