From d9307267b3b4a87391e33daacef162745f057c3d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 27 Jan 2013 17:18:55 +0100 Subject: guix-package: When rolling back to nothingness, point to the empty profile. Suggested by Andreas Enge at . * guix-package.in (roll-back): Check whether PROFILE is valid using `file-exists?'. When NUMBER is zero, just emit a notice. When PREVIOUS-NUMBER is zero and PREVIOUS-PROFILE does not exist, build the empty profile, and link to it. * tests/guix-package.sh: Add tests. * doc/guix.texi (Invoking guix-package): Document the new behavior. --- tests/guix-package.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 02ece68045..87b95236ff 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -81,9 +81,14 @@ then test "`readlink_base "$profile"`" = "$profile-1-link" test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" - # Failed attempt to roll back because there's no previous generation. - if guix-package --roll-back -p "$profile"; - then false; else true; fi + # Move to the empty profile. + for i in `seq 1 3` + do + guix-package --bootstrap --roll-back -p "$profile" + ! test -f "$profile/bin" + ! test -f "$profile/lib" + test "`readlink_base "$profile"`" = "$profile-0-link" + done # Reinstall after roll-back to generation 1. guix-package --bootstrap -p "$profile" -i "$boot_make" @@ -136,9 +141,15 @@ then test "`cd $HOME/.guix-profile ; pwd`" = "$first_environment" fi -# Failed attempt to roll back. -if guix-package --bootstrap --roll-back; -then false; else true; fi +# Move to the empty profile. +default_profile="`readlink "$HOME/.guix-profile"`" +for i in `seq 1 3` +do + guix-package --bootstrap --roll-back + ! test -f "$HOME/.guix-profile/bin" + ! test -f "$HOME/.guix-profile/lib" + test "`readlink "$default_profile"`" = "$default_profile-0-link" +done # Extraneous argument. ! guix-package install foo-bar -- cgit v1.2.3