GNU bug report logs - #60368
[PATCH 0/2] Allow 'guix refresh' to downgrade packages when asked to

Previous Next

Package: guix-patches;

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

Date: Tue, 27 Dec 2022 22:13:02 UTC

Severity: normal

Tags: patch

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

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 60368 in the body.
You can then email your comments to 60368 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 guix-patches <at> gnu.org:
bug#60368; Package guix-patches. (Tue, 27 Dec 2022 22:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 27 Dec 2022 22:13:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 0/2] Allow 'guix refresh' to downgrade packages when asked to
Date: Tue, 27 Dec 2022 23:11:56 +0100
Hi Hartmut,

I figured changes from <https://issues.guix.gnu.org/57460> were not
applicable in some cases because of things that guard against
downgrade.

The following patches fix the use case where the user is explicitly
asking for a downgrade, as in:

  guix refresh guile <at> 3.0=2.2.7
  guix refresh -u guile=3.0.0

Previously these wouldn’t do anything.

WDYT?

Ludo’.

Ludovic Courtès (2):
  refresh: Honor user-provided target version and report downgrades.
  upstream: Allow downgrades.

 guix/scripts/refresh.scm | 46 +++++++++++++++++++++++++++-------------
 guix/upstream.scm        | 17 ++++++++++++---
 2 files changed, 45 insertions(+), 18 deletions(-)


base-commit: fd0e69984f25bdf2405cf33b15a8bbb2010a7b85
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60368; Package guix-patches. (Tue, 27 Dec 2022 22:22:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: 60368 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 1/2] refresh: Honor user-provided target version and report
 downgrades.
Date: Tue, 27 Dec 2022 23:21:09 +0100
Previously, 'guix refresh guile=3.0.0' would print:

  3.0.8 is already the latest version of guile

With this change, it prints:

  guile would be downgraded from 3.0.8 to 3.0.0

This is a followup to 8aeccc6240ec45f0bc7bed655e0c8149ae4253eb.

* guix/scripts/refresh.scm (check-for-package-update): Take an
<update-spec> instead of a <package>.  Report downgrades as such when
UPDATE-SPEC specifies a target version.
(guix-refresh): Adjust caller.
---
 guix/scripts/refresh.scm | 46 +++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index e0b94ce48d..65c3ce9c16 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -382,10 +382,15 @@ (define change-name
       (when warn?
         (warn-no-updater package))))
 
-(define* (check-for-package-update package updaters #:key warn?)
-  "Check whether an update is available for PACKAGE and print a message.  When
-WARN? is true and no updater exists for PACKAGE, print a warning."
-  (match (package-latest-release package updaters)
+(define* (check-for-package-update update-spec updaters #:key warn?)
+  "Check whether UPDATE-SPEC is feasible, and print a message.
+When WARN? is true and no updater exists for PACKAGE, print a warning."
+  (define package
+    (update-spec-package update-spec))
+
+  (match (package-latest-release package updaters
+                                 #:version
+                                 (update-spec-version update-spec))
     ((? upstream-source? source)
      (let ((loc (or (package-field-location package 'version)
                     (package-location package))))
@@ -403,23 +408,34 @@ (define* (check-for-package-update package updaters #:key warn?)
                   (package-version package)
                   (package-name package))))
          (else
-          (when warn?
-            (warning loc
-                     (G_ "~a is greater than \
+          (if (update-spec-version update-spec)
+              (info loc
+                    (G_ "~a would be downgraded from ~a to ~a~%")
+                    (package-name package)
+                    (package-version package)
+                    (upstream-source-version source))
+              (when warn?
+                (warning loc
+                         (G_ "~a is greater than \
 the latest known version of ~a (~a)~%")
-                     (package-version package)
-                     (package-name package)
-                     (upstream-source-version source)))))))
+                         (package-version package)
+                         (package-name package)
+                         (upstream-source-version source))))))))
     (#f
      (when warn?
        ;; Distinguish between "no updater" and "failing updater."
        (match (lookup-updater package updaters)
          ((? upstream-updater? updater)
-          (warning (package-location package)
-                   (G_ "'~a' updater failed to determine available \
+          (if (update-spec-version update-spec)
+              (warning (G_ "'~a' updater failed to find version ~a of '~a'~%")
+                       (upstream-updater-name updater)
+                       (update-spec-version update-spec)
+                       (package-name package))
+              (warning (package-location package)
+                       (G_ "'~a' updater failed to determine available \
 releases for ~a~%")
-                   (upstream-updater-name updater)
-                   (package-name package)))
+                       (upstream-updater-name updater)
+                       (package-name package))))
          (#f
           (warn-no-updater package)))))))
 
@@ -591,5 +607,5 @@ (define (options->updaters opts)
              (else
               (for-each (cut check-for-package-update <> updaters
                              #:warn? warn?)
-                        (map update-spec-package update-specs))
+                        update-specs)
               (return #t)))))))))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60368; Package guix-patches. (Tue, 27 Dec 2022 22:22:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: 60368 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 2/2] upstream: Allow downgrades.
Date: Tue, 27 Dec 2022 23:21:10 +0100
Previously, 'guix refresh -u guile=3.0.0' would do nothing.  With this
change, it actually downgrades 'guile'.

This is a followup to 8aeccc6240ec45f0bc7bed655e0c8149ae4253eb.

* guix/upstream.scm (package-update): Ignore 'version>?' check
when #:version is passed.  Warn about downgrades.
---
 guix/upstream.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/guix/upstream.scm b/guix/upstream.scm
index f3ab9ab78b..4c72388bf3 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -501,11 +501,22 @@ (define* (package-update store package
 changes for PACKAGE; return #f (three values) when PACKAGE is up-to-date;
 raise an error when the updater could not determine available releases.
 KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed
-values: 'always', 'never', and 'interactive' (default)."
+values: 'always', 'never', and 'interactive' (default).
+
+When VERSION is specified, update PACKAGE to that version, even if that is a
+downgrade."
   (match (package-latest-release package updaters #:version version)
     ((? upstream-source? source)
-     (if (version>? (upstream-source-version source)
-                    (package-version package))
+     (if (or (version>? (upstream-source-version source)
+                        (package-version package))
+             (and version
+                  (begin
+                    (warning (package-location package)
+                             (G_ "downgrading '~a' from ~a to ~a~%")
+                             (package-name package)
+                             (package-version package)
+                             (upstream-source-version source))
+                    #t)))
          (let ((method (match (package-source package)
                          ((? origin? origin)
                           (origin-method origin))
-- 
2.38.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 03 Jan 2023 11:33:02 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Tue, 03 Jan 2023 11:33:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: 60368-done <at> debbugs.gnu.org
Cc: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Subject: Re: bug#60368: [PATCH 0/2] Allow 'guix refresh' to downgrade
 packages when asked to
Date: Tue, 03 Jan 2023 12:32:30 +0100
Hi Hartmut and all,

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

> Hi Hartmut,
>
> I figured changes from <https://issues.guix.gnu.org/57460> were not
> applicable in some cases because of things that guard against
> downgrade.
>
> The following patches fix the use case where the user is explicitly
> asking for a downgrade, as in:
>
>   guix refresh guile <at> 3.0=2.2.7
>   guix refresh -u guile=3.0.0
>
> Previously these wouldn’t do anything.

I went ahead and pushed these:

  11235dd85a refresh: Honor user-provided target version and report downgrades.
  a330bfdf5b upstream: Allow downgrades.

Thanks,
Ludo’.




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

This bug report was last modified 2 years and 141 days ago.

Previous Next


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