GNU bug report logs - #73508
Generic updaters should run last

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Fri, 27 Sep 2024 06:51:01 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73508 in the body.
You can then email your comments to 73508 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to liliana.prikler <at> gmail.com, bug-guix <at> gnu.org:
bug#73508; Package guix. (Fri, 27 Sep 2024 06:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to liliana.prikler <at> gmail.com, bug-guix <at> gnu.org. (Fri, 27 Sep 2024 06:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Subject: Generic updaters should run last
Date: Fri, 27 Sep 2024 15:49:46 +0900
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




Information forwarded to maxim.cournoyer <at> gmail.com, guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, zimon.toutoune <at> gmail.com, me <at> tobias.gr, bug-guix <at> gnu.org:
bug#73508; Package guix. (Fri, 27 Sep 2024 07:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 73508 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 73508 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH] upstream: Try the generic importers last.
Date: Fri, 27 Sep 2024 16:02:22 +0900
* 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





Information forwarded to bug-guix <at> gnu.org:
bug#73508; Package guix. (Mon, 14 Oct 2024 11:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 73508 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, 73508 <at> debbugs.gnu.org,
 Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: bug#73508: [PATCH] upstream: Try the generic importers last.
Date: Mon, 14 Oct 2024 13:01:29 +0200
Hello,

Maxim Cournoyer <maxim.cournoyer <at> 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’.




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Sat, 19 Oct 2024 12:54:03 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Sat, 19 Oct 2024 12:54:03 GMT) Full text and rfc822 format available.

Message #16 received at 73508-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, 73508-done <at> debbugs.gnu.org,
 Christopher Baines <guix <at> cbaines.net>
Subject: Re: bug#73508: Generic updaters should run last
Date: Sat, 19 Oct 2024 21:52:14 +0900
Hi,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hello,
>
> Maxim Cournoyer <maxim.cournoyer <at> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Nov 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 275 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.