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.
This commit is contained in:
Ludovic Courtès 2022-05-25 23:32:21 +02:00
parent 8dc47f9ee4
commit 4e13ee4b57
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -204,8 +204,12 @@ non-zero relevance score."
(match m2 (match m2
((package2 . score2) ((package2 . score2)
(if (= score1 score2) (if (= score1 score2)
(string>? (package-full-name package1) (if (string=? (package-name package1)
(package-full-name package2)) (package-name package2))
(version>? (package-version package1)
(package-version package2))
(string>? (package-name package1)
(package-name package2)))
(> score1 score2)))))))))) (> score1 score2))))))))))
(define (transaction-upgrade-entry store entry transaction) (define (transaction-upgrade-entry store entry transaction)