From bea0168c28932921e6e2d6dcf3e9a26c555b698c Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Tue, 24 Sep 2013 22:18:09 +0000 Subject: [PATCH 2/2] guix package: Do not list the zeroth generation. * guix/scripts/package.scm (guix-package)[process-query]: Change 'list-generation' to not list the zeroth generation. * tests/guix-package.sh: Test it. * doc/guix.texi (Invoking guix package): Document it, and use the right term when talking about generations. --- doc/guix.texi | 8 ++++---- guix/scripts/package.scm | 2 +- tests/guix-package.sh | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 90016a4..442cef2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -583,9 +583,8 @@ When combined with options such as @code{--install}, roll back occurs before any other actions. When rolling back from the first generation that actually contains -installed packages, the profile is made to point to the @dfn{empty -profile}, also known as @dfn{profile zero}---i.e., it contains no files -apart from its own meta-data. +installed packages, the profile is made to point to the @dfn{zeroth +generation}, which contains no files apart from its own meta-data. Installing, removing, or upgrading packages from a generation that has been rolled back to overwrites previous future generations. Thus, the @@ -683,7 +682,8 @@ Multiple Outputs}), and the source location of its definition. @itemx -l address@hidden Return a list of generations along with their creation dates; for each generation, show the installed packages, with the most recently -installed packages shown last. +installed packages shown last. Note that the zeroth generation is never +shown. For each installed package, print the following items, separated by tabs: the name of a package, its version string, the part of the package diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1f21890..dab3d5b 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -955,7 +955,7 @@ more information.~%")) (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generation number) - (begin + (unless (zero? number) (format #t (_ "Generation ~a\t~a~%") number (date->string (time-utc->date diff --git a/tests/guix-package.sh b/tests/guix-package.sh index f1f7ee6..7130926 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -111,6 +111,9 @@ then test "`readlink_base "$profile"`" = "$profile-0-link" done + # Test that '--list-generations' does not output the zeroth generation. + test -z "`guix package -p "$profile" -l 0`" + # Reinstall after roll-back to the empty profile. guix package --bootstrap -p "$profile" -e "$boot_make" test "`readlink_base "$profile"`" = "$profile-1-link" -- 1.7.9.5