summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-08-30 14:59:31 +0200
committerLudovic Courtès <ludo@gnu.org>2015-08-30 18:38:08 +0200
commit8c578a609478f808e4350c0140ca0b15c5bed0f2 (patch)
tree4cd62152ea80fd9e748b238be217b79e4edc8af3 /guix/utils.scm
parentb7c7c03eb5e37fc3455e4e17b0898ffc4bca29c3 (diff)
utils: Move 'package-name->name+version' to (guix build utils).
* guix/utils.scm (package-name->name+version): Move to... * guix/build/utils.scm (package-name->name+version): ... here. New procedure. * guix/build/emacs-build-system.scm (package-name->name+version): Remove.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm26
1 files changed, 3 insertions, 23 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 44913c6159..4bfd88fbb3 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -29,7 +29,8 @@
#:use-module (srfi srfi-60)
#:use-module (rnrs bytevectors)
#:use-module ((rnrs io ports) #:select (put-bytevector))
- #:use-module ((guix build utils) #:select (dump-port))
+ #:use-module ((guix build utils)
+ #:select (dump-port package-name->name+version))
#:use-module ((guix build syscalls) #:select (errno mkdtemp!))
#:use-module (ice-9 vlist)
#:use-module (ice-9 format)
@@ -39,6 +40,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (system foreign)
+ #:re-export (package-name->name+version)
#:export (bytevector->base16-string
base16-string->bytevector
@@ -71,7 +73,6 @@
version-prefix
version-major+minor
guile-version>?
- package-name->name+version
string-replace-substring
arguments-from-environment-variable
file-extension
@@ -573,27 +574,6 @@ minor version numbers from version-string."
(micro-version))
str))
-(define (package-name->name+version name)
- "Given NAME, a package name like \"foo-0.9.1b\", return two values:
-\"foo\" and \"0.9.1b\". When the version part is unavailable, NAME and
-#f are returned. The first hyphen followed by a digit is considered to
-introduce the version part."
- ;; See also `DrvName' in Nix.
-
- (define number?
- (cut char-set-contains? char-set:digit <>))
-
- (let loop ((chars (string->list name))
- (prefix '()))
- (match chars
- (()
- (values name #f))
- ((#\- (? number? n) rest ...)
- (values (list->string (reverse prefix))
- (list->string (cons n rest))))
- ((head tail ...)
- (loop tail (cons head prefix))))))
-
(define (file-extension file)
"Return the extension of FILE or #f if there is none."
(let ((dot (string-rindex file #\.)))