guix-commits
[Top][All Lists]
Advanced

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

01/05: guix package: Sort search results by package version.


From: guix-commits
Subject: 01/05: guix package: Sort search results by package version.
Date: Thu, 26 May 2022 06:26:24 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 4e13ee4b573f1829fbf41147febac9ca8b919034
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed May 25 23:32:21 2022 +0200

    guix package: Sort search results by package version.
    
    Fixes <https://issues.guix.gnu.org/55480>.
    Reported by Greg Hogan <code@greghogan.com>.
    
    * guix/scripts/package.scm (find-packages-by-description): When PACKAGE1
    and PACKAGE2 have the same name, sort by version.
---
 guix/scripts/package.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 4673cf18b2..99a6cfaa29 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -204,8 +204,12 @@ non-zero relevance score."
                (match m2
                  ((package2 . score2)
                   (if (= score1 score2)
-                      (string>? (package-full-name package1)
-                                (package-full-name package2))
+                      (if (string=? (package-name package1)
+                                    (package-name package2))
+                          (version>? (package-version package1)
+                                     (package-version package2))
+                          (string>? (package-name package1)
+                                    (package-name package2)))
                       (> score1 score2))))))))))
 
 (define (transaction-upgrade-entry store entry transaction)



reply via email to

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