From: "Ludovic Courtès" <ludo@gnu.org>
To: 60368@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#60368] [PATCH 1/2] refresh: Honor user-provided target version and report downgrades.
Date: Tue, 27 Dec 2022 23:21:09 +0100 [thread overview]
Message-ID: <20221227222110.25440-1-ludo@gnu.org> (raw)
In-Reply-To: <20221227221156.25323-1-ludo@gnu.org>
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
next prev parent reply other threads:[~2022-12-27 22:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 22:11 [bug#60368] [PATCH 0/2] Allow 'guix refresh' to downgrade packages when asked to Ludovic Courtès
2022-12-27 22:21 ` Ludovic Courtès [this message]
2022-12-27 22:21 ` [bug#60368] [PATCH 2/2] upstream: Allow downgrades Ludovic Courtès
2023-01-03 11:32 ` bug#60368: [PATCH 0/2] Allow 'guix refresh' to downgrade packages when asked to Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221227222110.25440-1-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=60368@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).