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
|
@ -240,6 +240,8 @@ DURATION-RELATION with the current time."
|
|||
(define (find-packages-by-description rx)
|
||||
"Return the list of packages whose name, synopsis, or description matches
|
||||
RX."
|
||||
(define version<? (negate version>=?))
|
||||
|
||||
(sort
|
||||
(fold-packages (lambda (package result)
|
||||
(define matches?
|
||||
|
@ -254,8 +256,11 @@ RX."
|
|||
result))
|
||||
'())
|
||||
(lambda (p1 p2)
|
||||
(string<? (package-name p1)
|
||||
(package-name p2)))))
|
||||
(case (string-compare (package-name p1) (package-name p2)
|
||||
(const '<) (const '=) (const '>))
|
||||
((=) (version<? (package-version p1) (package-version p2)))
|
||||
((<) #t)
|
||||
(else #f)))))
|
||||
|
||||
(define-syntax-rule (leave-on-EPIPE exp ...)
|
||||
"Run EXP... in a context when EPIPE errors are caught and lead to 'exit'
|
||||
|
|
Loading…
Reference in New Issue