From ac4c69fea488e4028f3957986104159fca467ecb Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Mon, 23 Sep 2013 23:31:15 +0000 Subject: [PATCH 2/3] 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. --- guix/scripts/package.scm | 35 ++++++++++++++++++----------------- tests/guix-package.sh | 3 +++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1d00e39..9ed499d 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -955,23 +955,24 @@ more information.~%")) (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generation number) - (begin - (format #t (_ "Generation ~a\t~a~%") number - (date->string - (time-utc->date - (generation-time profile number)) - "~b ~d ~Y ~T")) - (for-each (match-lambda - ((name version output location _) - (format #t " ~a\t~a\t~a\t~a~%" - name version output location))) - - ;; Show most recently installed packages last. - (reverse - (manifest-packages - (profile-manifest - (format #f "~a-~a-link" profile number))))) - (newline))) + (or (zero? number) + (begin + (format #t (_ "Generation ~a\t~a~%") number + (date->string + (time-utc->date + (generation-time profile number)) + "~b ~d ~Y ~T")) + (for-each (match-lambda + ((name version output location _) + (format #t " ~a\t~a\t~a\t~a~%" + name version output location))) + + ;; Show most recently installed packages last. + (reverse + (manifest-packages + (profile-manifest + (format #f "~a-~a-link" profile number))))) + (newline)))) (cond ((not (file-exists? profile)) ; XXX: race condition (leave (_ "profile '~a' does not exist~%") diff --git a/tests/guix-package.sh b/tests/guix-package.sh index e2c0374..b4bd414 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -110,6 +110,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