summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-05-25 23:32:21 +0200
committerLudovic Courtès <ludo@gnu.org>2022-05-26 11:41:05 +0200
commit4e13ee4b573f1829fbf41147febac9ca8b919034 (patch)
tree5592f853db00b465e658557323f8f3c2151757f5
parent8dc47f9ee4f471cf4c2499bfbd90d281ba5c5368 (diff)
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.
-rw-r--r--guix/scripts/package.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 4673cf18b23..99a6cfaa297 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -204,8 +204,12 @@ non-zero relevance score."
204 (match m2 204 (match m2
205 ((package2 . score2) 205 ((package2 . score2)
206 (if (= score1 score2) 206 (if (= score1 score2)
207 (string>? (package-full-name package1) 207 (if (string=? (package-name package1)
208 (package-full-name package2)) 208 (package-name package2))
209 (version>? (package-version package1)
210 (package-version package2))
211 (string>? (package-name package1)
212 (package-name package2)))
209 (> score1 score2)))))))))) 213 (> score1 score2))))))))))
210 214
211(define (transaction-upgrade-entry store entry transaction) 215(define (transaction-upgrade-entry store entry transaction)