aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/scripts/package.scm11
-rw-r--r--tests/guix-package.sh4
2 files changed, 12 insertions, 3 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1d00e39540..1f21890fcd 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -977,11 +977,16 @@ more information.~%"))
(leave (_ "profile '~a' does not exist~%")
profile))
((string-null? pattern)
- (for-each list-generation
- (generation-numbers profile)))
+ (let ((numbers (generation-numbers profile)))
+ (if (equal? numbers '(0))
+ (exit 1)
+ (for-each list-generation numbers))))
((matching-generations pattern profile)
=>
- (cut for-each list-generation <>))
+ (lambda (numbers)
+ (if (null-list? numbers)
+ (exit 1)
+ (for-each list-generation numbers))))
(else
(leave (_ "invalid syntax: ~a~%")
pattern)))
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index b09a9c0173..f1f7ee6c7d 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -85,6 +85,10 @@ then
test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
= " 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.
guix package --bootstrap -p "$profile" -r "guile-bootstrap"
test -L "$profile-3-link"