summary refs log tree commit diff
path: root/guix-package.in
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-04 01:29:18 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-04 01:29:18 +0100
commit9b48fb88ca8177c987b0d3bf2e9ae46dac782430 (patch)
tree03cc3b7428339c1b9ba250dba3dd1aa6365f0d34 /guix-package.in
parentd388c2c435395aee61dc074023b1f218e6037545 (diff)
downloadguix-9b48fb88ca8177c987b0d3bf2e9ae46dac782430.tar.gz
utils: Add `package-name->name+version'.
* guix/utils.scm (package-name->name+version): New procedure.
* guix-package.in (guix-package)[find-package]: Use it.
* tests/utils.scm ("package-name->name+version"): New test.
Diffstat (limited to 'guix-package.in')
-rw-r--r--guix-package.in7
1 files changed, 1 insertions, 6 deletions
diff --git a/guix-package.in b/guix-package.in
index ed46a26ffb..41716d3ecc 100644
--- a/guix-package.in
+++ b/guix-package.in
@@ -283,8 +283,6 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
     ;; Find the package NAME; NAME may contain a version number and a
     ;; sub-derivation name.
     (define request name)
-    (define versioned-rx
-      (make-regexp "^(.*)-([0-9][^-]*)$"))
 
     (let*-values (((name sub-drv)
                    (match (string-rindex name #\:)
@@ -292,10 +290,7 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
                      (colon (values (substring name (+ 1 colon))
                                     (substring name colon)))))
                   ((name version)
-                   (match (regexp-exec versioned-rx name)
-                     (#f    (values name #f))
-                     (m     (values (match:substring m 1)
-                                    (match:substring m 2))))))
+                   (package-name->name+version name)))
       (match (find-packages-by-name name version)
         ((p)
          (list name version sub-drv p))