guix-commits
[Top][All Lists]
Advanced

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

01/01: guix package: '--search' no longer shows superseded packages.


From: Ludovic Courtès
Subject: 01/01: guix package: '--search' no longer shows superseded packages.
Date: Tue, 27 Feb 2018 09:48:01 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 0fb405796cdb5579c911b30da9d40b4a18cd7f07
Author: Ludovic Courtès <address@hidden>
Date:   Tue Feb 27 15:46:56 2018 +0100

    guix package: '--search' no longer shows superseded packages.
    
    Fixes <https://bugs.gnu.org/30566>.
    Reported by Björn Höfling <address@hidden>.
    
    * guix/scripts/package.scm (find-packages-by-description): Ignore
    superseded packages.
    * tests/guix-package.sh: Add test.
---
 guix/scripts/package.scm | 16 ++++++++++------
 tests/guix-package.sh    | 18 +++++++++++++++++-
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 617e102..d8b80ef 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès 
<address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2013, 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2014, 2016 Alex Kost <address@hidden>
@@ -247,11 +247,15 @@ specified in MANIFEST, a manifest object."
 description matches at least one of REGEXPS sorted by relevance, and the list
 of relevance scores."
   (let ((matches (fold-packages (lambda (package result)
-                                  (match (package-relevance package regexps)
-                                    ((? zero?)
-                                     result)
-                                    (score
-                                     (cons (list package score) result))))
+                                  (if (package-superseded package)
+                                      result
+                                      (match (package-relevance package
+                                                                regexps)
+                                        ((? zero?)
+                                         result)
+                                        (score
+                                         (cons (list package score)
+                                               result)))))
                                 '())))
     (unzip2 (sort matches
                   (lambda (m1 m2)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index ffc8c64..760a2e4 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès 
<address@hidden>
+# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès 
<address@hidden>
 # Copyright © 2013 Nikita Karetnikov <address@hidden>
 #
 # This file is part of GNU Guix.
@@ -118,6 +118,22 @@ grep '^name: gnubg' "$tmpfile"
 
 rm -f "$tmpfile"
 
+# Make sure deprecated packages don't show up: <https://bugs.gnu.org/30566>.
+mkdir "$module_dir"
+cat > "$module_dir/foo.scm"<<EOF
+(define-module (foo)
+  #:use-module (guix packages)
+  #:use-module (gnu packages base))
+
+(define-public deprecated
+  (deprecated-package "fileutils" coreutils))
+EOF
+
+guix build -L "$module_dir" -e '(@ (foo) deprecated)' -n
+test "`guix package -L "$module_dir" -s ^fileutils$ | grep ^name:`" = ""
+
+rm -rf "$module_dir"
+
 # Make sure `--search' can display all the packages.
 guix package --search="" > /dev/null
 



reply via email to

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