upstream: Sort '%updaters' alphabetically.

Previously the output of 'guix refresh --list-updaters' would be
non-deterministic, and likewise the order in which updaters are tried
would be non-deterministic.

Reported by zimoun <zimon.toutoune@gmail.com>.

* guix/upstream.scm (%updaters): Add call to 'sort'.
This commit is contained in:
Ludovic Courtès 2022-07-18 13:16:04 +02:00
parent d519305d83
commit e87c6fb95a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 11 additions and 7 deletions

View File

@ -251,13 +251,17 @@ correspond to the same version."
#:warn warn-about-load-error)))
(define %updaters
;; The list of publically-known updaters.
(delay (fold-module-public-variables (lambda (obj result)
(if (upstream-updater? obj)
(cons obj result)
result))
'()
(importer-modules))))
;; The list of publically-known updaters, alphabetically sorted.
(delay
(sort (fold-module-public-variables (lambda (obj result)
(if (upstream-updater? obj)
(cons obj result)
result))
'()
(importer-modules))
(lambda (updater1 updater2)
(string<? (symbol->string (upstream-updater-name updater1))
(symbol->string (upstream-updater-name updater2)))))))
;; Tests need to mock this variable so mark it as "non-declarative".
(set! %updaters %updaters)