guix package: Exit with 1 when a generation cannot be listed.
* guix/scripts/package.scm (guix-package)[process-query]: Exit with 1 when a generation does not exist or the profile points to the zeroth generation. * tests/guix-package.sh: Test the former case.
This commit is contained in:
parent
98fbd7ceeb
commit
0ab212b946
|
@ -977,11 +977,16 @@ more information.~%"))
|
||||||
(leave (_ "profile '~a' does not exist~%")
|
(leave (_ "profile '~a' does not exist~%")
|
||||||
profile))
|
profile))
|
||||||
((string-null? pattern)
|
((string-null? pattern)
|
||||||
(for-each list-generation
|
(let ((numbers (generation-numbers profile)))
|
||||||
(generation-numbers profile)))
|
(if (equal? numbers '(0))
|
||||||
|
(exit 1)
|
||||||
|
(for-each list-generation numbers))))
|
||||||
((matching-generations pattern profile)
|
((matching-generations pattern profile)
|
||||||
=>
|
=>
|
||||||
(cut for-each list-generation <>))
|
(lambda (numbers)
|
||||||
|
(if (null-list? numbers)
|
||||||
|
(exit 1)
|
||||||
|
(for-each list-generation numbers))))
|
||||||
(else
|
(else
|
||||||
(leave (_ "invalid syntax: ~a~%")
|
(leave (_ "invalid syntax: ~a~%")
|
||||||
pattern)))
|
pattern)))
|
||||||
|
|
|
@ -85,6 +85,10 @@ then
|
||||||
test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
|
test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
|
||||||
= " guile-bootstrap"
|
= " guile-bootstrap"
|
||||||
|
|
||||||
|
# Exit with 1 when a generation does not exist.
|
||||||
|
if guix package -p "$profile" --list-generations=42;
|
||||||
|
then false; else true; fi
|
||||||
|
|
||||||
# Remove a package.
|
# Remove a package.
|
||||||
guix package --bootstrap -p "$profile" -r "guile-bootstrap"
|
guix package --bootstrap -p "$profile" -r "guile-bootstrap"
|
||||||
test -L "$profile-3-link"
|
test -L "$profile-3-link"
|
||||||
|
|
Loading…
Reference in New Issue