From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Janssen Subject: [PATCH] profiles: Let canonicalize-profile return an absolute path. Date: Tue, 03 Jul 2018 19:59:43 +0200 Message-ID: <87fu106vzk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faPag-00016F-RO for guix-devel@gnu.org; Tue, 03 Jul 2018 13:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faPac-0008LR-Uf for guix-devel@gnu.org; Tue, 03 Jul 2018 13:59:50 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faPac-0008LM-OD for guix-devel@gnu.org; Tue, 03 Jul 2018 13:59:46 -0400 Received: from ip112-245-209-87.adsl2.static.versatel.nl ([87.209.245.112]:63608 helo=yellowstone) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1faPac-00082q-7L for guix-devel@gnu.org; Tue, 03 Jul 2018 13:59:46 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Dear Guix, I'd like to change the way the symlinks to custom profiles are created. Here's what currently happens: $ guixr package -i hello -p guix-profiles/test $ ls -l guix-profiles lrwxrwxrwx. 1 user group 25 Jul 3 19:53 test -> guix-profiles/test-1-link lrwxrwxrwx. 1 user group 51 Jul 3 19:53 test-1-link -> /gnu/store/...6qbap= s-profile Now, that symlink is broken. Instead, I'd like to have it always use absolute paths: $ guixr package -i hello -p guix-profiles/test $ ls -l guix-profiles lrwxrwxrwx 1 roel users 36 3 jul 19:56 test -> /home/user/guix-profiles/te= st-1-link lrwxrwxrwx 1 roel users 51 3 jul 19:56 test-1-link -> /gnu/store/...6qbaps= -profile This symlink isn't broken. In this patch I implemented this behavior by modifying canonicalize-profile to return an absolute path when it's not =E2=80=9C~/.guix-profile=E2=80=9D. I hope we can merge this, or a similar solution so that creating profiles in custom locations is a little more robust. Kind regards, Roel Janssen --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-profiles-Let-canonicalize-path-return-an-absolute-pa.patch >From 95178018beb8c5458c154771ac9d1ff4866cc507 Mon Sep 17 00:00:00 2001 From: Roel Janssen Date: Tue, 3 Jul 2018 19:49:04 +0200 Subject: [PATCH] profiles: Let canonicalize-profile return an absolute path. * guix/profiles.scm (canonicalize-profile): Return an absolute path. --- guix/profiles.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index ebd7da2a2..4a6a0a80e 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1547,8 +1547,8 @@ because the NUMBER is zero.)" (define (canonicalize-profile profile) "If PROFILE is %USER-PROFILE-DIRECTORY, return %CURRENT-PROFILE. Otherwise -return PROFILE unchanged. The goal is to treat '-p ~/.guix-profile' as if -'-p' was omitted." ; see +return PROFILE as an absolute path. The goal is to treat '-p ~/.guix-profile' +as if '-p' was omitted." ; see ;; Trim trailing slashes so that the basename comparison below works as ;; intended. @@ -1558,7 +1558,10 @@ return PROFILE unchanged. The goal is to treat '-p ~/.guix-profile' as if (dirname %user-profile-directory)) (string=? (basename profile) (basename %user-profile-directory))) %current-profile - profile))) + (string-append + (canonicalize-path (dirname profile)) + file-name-separator-string + (basename profile))))) (define (user-friendly-profile profile) "Return either ~/.guix-profile if that's what PROFILE refers to, directly or -- 2.17.0 --=-=-=--