guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/07: upstream: Try the generic importers last.


From: guix-commits
Subject: 06/07: upstream: Try the generic importers last.
Date: Sat, 19 Oct 2024 08:49:41 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit 119febc2750d9cf733f4f1ecc0b2119a293e39b1
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Sep 27 15:54:37 2024 +0900

    upstream: Try the generic importers last.
    
    * guix/upstream.scm (%updaters): Ensure the updaters with a name starting by
    'generic' appear last in the list.
    
    Fixes: <https://issues.guix.gnu.org/73508>
    Change-Id: I98977f6c925c14303273755b5b4dc36035f78bda
---
 guix/upstream.scm | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/guix/upstream.scm b/guix/upstream.scm
index 753916be64..0593c363aa 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -48,6 +48,7 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
+  #:use-module (srfi srfi-71)
   #:use-module (rnrs bytevectors)
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
@@ -226,15 +227,26 @@ correspond to the same version."
 (define %updaters
   ;; 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)))))))
+    (let* ((updaters
+            (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))))))
+           (generic-updaters rest (partition
+                                   (compose (cut string-prefix? "generic" <>)
+                                            symbol->string
+                                            upstream-updater-name)
+                                   updaters)))
+      ;; Ensure the generic updaters are tried last, as otherwise they could
+      ;; return less accurate results.
+      (append rest generic-updaters))))
 
 ;; Tests need to mock this variable so mark it as "non-declarative".
 (set! %updaters %updaters)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]