From 7759ad3ad89d236e766639c0875540e60a503d16 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Tue, 24 Sep 2013 05:41:32 +0000 Subject: [PATCH] guix package: Show which generation is the current one. * guix/scripts/package.scm (guix-package)[process-query]: Show that a generation is the current one if the profile points to it. * tests/guix-package.sh: Test it. --- guix/scripts/package.scm | 17 ++++++++++++----- tests/guix-package.sh | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 9ed499d..a8dfcbc 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -955,13 +955,20 @@ more information.~%")) (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generation number) + (define (current-generation? number) + (let ((generation (format #f "~a-~a-link" profile number))) + (string=? (readlink profile) generation))) + (or (zero? number) (begin - (format #t (_ "Generation ~a\t~a~%") number - (date->string - (time-utc->date - (generation-time profile number)) - "~b ~d ~Y ~T")) + (let ((header (format #f (_ "Generation ~a\t~a") number + (date->string + (time-utc->date + (generation-time profile number)) + "~b ~d ~Y ~T")))) + (if (current-generation? number) + (format #t "~a\t(current)~%" header) + (format #t "~a~%" header))) (for-each (match-lambda ((name version output location _) (format #t " ~a\t~a\t~a\t~a~%" diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 2b8b146..74deb3a 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -118,6 +118,9 @@ then test "`readlink_base "$profile"`" = "$profile-1-link" test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" + # Check that the first generation is the current one. + test "`guix package -p "$profile" -l 1 | cut -f3 | head -n1`" = "(current)" + # Roll-back to generation 0, and install---all at once. guix package --bootstrap -p "$profile" --roll-back -i guile-bootstrap test "`readlink_base "$profile"`" = "$profile-1-link" -- 1.7.9.5