From b3bb82f1542ec0805b87305482829102f2faaa92 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Fri, 10 Oct 2014 17:58:43 +0400 Subject: guix package: Add '--switch-generation' option. * guix/scripts/package.scm (switch-to-generation): New procedure. (switch-to-previous-generation): Use it. (guix-package): Adjust for '--switch-generation' option. * tests/guix-package.sh: Test it. * doc/guix.texi (Invoking guix package): Document it. --- tests/guix-package.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/guix-package.sh') diff --git a/tests/guix-package.sh b/tests/guix-package.sh index e35871f2a2..3e0e36fa23 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -87,6 +87,8 @@ then # Exit with 1 when a generation does not exist. if guix package -p "$profile" --list-generations=42; then false; else true; fi + if guix package -p "$profile" --switch-generation=99; + then false; else true; fi # Remove a package. guix package --bootstrap -p "$profile" -r "guile-bootstrap" @@ -101,6 +103,12 @@ then test "`readlink_base "$profile"`" = "$profile-1-link" test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" + # Switch to the rolled generation and switch back. + guix package -p "$profile" --switch-generation=2 + test "`readlink_base "$profile"`" = "$profile-2-link" + guix package -p "$profile" --switch-generation=-1 + test "`readlink_base "$profile"`" = "$profile-1-link" + # Move to the empty profile. for i in `seq 1 3` do @@ -133,10 +141,12 @@ then grep "`guix build -e "$boot_make"`" "$profile/manifest" # Make a "hole" in the list of generations, and make sure we can - # roll back "over" it. + # roll back and switch "over" it. rm "$profile-1-link" guix package --bootstrap -p "$profile" --roll-back test "`readlink_base "$profile"`" = "$profile-0-link" + guix package -p "$profile" --switch-generation=+1 + test "`readlink_base "$profile"`" = "$profile-2-link" # Make sure LIBRARY_PATH gets listed by `--search-paths'. guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap -- cgit v1.2.3