diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-07-18 13:16:04 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-07-19 18:54:41 +0200 |
commit | e87c6fb95a2898df3eb5b557407a4504977182da (patch) | |
tree | 42e6545e9de5dd612c20ad701d5af67065f8900d | |
parent | d519305d83d08058e4def2c4d72fe62102d9599d (diff) | |
download | guix-e87c6fb95a2898df3eb5b557407a4504977182da.tar.gz guix-e87c6fb95a2898df3eb5b557407a4504977182da.zip |
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'.
-rw-r--r-- | guix/upstream.scm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/guix/upstream.scm b/guix/upstream.scm index 9b49d1641f..cbfd1aa609 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -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) |