From patchwork Fri Mar 20 14:09:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20788 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 8F1E227BBEA; Fri, 20 Mar 2020 14:10:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id EED7927BBE4 for ; Fri, 20 Mar 2020 14:10:13 +0000 (GMT) Received: from localhost ([::1]:53410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILl-0002i1-FL for patchwork@mira.cbaines.net; Fri, 20 Mar 2020 10:10:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46630) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILc-0002gB-1Y 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 1jFILa-0003iW-Aa for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFILa-0003hs-73 for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFILa-0007O6-1y for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40149] [PATCH 1/5] machine: ssh: Make sanity checks in a single round trip. References: <20200320140433.27868-1-ludo@gnu.org> In-Reply-To: <20200320140433.27868-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Mar 2020 14:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40149@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 40149-submit@debbugs.gnu.org id=B40149.158471336528291 (code B ref 40149); Fri, 20 Mar 2020 14:10:01 +0000 Received: (at 40149) by debbugs.gnu.org; 20 Mar 2020 14:09:25 +0000 Received: from localhost ([127.0.0.1]:45315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIKz-0007ME-6F for submit@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIKy-0007Ly-CI for 40149@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jFIKt-0003RQ-9c; Fri, 20 Mar 2020 10:09:19 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54272 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jFIKs-0004AC-A5; Fri, 20 Mar 2020 10:09:19 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 20 Mar 2020 15:09:06 +0100 Message-Id: <20200320140910.28439-1-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * gnu/machine/ssh.scm (): New record type. (remote-let): New macro. (machine-check-file-system-availability): Rewrite to use 'remote-let' instead of 'mlet' and 'machine-remote-eval'. (machine-check-initrd-modules): Likewise. (machine-check-building-for-appropriate-system): Make non-monadic. (check-deployment-sanity): Rewrite to gather all the assertions as a single gexp and pass it to 'machine-remote-eval'. --- gnu/machine/ssh.scm | 138 ++++++++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 57 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 6374373e22..85ecbb6d14 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +40,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 textual-ports) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -142,9 +144,24 @@ an environment type of 'managed-host." ;;; Safety checks. ;;; +;; Assertion to be executed remotely. This abstraction exists to allow us to +;; gather a list of expressions to be evaluated and eventually evaluate them +;; all at once instead of one by one. (This is pretty much a monad.) +(define-record-type + (remote-assertion exp proc) + remote-assertion? + (exp remote-assertion-expression) + (proc remote-assertion-procedure)) + +(define-syntax-rule (remote-let ((var exp)) body ...) + "Return a that binds VAR to the result of evaluating EXP, +a gexp, remotely, and evaluate BODY in that context." + (remote-assertion exp (lambda (var) body ...))) + (define (machine-check-file-system-availability machine) - "Raise a '&message' error condition if any of the file-systems specified in -MACHINE's 'system' declaration do not exist on the machine." + "Return a list of that raise a '&message' error condition +if any of the file-systems specified in MACHINE's 'system' declaration do not +exist on the machine." (define file-systems (filter (lambda (fs) (and (file-system-mount? fs) @@ -154,22 +171,18 @@ MACHINE's 'system' declaration do not exist on the machine." (operating-system-file-systems (machine-operating-system machine)))) (define (check-literal-file-system fs) - (define remote-exp - #~(catch 'system-error - (lambda () - (stat #$(file-system-device fs)) - #t) - (lambda args - (system-error-errno args)))) - - (mlet %store-monad ((errno (machine-remote-eval machine remote-exp))) + (remote-let ((errno #~(catch 'system-error + (lambda () + (stat #$(file-system-device fs)) + #t) + (lambda args + (system-error-errno args))))) (when (number? errno) (raise (condition (&message (message (format #f (G_ "device '~a' not found: ~a") (file-system-device fs) - (strerror errno))))))) - (return #t))) + (strerror errno))))))))) (define (check-labeled-file-system fs) (define remote-exp @@ -180,14 +193,13 @@ MACHINE's 'system' declaration do not exist on the machine." (find-partition-by-label #$(file-system-label->string (file-system-device fs)))))) - (mlet %store-monad ((result (machine-remote-eval machine remote-exp))) + (remote-let ((result remote-exp)) (unless result (raise (condition (&message (message (format #f (G_ "no file system with label '~a'") (file-system-label->string - (file-system-device fs)))))))) - (return #t))) + (file-system-device fs)))))))))) (define (check-uuid-file-system fs) (define remote-exp @@ -203,31 +215,30 @@ MACHINE's 'system' declaration do not exist on the machine." (find-partition-by-uuid uuid)))) - (mlet %store-monad ((result (machine-remote-eval machine remote-exp))) + (remote-let ((result remote-exp)) (unless result (raise (condition (&message (message (format #f (G_ "no file system with UUID '~a'") - (uuid->string (file-system-device fs)))))))) - (return #t))) + (uuid->string (file-system-device fs)))))))))) - (mbegin %store-monad - (mapm %store-monad check-literal-file-system - (filter (lambda (fs) - (string? (file-system-device fs))) - file-systems)) - (mapm %store-monad check-labeled-file-system - (filter (lambda (fs) - (file-system-label? (file-system-device fs))) - file-systems)) - (mapm %store-monad check-uuid-file-system - (filter (lambda (fs) - (uuid? (file-system-device fs))) - file-systems)))) + (append (map check-literal-file-system + (filter (lambda (fs) + (string? (file-system-device fs))) + file-systems)) + (map check-labeled-file-system + (filter (lambda (fs) + (file-system-label? (file-system-device fs))) + file-systems)) + (map check-uuid-file-system + (filter (lambda (fs) + (uuid? (file-system-device fs))) + file-systems)))) (define (machine-check-initrd-modules machine) - "Raise a '&message' error condition if any of the modules needed by -'needed-for-boot' file systems in MACHINE are not available in the initrd." + "Return a list of that raise a '&message' error condition +if any of the modules needed by 'needed-for-boot' file systems in MACHINE are +not available in the initrd." (define file-systems (filter file-system-needed-for-boot? (operating-system-file-systems (machine-operating-system machine)))) @@ -255,20 +266,16 @@ MACHINE's 'system' declaration do not exist on the machine." (missing-modules dev '#$(operating-system-initrd-modules (machine-operating-system machine))))))) - (mlet %store-monad ((missing (machine-remote-eval machine remote-exp))) - (return (list fs missing)))) - (mlet %store-monad ((device (mapm %store-monad missing-modules file-systems))) - (for-each (match-lambda - ((fs missing) - (unless (null? missing) - (raise (condition - (&message - (message (format #f (G_ "~a missing modules ~{ ~a~}~%") - (file-system-device fs) - missing)))))))) - device) - (return #t))) + (remote-let ((missing remote-exp)) + (unless (null? missing) + (raise (condition + (&message + (message (format #f (G_ "~a missing modules ~{ ~a~}~%") + (file-system-device fs) + missing)))))))) + + (map missing-modules file-systems)) (define (machine-check-building-for-appropriate-system machine) "Raise a '&message' error condition if MACHINE is configured to be built @@ -280,21 +287,38 @@ by MACHINE." (not (string= system (machine-ssh-configuration-system config)))) (raise (condition (&message - (message (format #f (G_ "incorrect target system \ -('~a' was given, while the system reports that it is '~a')~%") + (message (format #f (G_ "incorrect target system\ + ('~a' was given, while the system reports that it is '~a')~%") (machine-ssh-configuration-system config) - system))))))) - (with-monad %store-monad (return #t))) + system)))))))) (define (check-deployment-sanity machine) "Raise a '&message' error condition if it is clear that deploying MACHINE's 'system' declaration would fail." - ;; Order is important here -- an incorrect value for 'system' will cause - ;; invocations of 'remote-eval' to fail. - (mbegin %store-monad - (machine-check-building-for-appropriate-system machine) - (machine-check-file-system-availability machine) - (machine-check-initrd-modules machine))) + (define assertions + (append (machine-check-file-system-availability machine) + (machine-check-initrd-modules machine))) + + (define aggregate-exp + ;; Gather all the expressions so that a single round-trip is enough to + ;; evaluate all the ASSERTIONS remotely. + #~(map (lambda (file) + (false-if-exception (primitive-load file))) + '#$(map (lambda (assertion) + (scheme-file "remote-assertion.scm" + (remote-assertion-expression assertion))) + assertions))) + + ;; First check MACHINE's system type--an incorrect value for 'system' would + ;; cause subsequent invocations of 'remote-eval' to fail. + (machine-check-building-for-appropriate-system machine) + + (mlet %store-monad ((values (machine-remote-eval machine aggregate-exp))) + (for-each (lambda (proc value) + (proc value)) + (map remote-assertion-procedure assertions) + values) + (return #t))) ;;; From patchwork Fri Mar 20 14:09:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20787 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 E092427BBEB; Fri, 20 Mar 2020 14:10:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id A684027BBEA for ; Fri, 20 Mar 2020 14:10:11 +0000 (GMT) Received: from localhost ([::1]:53408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILj-0002gZ-74 for patchwork@mira.cbaines.net; Fri, 20 Mar 2020 10:10:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46626) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILb-0002gA-Rw 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 1jFILa-0003jW-OW for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39355) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFILa-0003j6-LL for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFILa-0007OE-Gi for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40149] [PATCH 2/5] ui: Add 'indented-string'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Mar 2020 14:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40149@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 40149-submit@debbugs.gnu.org id=B40149.158471336828310 (code B ref 40149); Fri, 20 Mar 2020 14:10:02 +0000 Received: (at 40149) by debbugs.gnu.org; 20 Mar 2020 14:09:28 +0000 Received: from localhost ([127.0.0.1]:45319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL1-0007MY-MO for submit@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIKz-0007M0-Ke for 40149@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jFIKu-0003Ri-Ia; Fri, 20 Mar 2020 10:09:20 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54272 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jFIKt-0004AC-Uk; Fri, 20 Mar 2020 10:09:20 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 20 Mar 2020 15:09:07 +0100 Message-Id: <20200320140910.28439-2-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320140910.28439-1-ludo@gnu.org> References: <20200320140910.28439-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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/pull.scm (display-news-entry): Remove extra space in format string for 'indented-string'. (indented-string): Remove. (display-new/upgraded-packages)[pretty]: Pass #:initial-indent? to 'indented-string'. * guix/ui.scm (indented-string): New procedure. --- guix/scripts/pull.scm | 17 ++--------------- guix/ui.scm | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 51d4da209a..1db5ab7237 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -269,7 +269,7 @@ code, to PORT." (let ((body (or (assoc-ref body language) (assoc-ref body (%default-message-language)) ""))) - (format port " ~a~%" + (format port "~a~%" (indented-string (parameterize ((%text-width (- (%text-width) 4))) (string-trim-right @@ -523,19 +523,6 @@ true, display what would be built without actually building it." ;;; Queries. ;;; -(define (indented-string str indent) - "Return STR with each newline preceded by IDENT spaces." - (define indent-string - (make-list indent #\space)) - - (list->string - (string-fold-right (lambda (chr result) - (if (eqv? chr #\newline) - (cons chr (append indent-string result)) - (cons chr result))) - '() - str))) - (define profile-package-alist (mlambda (profile) "Return a name/version alist representing the packages in PROFILE." @@ -592,7 +579,7 @@ Return true when there is more package info to display." (define (pretty str column) (indented-string (fill-paragraph str (- (%text-width) 4) column) - 4)) + 4 #:initial-indent? #f)) (define concise/max-item-count ;; Maximum number of items to display when CONCISE? is true. diff --git a/guix/ui.scm b/guix/ui.scm index 6f1ca9c0b2..698111dd9a 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -103,6 +103,7 @@ read/eval read/eval-package-expression check-available-space + indented-string fill-paragraph %text-width texi->plain-text @@ -1163,6 +1164,23 @@ replacement if PORT is not Unicode-capable." (lambda () body ...))))) +(define* (indented-string str indent + #:key (initial-indent? #t)) + "Return STR with each newline preceded by IDENT spaces. When +INITIAL-INDENT? is true, the first line is also indented." + (define indent-string + (make-list indent #\space)) + + (list->string + (string-fold-right (lambda (chr result) + (if (eqv? chr #\newline) + (cons chr (append indent-string result)) + (cons chr result))) + '() + (if initial-indent? + (string-append (list->string indent-string) str) + str)))) + (define* (fill-paragraph str width #:optional (column 0)) "Fill STR such that each line contains at most WIDTH characters, assuming that the first character is at COLUMN. From patchwork Fri Mar 20 14:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20789 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 5D8C727BBEA; Fri, 20 Mar 2020 14:10:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2548327BBE4 for ; Fri, 20 Mar 2020 14:10:18 +0000 (GMT) Received: from localhost ([::1]:53412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILp-0002ph-Np for patchwork@mira.cbaines.net; Fri, 20 Mar 2020 10:10:17 -0400 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 X-Loop: help-debbugs@gnu.org Subject: [bug#40149] [PATCH 3/5] deploy: Show what machines will be deployed. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Mar 2020 14:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40149@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 40149-submit@debbugs.gnu.org id=B40149.158471337028330 (code B ref 40149); Fri, 20 Mar 2020 14:10:02 +0000 Received: (at 40149) by debbugs.gnu.org; 20 Mar 2020 14:09:30 +0000 Received: from localhost ([127.0.0.1]:45323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL4-0007Mm-0e for submit@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL0-0007M2-Ve for 40149@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jFIKv-0003Rz-TA; Fri, 20 Mar 2020 10:09:21 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54272 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jFIKv-0004AC-7S; Fri, 20 Mar 2020 10:09:21 -0400 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> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320140910.28439-1-ludo@gnu.org> References: <20200320140910.28439-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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/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) From patchwork Fri Mar 20 14:09:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20790 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 E942827BBEA; Fri, 20 Mar 2020 14:10:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id C24E027BBE4 for ; Fri, 20 Mar 2020 14:10:23 +0000 (GMT) Received: from localhost ([::1]:53418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILv-0002wa-C1 for patchwork@mira.cbaines.net; Fri, 20 Mar 2020 10:10:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46648) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILc-0002gD-Nz 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-0003lq-OX for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFILb-0003lg-LY 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 1jFILb-0007OT-ES for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40149] [PATCH 4/5] deploy: Write a message upon successful deployment. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Mar 2020 14:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40149@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 40149-submit@debbugs.gnu.org id=B40149.158471337028336 (code B ref 40149); Fri, 20 Mar 2020 14:10:03 +0000 Received: (at 40149) by debbugs.gnu.org; 20 Mar 2020 14:09:30 +0000 Received: from localhost ([127.0.0.1]:45325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL4-0007Mt-DP for submit@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL2-0007M5-9d for 40149@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jFIKx-0003SD-7j; Fri, 20 Mar 2020 10:09:23 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54272 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jFIKw-0004AC-IA; Fri, 20 Mar 2020 10:09:23 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 20 Mar 2020 15:09:09 +0100 Message-Id: <20200320140910.28439-4-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320140910.28439-1-ludo@gnu.org> References: <20200320140910.28439-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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/deploy.scm (guix-deploy): Write message upon successful deployment. --- guix/scripts/deploy.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index 1f1ca58476..1d652d019d 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -141,5 +141,7 @@ Perform the deployment specified by FILE.\n")) (machine-display-name machine)) (run-with-store store (roll-back-machine machine))) (apply throw (deploy-error-captured-args c)))) - (run-with-store store (deploy-machine machine))))) + (run-with-store store (deploy-machine machine)) + (info (G_ "successfully deployed ~a~%") + (machine-display-name machine))))) machines))))) From patchwork Fri Mar 20 14:09:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 20791 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 077FB27BBEA; Fri, 20 Mar 2020 14:10:30 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D689927BBE4 for ; Fri, 20 Mar 2020 14:10:29 +0000 (GMT) Received: from localhost ([::1]:53420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFIM1-00031S-DQ for patchwork@mira.cbaines.net; Fri, 20 Mar 2020 10:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46661) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFILd-0002gH-8P for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFILc-0003md-CM for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFILc-0003mV-9w for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFILc-0007Oc-52 for guix-patches@gnu.org; Fri, 20 Mar 2020 10:10:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#40149] [PATCH 5/5] machine: ssh: Better report missing initrd modules. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 20 Mar 2020 14:10:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40149 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 40149@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 40149-submit@debbugs.gnu.org id=B40149.158471337428348 (code B ref 40149); Fri, 20 Mar 2020 14:10:04 +0000 Received: (at 40149) by debbugs.gnu.org; 20 Mar 2020 14:09:34 +0000 Received: from localhost ([127.0.0.1]:45327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL7-0007NA-MD for submit@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFIL3-0007M8-S5 for 40149@debbugs.gnu.org; Fri, 20 Mar 2020 10:09:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jFIKy-0003SW-QF; Fri, 20 Mar 2020 10:09:24 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54272 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jFIKx-0004AC-Sk; Fri, 20 Mar 2020 10:09:24 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 20 Mar 2020 15:09:10 +0100 Message-Id: <20200320140910.28439-5-ludo@gnu.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320140910.28439-1-ludo@gnu.org> References: <20200320140910.28439-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 * gnu/machine/ssh.scm (machine-check-initrd-modules): Improve message upon module mismatch. --- gnu/machine/ssh.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 85ecbb6d14..116da86327 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -271,7 +271,7 @@ not available in the initrd." (unless (null? missing) (raise (condition (&message - (message (format #f (G_ "~a missing modules ~{ ~a~}~%") + (message (format #f (G_ "missing modules for ~a:~{ ~a~}~%") (file-system-device fs) missing))))))))