summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-20 21:48:31 +0100
committerLudovic Courtès <ludo@gnu.org>2015-03-20 22:07:28 +0100
commit9eeb3d8c28589cb3398c20593c4ea41a7cfb7249 (patch)
treeded1c34524b528345a83af839cce8898651f74de
parentac85b515211e16f6be38d2d80cd7b0e9041e6623 (diff)
downloadguix-9eeb3d8c28589cb3398c20593c4ea41a7cfb7249.tar.gz
guix package: '-s' displays different packages that have the same location.
Before that, 'guix package -s foobarbaz' would display only one package
when several match but they have the same location (which is common when
using 'inherit'.)

The original rationale was given at
<http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00280.html> but
it was arguably misguided because it led to "real" packages being
hidden.

Reported by Tomáš Čech <sleep_walker@gnu.org>.

* guix/scripts/package.scm (find-packages-by-description)[same-location?]:
  Remove.
  Remove call to 'delete-duplicates'.
-rw-r--r--guix/scripts/package.scm38
1 files changed, 16 insertions, 22 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a24c657ef6..41db191e70 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -240,28 +240,22 @@ DURATION-RELATION with the current time."
 (define (find-packages-by-description rx)
   "Return the list of packages whose name, synopsis, or description matches
 RX."
-  (define (same-location? p1 p2)
-    ;; Compare locations of two packages.
-    (equal? (package-location p1) (package-location p2)))
-
-  (delete-duplicates
-   (sort
-    (fold-packages (lambda (package result)
-                     (define matches?
-                       (cut regexp-exec rx <>))
-
-                     (if (or (matches? (package-name package))
-                             (and=> (package-synopsis package)
-                                    (compose matches? P_))
-                             (and=> (package-description package)
-                                    (compose matches? P_)))
-                         (cons package result)
-                         result))
-                   '())
-    (lambda (p1 p2)
-      (string<? (package-name p1)
-                (package-name p2))))
-   same-location?))
+  (sort
+   (fold-packages (lambda (package result)
+                    (define matches?
+                      (cut regexp-exec rx <>))
+
+                    (if (or (matches? (package-name package))
+                            (and=> (package-synopsis package)
+                                   (compose matches? P_))
+                            (and=> (package-description package)
+                                   (compose matches? P_)))
+                        (cons package result)
+                        result))
+                  '())
+   (lambda (p1 p2)
+     (string<? (package-name p1)
+               (package-name p2)))))
 
 (define-syntax-rule (leave-on-EPIPE exp ...)
   "Run EXP... in a context when EPIPE errors are caught and lead to 'exit'