>> There are two cases: >> >> 1. A generation does not exist. >> >> 2. The profile points to the zeroth generation, and there are no other >> generations. >> >> ‘tests/guix-package.sh’ tests the first case. Should we test the second >> case too? What would be the best way to do so?
> The second case is valid. Thus it’s OK for --list-generations to not > print anything, but it must exit with 0. > Likewise, --delete-generations should do nothing and exit with 0 with > the only generation that would be deleted is Generation 0. > Does it make sense? I was asking a different question, that is, whether we should test both cases in ‘tests/guix-package.sh’ or it’s OK to test only the first case. Currently, there’s a test for the first case. (Note that by the word “cases” I mean the ‘cond’ cases.) Anyway, can I push this patch?
From 00188949e6c49592f6f2dc30bf21731ae142afc0 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov <nik...@karetnikov.org> Date: Thu, 26 Sep 2013 02:00:06 +0000 Subject: [PATCH 1/3] guix package: Exit with 0 when there is nothing to list. * guix/scripts/package.scm (guix-package)[process-query]: Exit with 0 when there are no generations containing packages or no profiles. --- guix/scripts/package.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 66505f1..ed1e72c 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -983,7 +983,7 @@ more information.~%")) ((string-null? pattern) (let ((numbers (generation-numbers profile))) (if (equal? numbers '(0)) - (exit 1) + (exit 0) (for-each list-generation numbers)))) ((matching-generations pattern profile) => -- 1.7.9.5
pgpMpMoVZSJxL.pgp
Description: PGP signature