From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id qDjIBjyyY2fnnwAA62LTzQ:P1 (envelope-from ) for ; Thu, 19 Dec 2024 05:42:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id qDjIBjyyY2fnnwAA62LTzQ (envelope-from ) for ; Thu, 19 Dec 2024 06:42:20 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=q9R0z3cJ; dkim=fail ("headers rsa verify failed") header.d=freakingpenguin.com header.s=x header.b=saJbxX5X; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734586940; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=vC2fPPQ3ebclo/EJN/1bqNTjO4P71YsrquRJAffpvGk=; b=rbptUDL0TEAEontmIO0loaikx5P3DMO/ZN+D0s3r8TdFM31+GjJOkxIZnDpv0yRYAmDJat fkbId6QmSN6jlHsiuDGI/oUOeNiE82WPsgQ98vMRmgniJ8y29ZhGfGMIfcfvFLZ0tLqNeV KJ4l8FNwTpuK2WD1Abq6IVM1dbP8CeCPlTcn3PpDFR8bMTqhhWIsD10kbtixzc9jr2o2yS F9Nd6+PcsIPLNE5qSb22B/FM0atqec5aUptGYk9UWzkF8bq5FYbTrqWjlz9oTQSlgbiSFJ 8NMRF+pCsLvN3Ubsr5v+6geqQ8MKLvtdh+Yp4k7reKvtvRNHu+rQzF8MjsPfww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734586940; a=rsa-sha256; cv=none; b=nPzA8y0YHSUrofnTX35gGYB7zLPYkLpuoq+VcO0ImdOx4gxWC6XCDz7PFIbGw3HOczrgRQ Yvl9vJGVz6Erelinfu1zxqjj7Nh0+7GY0fDGMBOVwUnocfeTWCK7SSejn4KEwhKko0tI1T c8h+r5uI9wDBdWAs84qcmjQaLlVuVM10pI6jYE4jEjAHm6bWhNYVRHeHKMuRsdffzhTSs1 xGFMx94vu36BZ28ey5rDoWEAZZ6rHTalo0V3EabwwYlRD+A5dzUgvrNi+294JirPfWSVlR Ket4hSe/0H0u+FCT9J6ZCLVW3O8N3EXXpkykJRugYHePxHh3iLhNj2BUtl6+rA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=q9R0z3cJ; dkim=fail ("headers rsa verify failed") header.d=freakingpenguin.com header.s=x header.b=saJbxX5X; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BBAE3921A2 for ; Thu, 19 Dec 2024 06:42:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO9IW-0001mW-Kp; Thu, 19 Dec 2024 00:42:08 -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 1tO9IV-0001mN-9X for guix-patches@gnu.org; Thu, 19 Dec 2024 00:42:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tO9IU-0005H7-Iq; Thu, 19 Dec 2024 00:42:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=vC2fPPQ3ebclo/EJN/1bqNTjO4P71YsrquRJAffpvGk=; b=q9R0z3cJFyMXDBXI+N4pPhur9RVhyef0AwQXwT+sPwMgZgnqHuUesNdyQZIuJermuD0In+OwR0tYPnR1dhs8fA7ulau4iXVsYVRSooLHJdwI/Imc0BSPNd7XS05haEA7Te2HCUOZ1vsIAXj5x9AAqwtu9VwnD5tBj3gGfOQMMonvmHIyRrmRa4jHFc2A9TwBheVFo+oJxXoyV4AWnbEfQw16YgKaZfNK8kTjzOYFkwpeyhHDiJ5y8LWlBoYBv5Uk8Rtl0u0dEFdcseeS0kO52totrCvHmQCe/ZPK0DKPenjKPaEfdFXZO7PS/HUTUHOus8dNSJeEmCLzT4nOswd5Fw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO9IQ-0001xC-Cp; Thu, 19 Dec 2024 00:42:02 -0500 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-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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.37 X-Spam-Score: -6.37 X-Migadu-Queue-Id: BBAE3921A2 X-TUID: sw9epkedTOZY * 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