[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/12: deploy: Add ‘--expression’.
From: |
guix-commits |
Subject: |
05/12: deploy: Add ‘--expression’. |
Date: |
Mon, 23 Dec 2024 14:47:29 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit f1c2681542693caf9846c3ecbeaf73d7ec243f64
Author: Richard Sent <richard@freakingpenguin.com>
AuthorDate: Thu Dec 19 00:37:52 2024 -0500
deploy: Add ‘--expression’.
* 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
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
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 <davet@gnu.org>
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -59,6 +60,9 @@ Perform the deployment specified by FILE.\n"))
-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 @@ Perform the deployment specified by FILE.\n"))
(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 @@ otherwise."
(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?))
- branch master updated (8b94d3d5b1 -> c302b7a596), guix-commits, 2024/12/23
- 03/12: services: syslog: Adjust service for rsyslog compatibility., guix-commits, 2024/12/23
- 07/12: gnu: Add pam-hooks., guix-commits, 2024/12/23
- 04/12: weather: Reword the help message for the expression flag., guix-commits, 2024/12/23
- 01/12: gnu: openmpi@4: Hard-code file name of ‘ssh’ command., guix-commits, 2024/12/23
- 10/12: gnu: proof-general: Update to 4.5-2.d668946., guix-commits, 2024/12/23
- 12/12: gnu: hugs: Fix build with GCC., guix-commits, 2024/12/23
- 11/12: gnu: git: Update to 2.47.1., guix-commits, 2024/12/23
- 05/12: deploy: Add ‘--expression’.,
guix-commits <=
- 02/12: services: syslog: Add extra-options argument to syslog service., guix-commits, 2024/12/23
- 09/12: gnu: passt: Update to 2024_12_11.09478d5., guix-commits, 2024/12/23
- 06/12: gnu: home: Replace rename in update-symlinks scripts., guix-commits, 2024/12/23
- 08/12: gnu: radicale: Update to 3.3.2., guix-commits, 2024/12/23