summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-08 17:59:45 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-08 19:07:58 +0200
commitdc794a723809f0f28e49e4c32e8974b5b9a98ff0 (patch)
tree54f4863bec165af1eac176aa4a4a46f5a44d4fc1
parentae768308575051050f71dabdb15d0b71223f1c2a (diff)
downloadguix-dc794a723809f0f28e49e4c32e8974b5b9a98ff0.tar.gz
gnu-maintenance: Replace 'find-packages' with 'find-package' (singular).
Fixes <http://bugs.gnu.org/23718>.
Reported by Efraim Flashner <efraim@flashner.co.il>.

* guix/gnu-maintenance.scm (find-packages): Remove.
(find-package): New procedure.
* guix/import/gnu.scm (gnu->guix-package): Use 'find-package' instead of
'find-packages' and adjust accordingly.
-rw-r--r--guix/gnu-maintenance.scm15
-rw-r--r--guix/import/gnu.scm10
2 files changed, 12 insertions, 13 deletions
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index adb62aa68c..0dd08bf535 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -48,7 +48,7 @@
             gnu-package-download-url
 
             official-gnu-packages
-            find-packages
+            find-package
             gnu-package?
 
             release-file?
@@ -155,13 +155,12 @@ to fetch the list of GNU packages over HTTP."
          (close-port port)
          lst)))
 
-(define (find-packages regexp)
-  "Find GNU packages which satisfy REGEXP."
-  (let ((name-rx (make-regexp regexp)))
-    (filter (lambda (package)
-              (false-if-exception
-               (regexp-exec name-rx (gnu-package-name package))))
-            (official-gnu-packages))))
+(define (find-package name)
+  "Find GNU package called NAME and return it.  Return #f if it was not
+found."
+  (find (lambda (package)
+          (string=? name (gnu-package-name package)))
+        (official-gnu-packages)))
 
 (define gnu-package?
   (memoize
diff --git a/guix/import/gnu.scm b/guix/import/gnu.scm
index 2cfb46beb9..bbb17047f0 100644
--- a/guix/import/gnu.scm
+++ b/guix/import/gnu.scm
@@ -111,13 +111,13 @@ details.)"
   (match (latest-release name)
     ((? upstream-source? release)
      (let ((version (upstream-source-version release)))
-       (match (find-packages (regexp-quote name))
-         ((info . _)
-          (gnu-package->sexp info release #:key-download key-download))
-         (()
+       (match (find-package name)
+         (#f
           (raise (condition
                   (&message
-                   (message "couldn't find meta-data for GNU package"))))))))
+                   (message "couldn't find meta-data for GNU package")))))
+         (info
+          (gnu-package->sexp info release #:key-download key-download)))))
     (_
      (raise (condition
              (&message