guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#74849] [PATCH v2 3/6] import: utils: Move guix-name to (guix utils)


From: Herman Rimm
Subject: [bug#74849] [PATCH v2 3/6] import: utils: Move guix-name to (guix utils).
Date: Thu, 19 Dec 2024 23:10:32 +0100

* guix/import/elpa.scm: Import (guix utils).
* guix/import/texlive.scm (guix-name): Remove.
* guix/import/utils.scm (guix-name): Move to ...
* guix/utils.scm (guix-name): ... here.

Change-Id: If56a452f64ed06c8bb06a96a283a5067cb54d602
---
 guix/import/elpa.scm    |  1 +
 guix/import/texlive.scm | 10 +---------
 guix/import/utils.scm   | 10 ----------
 guix/utils.scm          |  9 +++++++++
 4 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 46b6dc98a2..11559097b5 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -44,6 +44,7 @@ (define-module (guix import elpa)
   #:use-module (guix git)
   #:use-module (guix hash)
   #:use-module (guix store)
+  #:use-module ((guix utils) #:select (guix-name))
   #:use-module (guix base32)
   #:use-module (guix upstream)
   #:use-module (guix packages)
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index 6d04cc25ee..b2e99c40f2 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -35,6 +35,7 @@ (define-module (guix import texlive)
   #:use-module (guix store)
   #:use-module (guix svn-download)
   #:use-module (guix upstream)
+  #:use-module ((guix utils) #:select (guix-name))
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
   #:use-module (ice-9 popen)
@@ -334,15 +335,6 @@ (define string->license
     ((lst ...) `(list ,@(map string->license lst)))
     (x `(error unknown-license ,x))))
 
-(define (guix-name name)
-  "Return a Guix package name for a given Texlive package NAME."
-  (string-append "texlive-"
-                 (string-map (match-lambda
-                               (#\_ #\-)
-                               (#\. #\-)
-                               (chr (char-downcase chr)))
-                             name)))
-
 (define* (filter-depends depends #:optional texlive-only)
   "Filter upstream package names DEPENDS to include only their equivalent Guix
 package names, without \"texlive-\" prefix.  When TEXLIVE-ONLY is true, ignore
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index e45c8dfb20..058d2bc094 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -82,8 +82,6 @@ (define-module (guix import utils)
             read-lines
             chunk-lines
 
-            guix-name
-
             recursive-import))
 
 (define (factorize-uri uri version)
@@ -612,14 +610,6 @@ (define* (chunk-lines lines #:optional (pred string-null?))
             (reverse res)
             (loop (cdr after) res))))))
 
-(define (guix-name prefix name)
-  "Return a Guix package name for a given package name."
-  (string-append prefix (string-map (match-lambda
-                                      (#\_ #\-)
-                                      (#\. #\-)
-                                      (chr (char-downcase chr)))
-                                    name)))
-
 (define (topological-sort nodes
                           node-dependencies
                           node-name)
diff --git a/guix/utils.scm b/guix/utils.scm
index 537d0490e0..dfa8f0f19b 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -91,6 +91,7 @@ (define-module (guix utils)
             %current-system
             %current-target-system
             package-name->name+version
+            guix-name
             target-linux?
             target-hurd?
             system-hurd?
@@ -706,6 +707,14 @@ (define* (package-name->name+version spec
     (idx (values (substring spec 0 idx)
                  (substring spec (1+ idx))))))
 
+(define (guix-name prefix name)
+  "Return a Guix package name for a given package name."
+  (string-append prefix (string-map (match-lambda
+                                      (#\_ #\-)
+                                      (#\. #\-)
+                                      (chr (char-downcase chr)))
+                                    name)))
+
 (define* (target-linux? #:optional (target (or (%current-target-system)
                                                (%current-system))))
   "Does the operating system of TARGET use the Linux kernel?"
-- 
2.45.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]