GNU bug report logs - #75325
[PATCH rust-team 0/2] Add add-dependencies procedure.

Previous Next

Package: guix-patches;

Reported by: Herman Rimm <herman <at> rimm.ee>

Date: Fri, 3 Jan 2025 19:41:02 UTC

Severity: normal

Tags: patch

Full log


Message #8 received at 75325 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 75325 <at> debbugs.gnu.org
Subject: [PATCH rust-team 1/2] build-system: cargo: Add add-dependencies
 procedure.
Date: Fri,  3 Jan 2025 20:40:58 +0100
* guix/build-system/cargo.scm (add-dependencies): Add procedure.

Change-Id: I5385d136697bb6d41a5bd4f6120150f841369a04
---
 guix/build-system/cargo.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 452f7f78d01..b22b9247a1c 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov <at> gmail.com>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;; Copyright © 2021, 2024 Efraim Flashner <efraim <at> flashner.co.il>
-;;; Copyright © 2024 Herman Rimm <herman <at> rimm.ee>
+;;; Copyright © 2024-2025 Herman Rimm <herman <at> rimm.ee>
 ;;; Copyright © 2024 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -38,7 +38,8 @@ (define-module (guix build-system cargo)
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
-  #:export (%cargo-build-system-modules
+  #:export (add-dependencies
+            %cargo-build-system-modules
             %cargo-utils-modules
             cargo-build-system
             %crate-base-url
@@ -46,6 +47,18 @@ (define-module (guix build-system cargo)
             crate-url?
             crate-uri))
 
+;; TODO: Move to (guix build cargo-utils).
+(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 "
+~:{[dev-dependencies.~a]
+version = ~s
+~@[features = [~{~s~^,~}]~]~%~}"
+              '#$dependencies)
+      (close port)))
+
 (define %crate-base-url
   (make-parameter "https://crates.io"))
 (define crate-url
-- 
2.45.2





This bug report was last modified 163 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.