From unknown Sat Jun 14 18:53:47 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#74961] [PATCH] scripts: deploy: Add the expression command line flag. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 19 Dec 2024 05:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74961 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74961@debbugs.gnu.org Cc: Richard Sent , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17345868927454 (code B ref -1); Thu, 19 Dec 2024 05:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Dec 2024 05:41:32 +0000 Received: from localhost ([127.0.0.1]:37050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO9Ht-0001w4-6J for submit@debbugs.gnu.org; Thu, 19 Dec 2024 00:41:32 -0500 Received: from lists.gnu.org ([209.51.188.17]:55832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO9Hn-0001vs-Qu for submit@debbugs.gnu.org; Thu, 19 Dec 2024 00:41:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO9Hl-0001k3-Pw for guix-patches@gnu.org; Thu, 19 Dec 2024 00:41:22 -0500 Received: from mail-108-mta92.mxroute.com ([136.175.108.92]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO9Hj-00057R-SI for guix-patches@gnu.org; Thu, 19 Dec 2024 00:41:21 -0500 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta92.mxroute.com (ZoneMTA) with ESMTPSA id 193dd6f3940000310e.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 19 Dec 2024 05:41:14 +0000 X-Zone-Loop: 711908e6f95516aed07b838430906f20023c3cfdf391 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vC2fPPQ3ebclo/EJN/1bqNTjO4P71YsrquRJAffpvGk=; b=saJbxX5XGwgc9FbQ3MjXshTq7L nC38pALWWJ/f4L1Sb6m/BZBuSIdv7QyxIjw/JUVgeNpE993qKwDwotPx0wzsFOnBEyJubTPB7q8a+ djdtATiBn9B3cuiDq3qh1klA4E16p4TWVKpnK3i07Opw9Bs/juVduqoFF9kmFMLpCGOKjqSNdLgZu Ji5FKI8MMqnr6NKLJeK7ZlxBgqYcDjv20TbVHKMs72dSMlwju4fMr+hq2s6glmeBJaQJ/QR9bPbPv zd9xU4EGUNmGDDEy7vc6PCW9h1VypM4aWj62tgCFUhda56eemfWbOyXAkHLQqH8FwJyZMwhsABLM7 fmDJkNkg==; From: Richard Sent Date: Thu, 19 Dec 2024 00:37:52 -0500 Message-ID: <6a3be28b8325e18076a01b9a9a60d22f4b8b866d.1734586672.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.92; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta92.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * guix/scripts/deploy.scm (show-help): Add help. (%options): Add -e and --expression. (guix-deploy): Use expression and check for invalid flag combinations. Change-Id: I200c9ff0c9a8c686efff4a21cd33c10429f3c73e --- Submitting a patch to take care of https://issues.guix.gnu.org/71841. Always struck me as odd that deploy doesn't have a --evaluate flag like many others, so here's a go at it. I didn't update documentation because "invoking guix deploy" still has a TODO stating > @c FIXME/TODO: Separate the API doc from the CLI doc. As is there doesn't seem to be a good place to insert --expression documentation without sidetracking the info page. This'll be useful for me at least as I store my machine list in a channel. guix/scripts/deploy.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index 4b1a603049..941ee199f0 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2019 David Thompson ;;; Copyright © 2019 Jakob L. Kreuze ;;; Copyright © 2020-2022 Ludovic Courtès +;;; Copyright © 2024 Richard Sent ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,6 +60,9 @@ (define (show-help) -V, --version display version information and exit")) (newline) (display (G_ " + -e, --expression=EXPR deploy the list of machines EXPR evaluates to")) + (newline) + (display (G_ " -x, --execute execute the following command on all the machines")) (newline) (display (G_ " @@ -74,6 +78,9 @@ (define %options (lambda args (show-version-and-exit "guix deploy"))) + (option '(#\e "expression") #t #f + (lambda (opt name arg result) + (alist-cons 'expression arg result))) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) @@ -247,10 +254,16 @@ (define-command (guix-deploy . args) (opts (parse-command-line args %options (list %default-options) #:argument-handler handle-argument)) (file (assq-ref opts 'file)) - (machines (and file (load-source-file file))) + (expression (assoc-ref opts 'expression)) + (machines (or (and file (load-source-file file)) + (and expression (read/eval expression)))) (dry-run? (assoc-ref opts 'dry-run?)) (execute-command? (assoc-ref opts 'execute-command?))) - (unless file + (when (and file expression) + (leave (G_ "both '--expression' and a deployment file were provided~%"))) + + (unless (or file + expression) (leave (G_ "missing deployment file argument~%"))) (when (and (pair? command) (not execute-command?)) base-commit: 1a62f687e504c67f26693f3bc60a90e503ab4ea9 -- 2.46.0 From unknown Sat Jun 14 18:53:47 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Richard Sent Subject: bug#74961: closed (Re: [bug#74961] [PATCH] scripts: deploy: Add the expression command line flag.) Message-ID: References: <87bjx28f7i.fsf@gnu.org> <6a3be28b8325e18076a01b9a9a60d22f4b8b866d.1734586672.git.richard@freakingpenguin.com> X-Gnu-PR-Message: they-closed 74961 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 74961@debbugs.gnu.org Date: Mon, 23 Dec 2024 17:47:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1734976023-4884-1" This is a multi-part message in MIME format... ------------=_1734976023-4884-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #74961: [PATCH] scripts: deploy: Add the expression command line flag. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 74961@debbugs.gnu.org. --=20 74961: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D74961 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1734976023-4884-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 74961-done) by debbugs.gnu.org; 23 Dec 2024 17:46:56 +0000 Received: from localhost ([127.0.0.1]:56000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPmW7-0001GM-Im for submit@debbugs.gnu.org; Mon, 23 Dec 2024 12:46:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPmW5-0001G9-Gr for 74961-done@debbugs.gnu.org; Mon, 23 Dec 2024 12:46:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPmVz-0005Nu-KT; Mon, 23 Dec 2024 12:46:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=UOpF+a0riw2lCg6/X8ppxXgNPKF/Rw0SrEoyRTzeDew=; b=d9xDcvq7vT8bYlx4cOWI BSSYGMUU3/y16q9WEQ45pw2Q6B/2o0fZUSM4I+KqB3poNG4HolvaSS53iDFGXoevhPWIoAbS1RGy7 WU2OVitDGYpaxQAaMbRTTGAMurtG0kkWiNLWoQKkLVP1XFeprBn7VXhmPFT2DNh1dFExSPaSEYy98 lg9aFvZu7pQ5dIGUpURHZ4N1VDz7FQvrQSQep1IO1tB/2T8T3EcTe0SfR1EBWMR8FW3x9qFarpJxf m0Nt5NnxxujermH7zmsWSKTF1T2pkFqA/K4eTJO2/z/H5CQISHitqthdoMEb2+appfv/KZbK5UyzA UzsUDkadi+789Q==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Richard Sent Subject: Re: [bug#74961] [PATCH] scripts: deploy: Add the expression command line flag. In-Reply-To: <6a3be28b8325e18076a01b9a9a60d22f4b8b866d.1734586672.git.richard@freakingpenguin.com> (Richard Sent's message of "Thu, 19 Dec 2024 00:37:52 -0500") References: <6a3be28b8325e18076a01b9a9a60d22f4b8b866d.1734586672.git.richard@freakingpenguin.com> Date: Mon, 23 Dec 2024 18:46:41 +0100 Message-ID: <87bjx28f7i.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74961-done Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , Christopher Baines , 74961-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Richard Sent skribis: > * guix/scripts/deploy.scm (show-help): Add help. > (%options): Add -e and --expression. > (guix-deploy): Use expression and check for invalid flag combinations. > > Change-Id: I200c9ff0c9a8c686efff4a21cd33c10429f3c73e Applied. > Submitting a patch to take care of https://issues.guix.gnu.org/71841. > Always struck me as odd that deploy doesn't have a --evaluate flag > like many others, so here's a go at it. > > I didn't update documentation because "invoking guix deploy" still has > a TODO stating > >> @c FIXME/TODO: Separate the API doc from the CLI doc. > > As is there doesn't seem to be a good place to insert --expression > documentation without sidetracking the info page. Yeah. We should probably move the first half of the existing material in a =E2=80=9CGetting Started=E2=80=9D subsection, the second half in the = =E2=80=9CDefining Machines=E2=80=9D subsection, and then insert an =E2=80=9CInvoking guix dep= loy=E2=80=9D subsection with the CLI reference somewhere. Food for thought. :-) [...] > + (expression (assoc-ref opts 'expression)) As a followup, it would be nice to have an =E2=80=98ensure-machine-list=E2= =80=99 or something, similar to how (guix scripts build) has =E2=80=98ensure-manifest= =E2=80=99 & co. to validate its arguments. Thanks, Ludo=E2=80=99. ------------=_1734976023-4884-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Dec 2024 05:41:32 +0000 Received: from localhost ([127.0.0.1]:37050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO9Ht-0001w4-6J for submit@debbugs.gnu.org; Thu, 19 Dec 2024 00:41:32 -0500 Received: from lists.gnu.org ([209.51.188.17]:55832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO9Hn-0001vs-Qu for submit@debbugs.gnu.org; Thu, 19 Dec 2024 00:41:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tO9Hl-0001k3-Pw for guix-patches@gnu.org; Thu, 19 Dec 2024 00:41:22 -0500 Received: from mail-108-mta92.mxroute.com ([136.175.108.92]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO9Hj-00057R-SI for guix-patches@gnu.org; Thu, 19 Dec 2024 00:41:21 -0500 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta92.mxroute.com (ZoneMTA) with ESMTPSA id 193dd6f3940000310e.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 19 Dec 2024 05:41:14 +0000 X-Zone-Loop: 711908e6f95516aed07b838430906f20023c3cfdf391 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vC2fPPQ3ebclo/EJN/1bqNTjO4P71YsrquRJAffpvGk=; b=saJbxX5XGwgc9FbQ3MjXshTq7L nC38pALWWJ/f4L1Sb6m/BZBuSIdv7QyxIjw/JUVgeNpE993qKwDwotPx0wzsFOnBEyJubTPB7q8a+ djdtATiBn9B3cuiDq3qh1klA4E16p4TWVKpnK3i07Opw9Bs/juVduqoFF9kmFMLpCGOKjqSNdLgZu Ji5FKI8MMqnr6NKLJeK7ZlxBgqYcDjv20TbVHKMs72dSMlwju4fMr+hq2s6glmeBJaQJ/QR9bPbPv zd9xU4EGUNmGDDEy7vc6PCW9h1VypM4aWj62tgCFUhda56eemfWbOyXAkHLQqH8FwJyZMwhsABLM7 fmDJkNkg==; From: Richard Sent To: guix-patches@gnu.org Subject: [PATCH] scripts: deploy: Add the expression command line flag. Date: Thu, 19 Dec 2024 00:37:52 -0500 Message-ID: <6a3be28b8325e18076a01b9a9a60d22f4b8b866d.1734586672.git.richard@freakingpenguin.com> MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.92; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta92.mxroute.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Richard Sent X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * guix/scripts/deploy.scm (show-help): Add help. (%options): Add -e and --expression. (guix-deploy): Use expression and check for invalid flag combinations. Change-Id: I200c9ff0c9a8c686efff4a21cd33c10429f3c73e --- Submitting a patch to take care of https://issues.guix.gnu.org/71841. Always struck me as odd that deploy doesn't have a --evaluate flag like many others, so here's a go at it. I didn't update documentation because "invoking guix deploy" still has a TODO stating > @c FIXME/TODO: Separate the API doc from the CLI doc. As is there doesn't seem to be a good place to insert --expression documentation without sidetracking the info page. This'll be useful for me at least as I store my machine list in a channel. guix/scripts/deploy.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index 4b1a603049..941ee199f0 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2019 David Thompson ;;; Copyright © 2019 Jakob L. Kreuze ;;; Copyright © 2020-2022 Ludovic Courtès +;;; Copyright © 2024 Richard Sent ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,6 +60,9 @@ (define (show-help) -V, --version display version information and exit")) (newline) (display (G_ " + -e, --expression=EXPR deploy the list of machines EXPR evaluates to")) + (newline) + (display (G_ " -x, --execute execute the following command on all the machines")) (newline) (display (G_ " @@ -74,6 +78,9 @@ (define %options (lambda args (show-version-and-exit "guix deploy"))) + (option '(#\e "expression") #t #f + (lambda (opt name arg result) + (alist-cons 'expression arg result))) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) @@ -247,10 +254,16 @@ (define-command (guix-deploy . args) (opts (parse-command-line args %options (list %default-options) #:argument-handler handle-argument)) (file (assq-ref opts 'file)) - (machines (and file (load-source-file file))) + (expression (assoc-ref opts 'expression)) + (machines (or (and file (load-source-file file)) + (and expression (read/eval expression)))) (dry-run? (assoc-ref opts 'dry-run?)) (execute-command? (assoc-ref opts 'execute-command?))) - (unless file + (when (and file expression) + (leave (G_ "both '--expression' and a deployment file were provided~%"))) + + (unless (or file + expression) (leave (G_ "missing deployment file argument~%"))) (when (and (pair? command) (not execute-command?)) base-commit: 1a62f687e504c67f26693f3bc60a90e503ab4ea9 -- 2.46.0 ------------=_1734976023-4884-1--