[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
28/66: guix package: Move profile cleaning out of 'search-path-environme
From: |
Manolis Fragkiskos Ragkousis |
Subject: |
28/66: guix package: Move profile cleaning out of 'search-path-environment-variables'. |
Date: |
Thu, 21 May 2015 12:51:57 +0000 |
phant0mas pushed a commit to branch wip-hurd
in repository guix.
commit 701559d2be58f760c71adfa0267d5bdee01eb283
Author: Ludovic Courtès <address@hidden>
Date: Sun May 3 22:33:27 2015 +0200
guix package: Move profile cleaning out of
'search-path-environment-variables'.
* guix/scripts/package.scm (user-friendly-profile): New procedure.
(search-path-environment-variables): Remove 'profile' local variable.
(display-search-paths): Explicitly call 'user-friendly-profile' for
the argument to 'search-path-environment-variables'.
(guix-package)[process-query]: Likewise.
---
guix/scripts/package.scm | 80 +++++++++++++++++++++++----------------------
1 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index fca70f5..d9bad7b 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -89,6 +89,15 @@ return PROFILE unchanged. The goal is to treat '-p
~/.guix-profile' as if
%current-profile
profile))
+(define (user-friendly-profile profile)
+ "Return either ~/.guix-profile if that's what PROFILE refers to, directly or
+indirectly, or PROFILE."
+ (if (and %user-profile-directory
+ (false-if-exception
+ (string=? (readlink %user-profile-directory) profile)))
+ %user-profile-directory
+ profile))
+
(define (link-to-empty-profile store generation)
"Link GENERATION, a string, to the empty profile."
(let* ((drv (run-with-store store
@@ -375,49 +384,41 @@ an output path different than CURRENT-PATH."
"Return environment variable definitions that may be needed for the use of
ENTRIES, a list of manifest entries, in PROFILE. Use GETENV to determine the
current settings and report only settings not already effective."
-
- ;; Prefer ~/.guix-profile to the real profile directory name.
- (let ((profile (if (and %user-profile-directory
- (false-if-exception
- (string=? (readlink %user-profile-directory)
- profile)))
- %user-profile-directory
- profile)))
-
- (define search-path-definition
- (match-lambda
- (($ <search-path-specification> variable files separator
- type pattern)
- (let* ((values (or (and=> (getenv variable)
- (cut string-tokenize* <> separator))
- '()))
- ;; Add a trailing slash to force symlinks to be treated as
- ;; directories when 'find-files' traverses them.
- (files (if pattern
- (map (cut string-append <> "/") files)
- files))
-
- ;; XXX: Silence 'find-files' when it stumbles upon non-existent
- ;; directories (see
- ;;
<http://lists.gnu.org/archive/html/guix-devel/2015-01/msg00269.html>.)
- (path (with-null-error-port
- (search-path-as-list files (list profile)
- #:type type
- #:pattern pattern))))
- (if (every (cut member <> values) path)
- #f
- (format #f "export ~a=\"~a\""
- variable
- (string-join path separator)))))))
-
- (let ((search-paths (delete-duplicates
- (append-map manifest-entry-search-paths entries))))
- (filter-map search-path-definition search-paths))))
+ (define search-path-definition
+ (match-lambda
+ (($ <search-path-specification> variable files separator
+ type pattern)
+ (let* ((values (or (and=> (getenv variable)
+ (cut string-tokenize* <> separator))
+ '()))
+ ;; Add a trailing slash to force symlinks to be treated as
+ ;; directories when 'find-files' traverses them.
+ (files (if pattern
+ (map (cut string-append <> "/") files)
+ files))
+
+ ;; XXX: Silence 'find-files' when it stumbles upon non-existent
+ ;; directories (see
+ ;;
<http://lists.gnu.org/archive/html/guix-devel/2015-01/msg00269.html>.)
+ (path (with-null-error-port
+ (search-path-as-list files (list profile)
+ #:type type
+ #:pattern pattern))))
+ (if (every (cut member <> values) path)
+ #f
+ (format #f "export ~a=\"~a\""
+ variable
+ (string-join path separator)))))))
+
+ (let ((search-paths (delete-duplicates
+ (append-map manifest-entry-search-paths entries))))
+ (filter-map search-path-definition search-paths)))
(define (display-search-paths entries profile)
"Display the search path environment variables that may need to be set for
ENTRIES, a list of manifest entries, in the context of PROFILE."
- (let ((settings (search-path-environment-variables entries profile)))
+ (let* ((profile (user-friendly-profile profile))
+ (settings (search-path-environment-variables entries profile)))
(unless (null? settings)
(format #t (_ "The following environment variable definitions may be
needed:~%"))
(format #t "~{ ~a~%~}" settings))))
@@ -999,6 +1000,7 @@ more information.~%"))
(('search-paths)
(let* ((manifest (profile-manifest profile))
(entries (manifest-entries manifest))
+ (profile (user-friendly-profile profile))
(settings (search-path-environment-variables entries profile
(const #f))))
(format #t "~{~a~%~}" settings)
- 17/66: gnu: parallel: Update to 20150422., (continued)
- 17/66: gnu: parallel: Update to 20150422., Manolis Fragkiskos Ragkousis, 2015/05/21
- 21/66: gnu: gnupg: Update to 2.1.3., Manolis Fragkiskos Ragkousis, 2015/05/21
- 20/66: gnu: Add dovecot., Manolis Fragkiskos Ragkousis, 2015/05/21
- 22/66: gnu: subversion: Update to 1.8.13., Manolis Fragkiskos Ragkousis, 2015/05/21
- 03/66: gnu: linux-libre: Update to 4.0.1., Manolis Fragkiskos Ragkousis, 2015/05/21
- 19/66: gnu: acpica: Update to 20150410., Manolis Fragkiskos Ragkousis, 2015/05/21
- 25/66: gnu: Add libe-book., Manolis Fragkiskos Ragkousis, 2015/05/21
- 23/66: gnu: rename (gnu packages socat) to (gnu packages networking)., Manolis Fragkiskos Ragkousis, 2015/05/21
- 26/66: doc: Replace reference to profile.sh with sh-symlink, Manolis Fragkiskos Ragkousis, 2015/05/21
- 27/66: gnu: Add totem-pl-parser., Manolis Fragkiskos Ragkousis, 2015/05/21
- 28/66: guix package: Move profile cleaning out of 'search-path-environment-variables'.,
Manolis Fragkiskos Ragkousis <=
- 29/66: guix package: Introduce 'evaluate-search-paths'., Manolis Fragkiskos Ragkousis, 2015/05/21
- 30/66: gnu: gcc-5.1: Add specific libvtv patch., Manolis Fragkiskos Ragkousis, 2015/05/21
- 24/66: gnu: Add zeromq., Manolis Fragkiskos Ragkousis, 2015/05/21
- 32/66: gnu: samtools: Install libbam.a library., Manolis Fragkiskos Ragkousis, 2015/05/21
- 38/66: doc: Fix dangling references in the 'sh-symlink' monad example., Manolis Fragkiskos Ragkousis, 2015/05/21
- 37/66: doc: Suggest 'groupadd --system'., Manolis Fragkiskos Ragkousis, 2015/05/21
- 34/66: gnu: Add taskwarrior., Manolis Fragkiskos Ragkousis, 2015/05/21
- 39/66: gnu: Add python-sympy., Manolis Fragkiskos Ragkousis, 2015/05/21
- 35/66: gnu: bamtools: Set rpath via LDFLAGS., Manolis Fragkiskos Ragkousis, 2015/05/21
- 33/66: gnu: Add samtools-0.1.19., Manolis Fragkiskos Ragkousis, 2015/05/21