[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53818] [PATCH v2 1/7] upstream: Sort list of updaters.
From: |
Xinglu Chen |
Subject: |
[bug#53818] [PATCH v2 1/7] upstream: Sort list of updaters. |
Date: |
Mon, 07 Feb 2022 10:06:45 +0100 |
The order determines which updater gets used first when running ‘guix refresh’
on a package. We want the most generic updaters to be last since they usually
don’t provide as much or accurate information as language-specific updaters.
* guix/upstream.scm (sort-updaters): New procedure.
(%updaters): Use it.
---
guix/upstream.scm | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 6666803a92..d5faf9d3ee 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -250,14 +250,31 @@ (define (importer-modules)
%load-path)
#:warn warn-about-load-error)))
+(define (sort-updaters updaters)
+ "Sort UPDATERS by putting the more generic ones last."
+ (define (genericity updater)
+ (cond
+ ((equal? 'repology (upstream-updater-name updater))
+ 2)
+ ((string-prefix? "generic-"
+ (symbol->string (upstream-updater-name updater)))
+ 1)
+ (else 0)))
+
+ (define (less a b)
+ (<= (genericity a) (genericity b)))
+
+ (stable-sort updaters less))
+
(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))))
+ (delay (sort-updaters
+ (fold-module-public-variables (lambda (obj result)
+ (if (upstream-updater? obj)
+ (cons obj result)
+ result))
+ '()
+ (importer-modules)))))
;; Tests need to mock this variable so mark it as "non-declarative".
(set! %updaters %updaters)
--
2.34.1
- [bug#53818] [PATCH 2/3] import: Add 'repology' updater., (continued)
- [bug#53818] [PATCH 3/3] gnu: xorg-server-xwayland: Set 'repology-name' property., Xinglu Chen, 2022/02/06
- [bug#53818] [PATCH 1/3] git-download: Export <git-reference>., Xinglu Chen, 2022/02/06
- [bug#53818] [PATCH v2 0/7] Add Repology updater, Xinglu Chen, 2022/02/07
- [bug#53818] [PATCH v2 1/7] upstream: Sort list of updaters.,
Xinglu Chen <=
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Xinglu Chen, 2022/02/07
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Maxime Devos, 2022/02/07
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Maxime Devos, 2022/02/07
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Xinglu Chen, 2022/02/08
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Maxime Devos, 2022/02/08
- [bug#53818] [PATCH v2 5/7] import: Add 'repology' updater., Xinglu Chen, 2022/02/09
[bug#53818] [PATCH v2 3/7] http-client: 'http-fetch/cached' accepts a string or a <uri>., Xinglu Chen, 2022/02/07
[bug#53818] [PATCH v2 2/7] http-client: Make 'http-fetch/cached' take '#:headers' argument., Xinglu Chen, 2022/02/07
[bug#53818] [PATCH v2 6/7] gnu: xorg-server-xwayland: Set 'repology-name' property., Xinglu Chen, 2022/02/07
[bug#53818] [PATCH v2 7/7] gnu: xorg-server-xwayland: Prepare for cross-compilation., Xinglu Chen, 2022/02/07