Subject: [bug#77093] [PATCH v4 rust-team 06/22] import: crate: crate-name->package-name: Move to (guix build-system cargo).

From: Hilton Chain <[email-masked]>
Date: Tue, 29 Apr 2025 00:23:03 +0800

* guix/import/crate.scm (crate-name->package-name): Move to...
* guix/build-system/cargo.scm (crate-name->package-name): ...here and export.

Change-Id: Ie9813179d6c40d159956cc1e2ae59a74dea0a42d
---
 guix/build-system/cargo.scm | 6 +++++-
 guix/import/crate.scm       | 5 -----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 452f7f78d0..f2ffc67879 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -44,7 +44,8 @@ (define-module (guix build-system cargo)
             %crate-base-url
             crate-url
             crate-url?
-            crate-uri))
+            crate-uri
+            crate-name->package-name))
 
 (define %crate-base-url
   (make-parameter "https://crates.io"))
@@ -58,6 +59,9 @@ (define (crate-uri name version)
 to NAME and VERSION."
   (string-append crate-url name "/" version "/download"))
 
+(define (crate-name->package-name name)
+  (downstream-package-name "rust-" name))
+
 (define (default-rust target)
   "Return the default Rust package."
   ;; Lazily resolve the binding to avoid a circular dependency.
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 5a8caeb3e1..14e6e28c5b 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -481,10 +481,6 @@ (define (guix-package->crate-name package)
     (match parts
       ((name _ ...) name))))
 
-(define (crate-name->package-name name)
-  (downstream-package-name "rust-" name))
-
-
 
 ;;;
 ;;; Updater
@@ -528,4 +524,3 @@ (define %crate-updater
    (description "Updater for crates.io packages")
    (pred crate-package?)
    (import import-release)))
-
-- 
2.49.0