refresh: Allow specifying a partial version via the version specification.

* guix/scripts/refresh.scm (update-specification->update-spec): Flag the
update-spec as partial when it is prefixed with '~'.
* tests/guix-refresh.sh: Test it.  Remove extraneous 'guix refresh'
invocation.
* doc/guix.texi (Invoking guix refresh): Document it.

Change-Id: Iab4482d9367105f6ffcd2d6a49148736c93d53e4
Reviewed-by: Florian Pelz <pelzflorian@pelzflorian.de>
Reviewed-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Maxim Cournoyer 2025-05-17 14:36:40 +09:00
parent ba540ca7dd
commit 271a8fc249
No known key found for this signature in database
GPG key ID: 1260E46482E63562
3 changed files with 34 additions and 3 deletions

View file

@ -126,13 +126,30 @@ case "$(guix refresh -t test guile --target-version=2.0.0 2>&1)" in
*) false;;
esac
guix refresh -t test guile=~2.0.0 # XXX: should return non-zero?
case "$(guix refresh -t test guile=~2.0.0 2>&1)" in
*"failed to find"*"2.0.0"*) true;;
*) false;;
esac
# Partial target version => select the newest release prefixed by it.
guix refresh -t test guile --target-version=3 # XXX: should return non-zero?
case "$(guix refresh -t test guile --target-version=3 2>&1)" in
*"would be upgraded"*"3.13.3"*) true;;
*) false;;
esac
# Partial spec version => select the newest release prefixed by it.
case "$(guix refresh -t test guile=~3 2>&1)" in
*"would be upgraded"*"3.13.3"*) true;;
*) false;;
esac
# Conflicting --target-version and spec: spec wins
case "$(guix refresh -t test guile=~3 2>&1)" in
*"would be upgraded"*"3.13.3"*) true;;
*) false;;
esac
for spec in "guile=1.6.4" "guile@3=1.6.4"
do
guix refresh -t test "$spec"