guix package: '-s' sorts packages by name, then by version.
Before that it would sort them by name only, so the order in which two packages with the same name but a different version would appear was non-deterministic. Reported by Tomáš Čech <sleep_walker@gnu.org>. * guix/scripts/package.scm (find-packages-by-description)[version<?]: New variable. Change the 2nd argument to 'sort' to use 'string-compare' and resort to 'version<?' when P1 and P2 have the same name.
This commit is contained in:
parent
9eeb3d8c28
commit
051edc95f1
1 changed files with 7 additions and 2 deletions
|
@ -240,6 +240,8 @@ DURATION-RELATION with the current time."
|
||||||
(define (find-packages-by-description rx)
|
(define (find-packages-by-description rx)
|
||||||
"Return the list of packages whose name, synopsis, or description matches
|
"Return the list of packages whose name, synopsis, or description matches
|
||||||
RX."
|
RX."
|
||||||
|
(define version<? (negate version>=?))
|
||||||
|
|
||||||
(sort
|
(sort
|
||||||
(fold-packages (lambda (package result)
|
(fold-packages (lambda (package result)
|
||||||
(define matches?
|
(define matches?
|
||||||
|
@ -254,8 +256,11 @@ RX."
|
||||||
result))
|
result))
|
||||||
'())
|
'())
|
||||||
(lambda (p1 p2)
|
(lambda (p1 p2)
|
||||||
(string<? (package-name p1)
|
(case (string-compare (package-name p1) (package-name p2)
|
||||||
(package-name p2)))))
|
(const '<) (const '=) (const '>))
|
||||||
|
((=) (version<? (package-version p1) (package-version p2)))
|
||||||
|
((<) #t)
|
||||||
|
(else #f)))))
|
||||||
|
|
||||||
(define-syntax-rule (leave-on-EPIPE exp ...)
|
(define-syntax-rule (leave-on-EPIPE exp ...)
|
||||||
"Run EXP... in a context when EPIPE errors are caught and lead to 'exit'
|
"Run EXP... in a context when EPIPE errors are caught and lead to 'exit'
|
||||||
|
|
Reference in a new issue