From patchwork Thu Dec 16 13:06:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 35272 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8C2E727BBEA; Thu, 16 Dec 2021 13:09:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CE6A527BBEB for ; Thu, 16 Dec 2021 13:09:13 +0000 (GMT) Received: from localhost ([::1]:51464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxqVU-0006UX-Sw for patchwork@mira.cbaines.net; Thu, 16 Dec 2021 08:09:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxqUO-0005m3-Gf for guix-patches@gnu.org; Thu, 16 Dec 2021 08:08:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxqUO-0004b6-7s for guix-patches@gnu.org; Thu, 16 Dec 2021 08:08:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mxqUO-0006g6-48 for guix-patches@gnu.org; Thu, 16 Dec 2021 08:08:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52550] [PATCH 07/10] scripts: system: Deprecate the docker-image command. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Dec 2021 13:08:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52550 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52550@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 52550-submit@debbugs.gnu.org id=B52550.163966004325554 (code B ref 52550); Thu, 16 Dec 2021 13:08:04 +0000 Received: (at 52550) by debbugs.gnu.org; 16 Dec 2021 13:07:23 +0000 Received: from localhost ([127.0.0.1]:34991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxqTj-0006dy-2X for submit@debbugs.gnu.org; Thu, 16 Dec 2021 08:07:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mxqTa-0006cw-2Q for 52550@debbugs.gnu.org; Thu, 16 Dec 2021 08:07:15 -0500 Received: from [2001:470:142:3::e] (port=33800 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxqTU-0004SO-SD for 52550@debbugs.gnu.org; Thu, 16 Dec 2021 08:07:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=KFVpiOh2Y4P+iROfb61G/X25JaI/C3MF1uD4eILvH+s=; b=V5pxMIdmMAm0GWJiwleC h7ViuxlXH2SBI7MTchRVtaUBVDHcxI/2aeiaR4/batE7msfTFasqTEPFkYFgJfDhCOHqKch2mjCKc Uco6I+FTHfW2rrO3eZsZoSEY/uRl9eNrdNjoWhmAXD3V8uYDTxPQ2roa1RSMDSBGjelj9NekcYIH5 3fsuyTTNNRhyD1iUQ83rS3Mfk9OP2Uulr12XmFMy+nXifbumEGcpy6cCUvLuVg7d6aUVifKNqsGVa G8N3IMFqyvt9azf9E/C8G20SkSka2WxI7fCKycweGR0jNji6keGYMAQnMT5rXkn6EQxzXx247WBxo CXCn6E8YefplsQ==; Received: from [2a01:e0a:19b:d9a0:2f3b:16f2:b776:3ef9] (port=57550 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxqTR-0003iQ-S0; Thu, 16 Dec 2021 08:07:07 -0500 From: Mathieu Othacehe Date: Thu, 16 Dec 2021 14:06:46 +0100 Message-Id: <20211216130649.30285-7-othacehe@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211216130649.30285-1-othacehe@gnu.org> References: <20211216130649.30285-1-othacehe@gnu.org> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/system.scm (system-derivation-for-action): Use the image API to generate the docker images and deprecate the docker-image command. (process-action): Ditto. * doc/guix.texi (Invoking guix system): Adapt it. --- doc/guix.texi | 19 +++++-------------- guix/scripts/system.scm | 22 ++++++++++++---------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index dd991542cf..f0f5538427 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34986,15 +34986,6 @@ QEMU monitor and the VM. @cindex System images, creation in various formats @cindex Creating system images in various formats @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, -@command{guix system} estimates the size of the image needed to store -the system, but you can use the @option{--image-size} option to specify -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 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 @@ -35040,11 +35031,11 @@ 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 -the image from scratch, not from a pre-existing Docker base image. As a -result, it contains @emph{exactly} what you define in the operating -system configuration file. You can then load the image and launch a -Docker container using commands like the following: +When using the @code{docker} image type, a Docker image is produced. +Guix builds the image from scratch, not from a pre-existing Docker base +image. As a result, it contains @emph{exactly} what you define in the +operating system configuration file. You can then load the image and +launch a Docker container using commands like the following: @example image_id="$(docker load < guix-system-docker-image.tar.gz)" diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 1db788a534..a5d9bb4779 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -713,16 +713,14 @@ (define* (system-derivation-for-action image action image-size (* 70 (expt 2 20))) #:mappings mappings)) - ((image disk-image vm-image) + ((image disk-image vm-image docker-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))) - ((docker-image) - (system-docker-image os - #:memory-size 1024 - #:shared-network? container-shared-network?))))) + (when (eq? action 'docker-image) + (warning (G_ "'docker-image' is deprecated: use 'image' instead~%"))) + (lower-object (system-image image)))))) (define (maybe-suggest-running-guix-pull) "Suggest running 'guix pull' if this has never been done before." @@ -1214,11 +1212,14 @@ (define save-provenance? (label (assoc-ref opts 'label)) (image-type (lookup-image-type-by-name (assoc-ref opts 'image-type))) - (image (let* ((image-type (if (eq? action 'vm-image) - qcow2-image-type - image-type)) + (image (let* ((image-type (case action + ((vm-image) qcow2-image-type) + ((docker-image) docker-image-type) + (else image-type))) (image-size (assoc-ref opts 'image-size)) (volatile? (assoc-ref opts 'volatile-root?)) + (shared-network? + (assoc-ref opts 'container-shared-network?)) (base-image (if (operating-system? obj) (os->image obj #:type image-type) @@ -1228,7 +1229,8 @@ (define save-provenance? (image-with-label base-image label) base-image)) (size image-size) - (volatile-root? volatile?)))) + (volatile-root? volatile?) + (shared-network? shared-network?)))) (os (image-operating-system image)) (target-file (match args ((first second) second)