From patchwork Sun Mar 23 07:23:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 40704 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 65BD527BBEA; Sun, 23 Mar 2025 07:26:45 +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=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham 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 EF3CB27BBE2 for ; Sun, 23 Mar 2025 07:26:44 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twFih-0008WR-OT; Sun, 23 Mar 2025 03:26:07 -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 1twFie-0008R1-9X for guix-patches@gnu.org; Sun, 23 Mar 2025 03:26:04 -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 1twFid-0007Q9-Vv; Sun, 23 Mar 2025 03:26:04 -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:References:In-Reply-To:Date:From:To:Subject; bh=23lhd6o6dULzhofljL9UaScmfBPSTipNmygrpe7uEkk=; b=q4qaqGgon2UueFehDlndLNYpkhBEI13CkgQUglA4/ZdTiZzLq2QmJY6SLTMv2kkMTEw739JySCivH2Nol0uOm/KMz1SJFO9EgUWt88tfs9jsyxttmv6243xHGl8WTBI19AheLlwrm3VgXUEASuVtuWlt1SSPrJaZ9enQg5Rj2LWt4ShGbjt1sVHp/oY+8IUpwswBVvmuQP1zi89CYIuDu+3Y+8jc3lU1c+tglWtBDxOFURjP1du3P1ZhNuJI2vxqI+BLCWSIz6FObruUBPhNYcHEUNDVyvVDOxba9EKsgLueDz4xy2f8c2oWuu0usUjWpmGPafhUU0z6w061FSHytw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1twFid-0003er-Q8; Sun, 23 Mar 2025 03:26:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH rust-team v3 04/17] build-system: cargo: Support installing Cargo workspace. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, efraim@flashner.co.il, maxim.cournoyer@gmail.com, divya@subvertising.org, ludo@gnu.org, steve@futurile.net, guix-patches@gnu.org Resent-Date: Sun, 23 Mar 2025 07:26:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Efraim Flashner , Maxim Cournoyer , Divya Ranjan Pattanaik , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Steve George X-Debbugs-Original-Xcc: Hilton Chain , Efraim Flashner , Maxim Cournoyer , Divya Ranjan Pattanaik , Ludovic =?utf-8?q?Court?= =?utf-8?q?=C3=A8s?= , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174271473513745 (code B ref 77093); Sun, 23 Mar 2025 07:26:03 +0000 Received: (at 77093) by debbugs.gnu.org; 23 Mar 2025 07:25:35 +0000 Received: from localhost ([127.0.0.1]:47269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twFi9-0003ZV-TR for submit@debbugs.gnu.org; Sun, 23 Mar 2025 03:25:34 -0400 Received: from mx.boiledscript.com ([88.99.243.112]:48142) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1twFhv-0003XK-5C for 77093@debbugs.gnu.org; Sun, 23 Mar 2025 03:25:20 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1742714718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23lhd6o6dULzhofljL9UaScmfBPSTipNmygrpe7uEkk=; b=Bh5axcsuvPPBy6yGuBZly/qOTqxcL6lWMdcwhEAUD1ZHyWxpKKX5zc1yk42d4TiTMMQfZt Few+0Zl/0qYq6C/xtBjdZ22Yhgf/5rcqtMCmulH0TrNrV3TQ92G9lti2AVK+Ggy5O5U53F TwemPSZFp8vHMZuVoNPQV9DpBqwUM7KC0hyOoGntM1ibG68wy1zPvZwqPjr6B1y37vgcc2 dSY7riBHB7Vzekw/rGYKWMpKyS0zIjZ6pSD5s9p/j6OFOS9KswkK6m32smMH3j9bFNYrlP TQ4IPT5WlRdv7zAymA937JSqCqFG1DvIynRUEmJRQX00Fx/Y2SbV78Nbe9lzCw== Date: Sun, 23 Mar 2025 15:23:08 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches *guix/build-system/cargo.scm (cargo-build,cargo-cross-build) [#:cargo-install-paths]: New argument. * guix/build/cargo-build-system.scm (install): Use it. * doc/guix.texi (Build Systems)[cargo-build-system]: Document it. Change-Id: I74ed1972a5716da05afeac8edb2b0e4b6834bf40 --- doc/guix.texi | 5 ++++- guix/build-system/cargo.scm | 4 ++++ guix/build/cargo-build-system.scm | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0089f9e60f..7fa986b4b9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9369,7 +9369,10 @@ Build Systems library crates to package in the @code{package} phase. Specified crates are packaged from left to right, in case there's dependency among them. For example, specifying @code{''("pcre2-sys" "pcre2")} will package -@code{"pcre2-sys"} first and then @code{"pcre2"}. +@code{"pcre2-sys"} first and then @code{"pcre2"}. Parameter +@code{#:cargo-install-paths} (default: @code{''()}) allows specifying paths of +binary crates to install in the @code{install} phase, @code{''("crates/atuin")}, +for example. @end defvar @defvar chicken-build-system diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 4f6d46e70c..4486c706a1 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -96,6 +96,7 @@ (define* (cargo-build name inputs (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (features ''()) (skip-build? #f) (parallel-build? #t) @@ -125,6 +126,7 @@ (define* (cargo-build name inputs #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet system) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? @@ -158,6 +160,7 @@ (define* (cargo-cross-build name (cargo-test-flags ''()) (cargo-package-crates ''()) (cargo-package-flags ''("--no-metadata" "--no-verify")) + (cargo-install-paths ''()) (cargo-target (cargo-triplet (or target system))) (features ''()) (skip-build? #f) @@ -190,6 +193,7 @@ (define* (cargo-cross-build name #:cargo-test-flags #$(sexp->gexp cargo-test-flags) #:cargo-package-crates #$(sexp->gexp cargo-package-crates) #:cargo-package-flags #$(sexp->gexp cargo-package-flags) + #:cargo-install-paths #$(sexp->gexp cargo-install-paths) #:cargo-target #$(cargo-triplet (or target system)) #:features #$(sexp->gexp features) #:skip-build? #$skip-build? diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 51a45b4eab..67311fc850 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -377,6 +377,7 @@ (define* (install #:key skip-build? install-source? features + (cargo-install-paths '()) #:allow-other-keys) "Install a given Cargo package." (let* ((out (assoc-ref outputs "out")) @@ -391,10 +392,18 @@ (define* (install #:key ;; Only install crates which include binary targets, ;; otherwise cargo will raise an error. (or skip-build? - (not (has-executable-target?)) - (invoke "cargo" "install" "--offline" "--no-track" - "--path" "." "--root" out - "--features" (string-join features))) + ;; NOTE: Cargo workspace installation support: + ;; #:skip-build? #f + #:cargo-install-paths. + (and (null? cargo-install-paths) + (not (has-executable-target?))) + (for-each + (lambda (path) + (invoke "cargo" "install" "--offline" "--no-track" + "--path" path "--root" out + "--features" (string-join features))) + (if (null? cargo-install-paths) + '(".") + cargo-install-paths))) (when install-source? ;; Install crate tarballs and unpacked sources for later use.