* bug#73508: Generic updaters should run last
@ 2024-09-27 6:49 Maxim Cournoyer
2024-09-27 7:02 ` bug#73508: [PATCH] upstream: Try the generic importers last Maxim Cournoyer
0 siblings, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2024-09-27 6:49 UTC (permalink / raw)
To: 73508; +Cc: Liliana Prikler
Hi,
Currently the updaters are run in the order of their alphabetical
names. For example, with the following instrumentation to see the
updater names tried in guix/upstream.scm:
--8<---------------cut here---------------start------------->8---
@@ -259,6 +271,7 @@ (define* (package-latest-release package
one."
(any (match-lambda
(($ <upstream-updater> name description pred import)
+ (pk 'trying-updater: name)
(and (pred package)
(import package #:version version))))
updaters))
--8<---------------cut here---------------end--------------->8---
attempting to update gnome-desktop produces:
--8<---------------cut here---------------start------------->8---
./pre-inst-env guix refresh gnome-desktop
;;; (trying-updater: bioconductor)
;;; (trying-updater: composer)
;;; (trying-updater: cpan)
;;; (trying-updater: cran)
;;; (trying-updater: crate)
;;; (trying-updater: egg)
;;; (trying-updater: elpa)
;;; (trying-updater: gem)
;;; (trying-updater: generic-git)
;;; (trying-updater: generic-html)
gnu/packages/gnome.scm:2265:13: gnome-desktop would be upgraded from 44.0 to 44.1
--8<---------------cut here---------------end--------------->8---
It seems to me the generic updaters, being generic thus less
likely to be precise/correct, should be tried last by 'guix refresh'.
This is ensured with the following patch:
--8<---------------cut here---------------start------------->8---
modified guix/upstream.scm
@@ -48,6 +48,7 @@ (define-module (guix upstream)
#: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 @@ (define (importer-modules)
(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)
@@ -259,6 +271,7 @@ (define* (package-latest-release package
--8<---------------cut here---------------end--------------->8---
Now, the 'gnome-updater' at least ends up being tried before the
'generic-html':
--8<---------------cut here---------------start------------->8---
;;; (trying-updater: bioconductor)
;;; (trying-updater: composer)
;;; (trying-updater: cpan)
;;; (trying-updater: cran)
;;; (trying-updater: crate)
;;; (trying-updater: egg)
;;; (trying-updater: elpa)
;;; (trying-updater: gem)
;;; (trying-updater: github)
;;; (trying-updater: gnome)
gnu/packages/gnome.scm:2265:13: gnome-desktop would be upgraded from 44.0 to 44.1
--8<---------------cut here---------------end--------------->8---
I'll send a 'git format-patch' version in a follow-up.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#73508: [PATCH] upstream: Try the generic importers last.
2024-09-27 6:49 bug#73508: Generic updaters should run last Maxim Cournoyer
@ 2024-09-27 7:02 ` Maxim Cournoyer
2024-10-14 11:01 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Maxim Cournoyer @ 2024-09-27 7:02 UTC (permalink / raw)
To: 73508
Cc: Maxim Cournoyer, Maxim Cournoyer, Christopher Baines,
Josselin Poiret, Ludovic Courtès, Mathieu Othacehe,
Simon Tournier, Tobias Geerinckx-Rice
* guix/upstream.scm (%updaters): Ensure the updaters with a name starting by
'generic' appear last in the list.
Fixes: https://issues.guix.gnu.org/
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 @@ (define-module (guix upstream)
#: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 @@ (define (importer-modules)
(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)
base-commit: a4ea332bc219e14560d3a5daaa658425d898ec37
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#73508: [PATCH] upstream: Try the generic importers last.
2024-09-27 7:02 ` bug#73508: [PATCH] upstream: Try the generic importers last Maxim Cournoyer
@ 2024-10-14 11:01 ` Ludovic Courtès
2024-10-19 12:52 ` bug#73508: Generic updaters should run last Maxim Cournoyer
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2024-10-14 11:01 UTC (permalink / raw)
To: Maxim Cournoyer
Cc: Josselin Poiret, Simon Tournier, 73508, Mathieu Othacehe,
Tobias Geerinckx-Rice, Christopher Baines
Hello,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> * guix/upstream.scm (%updaters): Ensure the updaters with a name starting by
> 'generic' appear last in the list.
>
> Fixes: https://issues.guix.gnu.org/
This should be <https://issues.guix.gnu.org/73508>.
> Change-Id: I98977f6c925c14303273755b5b4dc36035f78bda
Apart from that, LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#73508: Generic updaters should run last
2024-10-14 11:01 ` Ludovic Courtès
@ 2024-10-19 12:52 ` Maxim Cournoyer
0 siblings, 0 replies; 4+ messages in thread
From: Maxim Cournoyer @ 2024-10-19 12:52 UTC (permalink / raw)
To: Ludovic Courtès
Cc: Josselin Poiret, Simon Tournier, Mathieu Othacehe,
Tobias Geerinckx-Rice, 73508-done, Christopher Baines
Hi,
Ludovic Courtès <ludo@gnu.org> writes:
> Hello,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> * guix/upstream.scm (%updaters): Ensure the updaters with a name starting by
>> 'generic' appear last in the list.
>>
>> Fixes: https://issues.guix.gnu.org/
>
> This should be <https://issues.guix.gnu.org/73508>.
>
>> Change-Id: I98977f6c925c14303273755b5b4dc36035f78bda
>
> Apart from that, LGTM, thanks!
Fixed the above, and pushed!
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-19 12:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 6:49 bug#73508: Generic updaters should run last Maxim Cournoyer
2024-09-27 7:02 ` bug#73508: [PATCH] upstream: Try the generic importers last Maxim Cournoyer
2024-10-14 11:01 ` Ludovic Courtès
2024-10-19 12:52 ` bug#73508: Generic updaters should run last Maxim Cournoyer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.