From patchwork Fri Jan 3 19:40:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 36418 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 E789027BBE9; Fri, 3 Jan 2025 19:43:22 +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.4 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 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 10DB827BBE2 for ; Fri, 3 Jan 2025 19:43:21 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTnZY-0008T2-0j; Fri, 03 Jan 2025 14:43:04 -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 1tTnZX-0008Ss-5r for guix-patches@gnu.org; Fri, 03 Jan 2025 14:43:03 -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 1tTnZW-00009a-Tn for guix-patches@gnu.org; Fri, 03 Jan 2025 14:43:02 -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:References:In-Reply-To:Date:From:To:Subject; bh=ry15AhjqfgWgo+1TFP333BkDCwuqNUZ/HknXo1r8dgE=; b=vNi7sqSsn0HK+4aFcDw4oQeoxGhIKjluwlg/ud8D6kvFoFXHEqKPaMoivFpJX+zA/e2OuvRXurv3Cjqx/5Jw8uYNEHzZZrOzujt9fvL8QxqAugsg/+euA+NVqz1AZinZvuZqy1G6VXBNyoP+aHjNus1wm0M3UnRKciZK/whPGLe1A54VfJKOBTk7SHkF/YQzz/u0tsOKQ7snT+2m0c+6Z/WFLv3qJncdWmNwVG6EwLPXdQZ8ORqbFufFfSLSISouMEMYBQu/kyVA6TxmB/F/yjhApeNdPRCVcOKWBlCtVlTwxIxIUz1AmGztzM2NYRsm2roLccPuaPnxql9+BXD1/Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTnZW-0004iB-Om; Fri, 03 Jan 2025 14:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75325] [PATCH rust-team 2/2] build-system: cargo: add-dependencies: Silence warning. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2025 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75325 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75325@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 75325-submit@debbugs.gnu.org id=B75325.173593332517992 (code B ref 75325); Fri, 03 Jan 2025 19:43:02 +0000 Received: (at 75325) by debbugs.gnu.org; 3 Jan 2025 19:42:05 +0000 Received: from localhost ([127.0.0.1]:52213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTnYb-0004g7-0I for submit@debbugs.gnu.org; Fri, 03 Jan 2025 14:42:05 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39713 helo=email.rimm.ee) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTnYW-0004ex-0P for 75325@debbugs.gnu.org; Fri, 03 Jan 2025 14:42:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1735933306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ry15AhjqfgWgo+1TFP333BkDCwuqNUZ/HknXo1r8dgE=; b=oxIv/mn8GyqaIaP+h1c11es2Ugcb5NyM7CFXvgMC1L66LhYIqIEjBD+OpkRGSLpGdjZrRW GKCagpywP7GTAwFWQVTs7CSWXAIxvmJXhi3L3V79xbwf/4Yza3DPihR4g8vA2phYDu8hKu Hk3HT1StMs7DFyp2GlD2HVoc5DYofg88A/pOfgNvMWrh5mrgetC4RpttcgEvsnxhLuInW0 X27IBTTejMJtrxxd4gcJ4OOMUuSoCZsKKivDIrkwpjoqhxy2nDbGce05IP3cwPqTHfZJDs Tx73yww57fgBqlMqMNiJvNYbVO1WkS5wIjvnBQDo4CQck3DXNnfcnPesI8zI/Q== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 36c37786 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <75325@debbugs.gnu.org>; Fri, 3 Jan 2025 19:41:46 +0000 (UTC) Date: Fri, 3 Jan 2025 20:40:59 +0100 Message-ID: <2929f9484a26fba24961dfd7fecd4180a7964775.1735932581.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm 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 (add-dependencies): Silence warning. Change-Id: I8691766fc19073719e75c05eb5bfbce45ffc9b80 --- guix/build-system/cargo.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index b22b9247a1c..877ebaec135 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -34,6 +34,7 @@ (define-module (guix build-system cargo) #:use-module (guix platform) #:use-module (guix build-system) #:use-module (guix build-system gnu) + #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 vlist) #:use-module (srfi srfi-1) @@ -51,13 +52,20 @@ (define-module (guix build-system cargo) (define* (add-dependencies dependencies) "DEPENDENCIES is a list of (crate version features). It is formatted and appendended to Cargo.toml." - #~(let ((port (open-file "Cargo.toml" "a"))) - (format port " + (let ((dependencies + (map (match-lambda + ((crate version ()) (list crate version #f)) + ((crate version (? pair? features)) + (list crate version (format #f "~{~s~^,~}" features))) + (dep dep)) + dependencies))) + #~(let ((port (open-file "Cargo.toml" "a"))) + (format port " ~:{[dev-dependencies.~a] version = ~s -~@[features = [~{~s~^,~}]~]~%~}" - '#$dependencies) - (close port))) +~@[features = [~a]~]~%~}" + '#$dependencies) + (close port)))) (define %crate-base-url (make-parameter "https://crates.io"))