[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/03: guix package: Trim trailing slashes from the profile name.
From: |
Ludovic Courtès |
Subject: |
02/03: guix package: Trim trailing slashes from the profile name. |
Date: |
Thu, 20 Jul 2017 09:29:22 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit edbe07cd67d6050d94fe8ac1af15ab15e857b61d
Author: Ludovic Courtès <address@hidden>
Date: Thu Jul 20 15:23:13 2017 +0200
guix package: Trim trailing slashes from the profile name.
Fixes <https://bugs.gnu.org/25762>.
Reported by Ricardo Wurmus <address@hidden>.
* guix/scripts/package.scm (canonicalize-profile): Trim trailing slashes
from PROFILE.
---
guix/scripts/package.scm | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 58da311..96ee5c0 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -84,12 +84,16 @@
"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 <http://bugs.gnu.org/17939>
- (if (and %user-profile-directory
- (string=? (canonicalize-path (dirname profile))
- (dirname %user-profile-directory))
- (string=? (basename profile) (basename %user-profile-directory)))
- %current-profile
- profile))
+
+ ;; Trim trailing slashes so that the basename comparison below works as
+ ;; intended.
+ (let ((profile (string-trim-right profile #\/)))
+ (if (and %user-profile-directory
+ (string=? (canonicalize-path (dirname profile))
+ (dirname %user-profile-directory))
+ (string=? (basename profile) (basename %user-profile-directory)))
+ %current-profile
+ profile)))
(define (user-friendly-profile profile)
"Return either ~/.guix-profile if that's what PROFILE refers to, directly or