From patchwork Sat Mar 15 11:59:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 40198 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 9797727BBE9; Sat, 15 Mar 2025 12:03:07 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED,URIBL_SBL_A autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3FF9627BBE2 for ; Sat, 15 Mar 2025 12:03:05 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ttQE2-0001r3-Ga; Sat, 15 Mar 2025 08:02:57 -0400 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 1ttQCR-0001Xa-Dx for guix-patches@gnu.org; Sat, 15 Mar 2025 08:01:13 -0400 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 1ttQCP-0004XZ-Af; Sat, 15 Mar 2025 08:01:06 -0400 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=FGXgDgrCXsFk9TqbBsbdRaqw2UpoeqA6bhHdeTN65MI=; b=PygMWBtkfdAuAkPto3+t5KIz5GSByCh15GFQIcXAYm+QkXPvWrcg3t878dCdPPUmdLvwHkaw/NmGeMk3Hn6jfokPjZlWi60GEYmAjG7EcDuwCvSy8pHlitdkii5I21opZb2tDIjN9KpgzWN5cL/AKSwm1Tz9chFc0fjuAIBwvRDBh1u0W6arkABGw9Uhji3Qd5NVMfVnEJyI5E91Cb3HH9ecQPaN2cWny/ikmcmDNhcVUq9LXVzxfHKd9sY0mpmPuoXaBRc5SBP40pfghQ/BUvRw6Gt8wcyDuUo6WizJYE9EcmVz82I0sV1evDsmyzQURKdVHdNhp69+5PAH+7/u6A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ttQCM-0008A2-4P; Sat, 15 Mar 2025 08:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77033] [PATCH] deploy: Support --target and --system. Resent-From: Sergey Trofimov 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: Sat, 15 Mar 2025 12:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77033 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77033@debbugs.gnu.org Cc: Sergey Trofimov , 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.174204004331297 (code B ref -1); Sat, 15 Mar 2025 12:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Mar 2025 12:00:43 +0000 Received: from localhost ([127.0.0.1]:39424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttQC3-00088g-1M for submit@debbugs.gnu.org; Sat, 15 Mar 2025 08:00:43 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43416) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttQBv-000862-ON for submit@debbugs.gnu.org; Sat, 15 Mar 2025 08:00:37 -0400 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 1ttQBW-0001IX-Ac for guix-patches@gnu.org; Sat, 15 Mar 2025 08:00:12 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ttQBT-0004Jc-QU for guix-patches@gnu.org; Sat, 15 Mar 2025 08:00:10 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-ac2bfcd2a70so399571066b.0 for ; Sat, 15 Mar 2025 05:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1742040004; x=1742644804; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FGXgDgrCXsFk9TqbBsbdRaqw2UpoeqA6bhHdeTN65MI=; b=aZPyP1btE4lUoyQCNcGxS36EcanEN0CqvNdW+PuxFhUHpAgLWTDX0XTBhEWuXsl5cG Aucyv6/Q0t9nLxJpxTJTvBEuYxQxaC748k3F7CGRNCFylC1lvzuVaNwfYdG1b28x/FJg k/spXGd0/Kbpg3uUwYGT56w9sY8EDZJdbPFkJPDWcmTVVnF3EiXCsD/2m7eQN0IYBcuB EgcySAxBdOzQ4Q+XMgcxXyZGkfkxRn4CvZkrg84xZPahsyuPpv9tjEY2u9zHxsikDxcq YZRLAcy6Q8/+K3CERqiayI7/8VkIAULHDemZMN2uBcdoGGE3fLsNLMpI0RUIVqHD4kqK EwDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742040004; x=1742644804; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FGXgDgrCXsFk9TqbBsbdRaqw2UpoeqA6bhHdeTN65MI=; b=WjFpwsRIuNxlvLyGv6ugPXJK0/Z3Zt4xDHeeulcEmFZ15nT//pmbEN/tT2XX6aLlgG Yl3+QhueSenJm7OrR2giQDSlR4+WsyoLIye1TsHOz2060hEpz3p69AfT1g0KPWuSWcde GnXtoL4ixrtZKPyU7OubyiEhr/clk8RZg9HVOsMHsHpbMYcn5N/mvGKQ1G3hXXDmqQ5y WXggQ0CoWMCZgHOsQ6FD3Rj0wU19FB1IdPBpy42F+53lD2/NceSZSUlkevMWzxk16dB1 2y0Zrh4IF9SpDtBlsONIw70Gd/miEuFEVPI5QP9loCmJVMK6F5FQrtd9hgo5DwypZJc7 guJA== X-Gm-Message-State: AOJu0YzYuMM4tPoJSJoh+MUqvdjvo5qwTUS17+juFzxt0OFLytzxF0Cv AvKeFslaoVgWw+5iQbq+S1B72aZEuZjdfgAB9WeBvSBYAAD0brQyz5gEk0e7zKWI29lXVBQaqre wwoA= X-Gm-Gg: ASbGnct8vmvsQpzzD2A4K6vBDzqYyZ35NM4FWhnLjzkBfMOAP71BISFhZpI9Rs+uz8D UhpT3tcCI3ZzxNdLvgItbmJLuuCz4KQL/NvCY//II9WBf8s4WHTTNnSLbNM4TMXfoE+qAfwKNOl 2FA82m5ZaQpFyznxZbY6YYQYUWtA0A+s0VdbQV0I4X9CGp11cR6cvGVtayNuuUW/HCk84fWfCYl clI3SI/DpRgvB6r2C7l1tQEbszON7dyoNrb91LCny/qwNW+WAaL+MHjTezrKqi7aEJevhP074c0 5uP0Mo1md5LehdLfh6DoxIFBWteOxH6iqkURFtt/PTi/Rinp6NYC X-Google-Smtp-Source: AGHT+IEPyitDk4cWYU5OWPYvY9NfK644BmJHTijtSZIX6Rx6Zhami6sQDxEq8GLiJIpvNXG3VRs3/Q== X-Received: by 2002:a17:906:7308:b0:ac2:e059:dc03 with SMTP id a640c23a62f3a-ac3303f75d1mr639140666b.38.1742040003528; Sat, 15 Mar 2025 05:00:03 -0700 (PDT) Received: from localhost ([2a02:2454:a0a5:2400:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac314a4a2b3sm362363566b.139.2025.03.15.05.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Mar 2025 05:00:03 -0700 (PDT) Date: Sat, 15 Mar 2025 12:59:59 +0100 Message-ID: <8c06c68ca3d216132db868e92ec5db40fe566633.1742039992.git.sarg@sarg.org.ru> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=sarg@sarg.org.ru; helo=mail-ej1-x62c.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 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: , Reply-to: Sergey Trofimov X-ACL-Warn: , Sergey Trofimov via Guix-patches X-Patchwork-Original-From: Sergey Trofimov via Guix-patches via From: Sergey Trofimov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/deploy.scm: Support native and cross build options. --- guix/scripts/deploy.scm | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) base-commit: 412f411d4f8780e6b60b448caae17f01c09be0eb prerequisite-patch-id: f9cc903b8048c8c6fde576fbf38ab110263020e3 diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index e2ef0006e0..94e0d69936 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -26,6 +26,7 @@ (define-module (guix scripts deploy) #:use-module (guix scripts) #:use-module (guix scripts build) #:use-module (guix store) + #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix ui) #:use-module ((guix status) #:select (with-status-verbosity)) @@ -54,6 +55,8 @@ (define (show-help) (display (G_ "Usage: guix deploy [OPTION] FILE... Perform the deployment specified by FILE.\n")) (show-build-options-help) + (show-cross-build-options-help) + (show-native-build-options-help) (newline) (display (G_ " -h, --help display this help and exit")) @@ -93,21 +96,22 @@ (define %options (option '(#\x "execute") #f #f (lambda (opt name arg result) (alist-cons 'execute-command? #t result))) - (option '(#\s "system") #t #f - (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) (option '(#\v "verbosity") #t #f (lambda (opt name arg result) (let ((level (string->number* arg))) (alist-cons 'verbosity level (alist-delete 'verbosity result))))) - %standard-build-options)) + (append + %standard-build-options + %standard-native-build-options + %standard-cross-build-options))) (define %default-options ;; Alist of default option values. `((verbosity . 1) + (system . ,(%current-system)) + (target . #f) (debug . 0) (graft? . #t) (substitutes? . #t) @@ -186,9 +190,13 @@ (define (deploy-machine* store machine) (when (deploy-error-should-roll-back c) (info (G_ "rolling back ~a...~%") (machine-display-name machine)) - (run-with-store store (roll-back-machine machine))) + (run-with-store store (roll-back-machine machine) + #:system (%current-system) + #:target (%current-target-system))) (apply throw (deploy-error-captured-args c)))) - (run-with-store store (deploy-machine machine)) + (run-with-store store (deploy-machine machine) + #:system (%current-system) + #:target (%current-target-system)) (info (G_ "successfully deployed ~a~%") (machine-display-name machine)))) @@ -266,7 +274,9 @@ (define (invoke-command store machine command) (loop (cons line lines)))))))) (match (run-with-store store - (machine-remote-eval machine invocation)) + (machine-remote-eval machine invocation) + #:system (%current-system) + #:target (%current-target-system)) ((code output) (match code ((? zero?) @@ -325,7 +335,9 @@ (define-command (guix-deploy . args) #:verbosity (assoc-ref opts 'verbosity) #:dry-run? dry-run?) - (parameterize ((%graft? (assq-ref opts 'graft?))) + (parameterize ((%graft? (assq-ref opts 'graft?)) + (%current-target-system (assoc-ref opts 'target)) + (%current-system (assoc-ref opts 'system))) (if execute-command? (match command (("--" command ..1)