mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-01 18:05:17 +00:00
upstream: Do not update to same version.
Previously, 'guix refresh --update' would do actually rewrite the file with the same version/hash information when the target version was the same as the current version: guix refresh --update idutils=4.6 idutils.scm: warning: downgrading 'idutils' from 4.6 to 4.6 [...] idutils.scm: idutils: updating from version 4.6 to version 4.6... This changes handles this case so that it does and prints nothing. * guix/upstream.scm (package-update): Use `version-compare' to distinguish the equal versions case. Change-Id: I079e030d573f5968725ef13b3f626e2f8d02cb2f Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
parent
d383463146
commit
a369932d04
2 changed files with 43 additions and 29 deletions
|
@ -525,39 +525,44 @@ downgrade. When PARTIAL-VERSION? is true, treat VERSION as having been only
|
|||
partially specified, in which case the package will be updated to the newest
|
||||
compatible version if there are no exact match for VERSION. For example,
|
||||
providing \"46\" as the version may update the package to version \"46.6.4\"."
|
||||
(define (update* source)
|
||||
(let ((method (match (package-source package)
|
||||
((? origin? origin)
|
||||
(origin-method origin))
|
||||
(_
|
||||
#f))))
|
||||
(match (assq method %method-updates)
|
||||
(#f
|
||||
(raise (make-compound-condition
|
||||
(formatted-message (G_ "cannot download for \
|
||||
this method: ~s")
|
||||
method)
|
||||
(condition
|
||||
(&error-location
|
||||
(location (package-location package)))))))
|
||||
((_ . update)
|
||||
(update store package source
|
||||
#:key-server key-server
|
||||
#:key-download key-download)))))
|
||||
|
||||
(match (package-latest-release package updaters
|
||||
#:version version
|
||||
#:partial-version? partial-version?)
|
||||
((? upstream-source? source)
|
||||
(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))
|
||||
(_
|
||||
#f))))
|
||||
(match (assq method %method-updates)
|
||||
(#f
|
||||
(raise (make-compound-condition
|
||||
(formatted-message (G_ "cannot download for \
|
||||
this method: ~s")
|
||||
method)
|
||||
(condition
|
||||
(&error-location
|
||||
(location (package-location package)))))))
|
||||
((_ . update)
|
||||
(update store package source
|
||||
#:key-server key-server
|
||||
#:key-download key-download))))
|
||||
(values #f #f #f)))
|
||||
(case (version-compare (upstream-source-version source)
|
||||
(package-version package))
|
||||
((>)
|
||||
(update* source))
|
||||
((<)
|
||||
(and version
|
||||
(warning (package-location package)
|
||||
(G_ "downgrading '~a' from ~a to ~a~%")
|
||||
(package-name package)
|
||||
(package-version package)
|
||||
(upstream-source-version source)))
|
||||
(update* source))
|
||||
(else
|
||||
(values #f #f #f))))
|
||||
(#f
|
||||
;; Warn rather than abort so that other updates can still take place.
|
||||
(if version
|
||||
|
|
|
@ -44,6 +44,15 @@ case "$(guix refresh -t test idutils 2>&1)" in
|
|||
*"$idutils_version"*"already the latest version"*) true;;
|
||||
*) false;;
|
||||
esac
|
||||
|
||||
# No-op when updating to same version.
|
||||
case "$(guix refresh -t test -u idutils \
|
||||
--target-version=$idutils_version 2>&1)" in
|
||||
*downgrading*) false;;
|
||||
*updating*) false;;
|
||||
*) true;;
|
||||
esac
|
||||
|
||||
guix refresh -t test libreoffice # XXX: should return non-zero?
|
||||
case "$(guix refresh -t test libreoffice 2>&1)" in
|
||||
*"greater than the latest known version"*"1.0"*) true;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue