guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/06: guix package: Use relative symlinks to generations.


From: Ludovic Courtès
Subject: 01/06: guix package: Use relative symlinks to generations.
Date: Fri, 13 Jul 2018 11:28:47 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit bc6e291ef0b3c71c07e50d88d7764e5dd334e8b1
Author: Ludovic Courtès <address@hidden>
Date:   Fri Jul 13 14:33:11 2018 +0200

    guix package: Use relative symlinks to generations.
    
    Reported by Roel Janssen <address@hidden>
    at <https://lists.gnu.org/archive/html/guix-devel/2018-07/msg00036.html>.
    
    * guix/profiles.scm (switch-to-generation): Use (basename generation) as
    the symlink target.
    * guix/scripts/package.scm (build-and-use-profile): Likewise,
    use (basename name) as the symlink target.
    * tests/guix-package.sh: Adjust --roll-back test accordingly.  Add
    explicitly test with '-p foo/prof'.
---
 guix/profiles.scm        |  2 +-
 guix/scripts/package.scm |  2 +-
 tests/guix-package.sh    | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index d2a794b..f34f4fc 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1521,7 +1521,7 @@ the generation that was current before switching."
                               (profile profile)
                               (generation number)))))
           (else
-           (switch-symlinks profile generation)
+           (switch-symlinks profile (basename generation))
            current))))
 
 (define (switch-to-previous-generation profile)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 29829f5..b38a55d 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -190,7 +190,7 @@ do not treat collisions in MANIFEST as an error."
              (let* ((entries (manifest-entries manifest))
                     (count   (length entries)))
                (switch-symlinks name prof)
-               (switch-symlinks profile name)
+               (switch-symlinks profile (basename name))
                (unless (string=? profile %current-profile)
                  (register-gc-root store name))
                (format #t (N_ "~a package in profile~%"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 3b3fa35..cef3b34 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -185,6 +185,16 @@ grep -E 
'emacs[[:blank:]]+42\.5\.9rc7[[:blank:]]+.*-emacs-42.5.9rc7' \
 rm "$emacs_tarball" "$tmpfile"
 rmdir "$module_dir"
 
+# Profiles with a relative file name.  Make sure we don't create dangling
+# symlinks--see bug report at
+# <https://lists.gnu.org/archive/html/guix-devel/2018-07/msg00036.html>.
+mkdir -p "$module_dir/foo"
+( cd "$module_dir" ;                                           \
+  guix package --bootstrap -i guile-bootstrap -p foo/prof )
+test -f "$module_dir/foo/prof/bin/guile"
+rm "$module_dir/foo"/*
+rmdir "$module_dir/foo"
+rmdir "$module_dir"
 
 #
 # Try with the default profile.
@@ -215,7 +225,7 @@ 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"
+    test "`readlink "$default_profile"`" = "`basename $default_profile-0-link`"
 done
 
 # Check whether '-p ~/.guix-profile' makes any difference.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]