From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:46635) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILc-0002gC-9E for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFILb-0003kD-79 for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39356) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFILb-0003jl-4E for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFILa-0007OL-V8 for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:02 -0400 Subject: [bug#40149] [PATCH 3/5] deploy: Show what machines will be deployed. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 20 Mar 2020 15:09:08 +0100 Message-Id: <20200320140910.28439-3-ludo@gnu.org> In-Reply-To: <20200320140910.28439-1-ludo@gnu.org> References: <20200320140910.28439-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 40149@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= * guix/scripts/deploy.scm (show-what-to-deploy): New procedure. (guix-deploy): Call it. --- guix/scripts/deploy.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index ad05c333dc..1f1ca58476 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 David Thompson ;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -97,6 +98,22 @@ Perform the deployment specified by FILE.\n")) environment-modules)))) (load* file module))) +(define (show-what-to-deploy machines) + "Show the list of machines to deploy, MACHINES." + (let ((count (length machines))) + (format (current-error-port) + (N_ "The following ~*machine will be deployed:~%" + "The following ~d machines will be deployed:~%" + count) + count) + (display (indented-string + (fill-paragraph (string-join (map machine-display-name machines) + ", ") + (- (%text-width) 2) 2) + 2) + (current-error-port)) + (display "\n\n" (current-error-port)))) + (define (guix-deploy . args) (define (handle-argument arg result) (alist-cons 'file arg result)) @@ -105,6 +122,8 @@ Perform the deployment specified by FILE.\n")) #:argument-handler handle-argument)) (file (assq-ref opts 'file)) (machines (or (and file (load-source-file file)) '()))) + (show-what-to-deploy machines) + (with-status-verbosity (assoc-ref opts 'verbosity) (with-store store (set-build-options-from-command-line store opts) -- 2.25.1