1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

guix package: Make custom profiles actual indirect roots.

Before that, any profile generation built when '-p' is used would
effectively become a permanent GC root because the symlink in
/var/guix/gcroots/auto would point directly to /gnu/store/...-profile.

* guix/scripts/package.scm (maybe-register-gc-root): Rename to...
  (register-gc-root): ... this.  Remove conditional, and replace call to
  'canonicalize-path' with (string-append (getcwd) "/" ...).
  (guix-package): Call 'register-gc-root' only if PROFILE is different
  from %CURRENT-PROFILE.
* tests/guix-package.sh: Add test case.
This commit is contained in:
Ludovic Courtès
2015-02-06 17:52:07 +01:00
parent 3df5acf332
commit c9323a4c69
2 changed files with 29 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ module_dir="t-guix-package-$$"
profile="t-profile-$$"
rm -f "$profile"
trap 'rm "$profile" "$profile-"[0-9]* ; rm -rf "$module_dir" t-home-'"$$" EXIT
trap 'rm -f "$profile" "$profile-"[0-9]* ; rm -rf "$module_dir" t-home-'"$$" EXIT
# Use `-e' with a non-package expression.
if guix package --bootstrap -e +;
@@ -203,6 +203,18 @@ if guix package -p "$profile" --delete-generations=12m;
then false; else true; fi
test "`readlink_base "$profile"`" = "$generation"
# Make sure $profile is a GC root at this point.
real_profile="`readlink -f "$profile"`"
if guix gc -d "$real_profile"
then false; else true; fi
test -d "$real_profile"
# Now, let's remove all the symlinks to $real_profile, and make sure
# $real_profile is no longer a GC root.
rm "$profile" "$profile"-[0-9]-link
guix gc -d "$real_profile"
[ ! -d "$real_profile" ]
#
# Try with the default profile.
#