From 441cfb420ab7979443cc2752b714738151c9c4e6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 4 May 2015 22:27:11 +0200 Subject: search-paths: 'evaluate-search-paths' now returns spec/value pairs. * guix/search-paths.scm (evaluate-search-paths): Return specification/value pairs instead of variable/value pairs. * guix/scripts/package.scm (search-path-environment-variables): Adjust accordingly. Pass #:separator to 'environment-variable-definition'. --- guix/scripts/package.scm | 8 ++++++-- guix/search-paths.scm | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 9e433dd191..7f53af772f 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -383,8 +383,12 @@ (define* (search-path-environment-variables entries profile (let ((search-paths (delete-duplicates (append-map manifest-entry-search-paths entries)))) (filter-map (match-lambda - ((variable . value) - (environment-variable-definition variable value))) + ((spec . value) + (let ((variable (search-path-specification-variable spec)) + (sep (search-path-specification-separator spec))) + ;; TODO: Offer the choice between exact/prefix/suffix. + (environment-variable-definition variable value + #:separator sep)))) (evaluate-search-paths search-paths profile getenv)))) (define (display-search-paths entries profile) diff --git a/guix/search-paths.scm b/guix/search-paths.scm index 7957c88241..154e508d5b 100644 --- a/guix/search-paths.scm +++ b/guix/search-paths.scm @@ -117,12 +117,13 @@ (define len (define* (evaluate-search-paths search-paths directory #:optional (getenv (const #f))) "Evaluate SEARCH-PATHS, a list of search-path specifications, for DIRECTORY, -and return a list of variable/value pairs. Use GETENV to determine the +and return a list of specification/value pairs. Use GETENV to determine the current settings and report only settings not already effective." (define search-path-definition (match-lambda - (($ variable files separator - type pattern) + ((and spec + ($ variable files separator + type pattern)) (let* ((values (or (and=> (getenv variable) (cut string-tokenize* <> separator)) '())) @@ -141,7 +142,7 @@ (define search-path-definition #:pattern pattern)))) (if (every (cut member <> values) path) #f ;VARIABLE is already set appropriately - (cons variable (string-join path separator))))))) + (cons spec (string-join path separator))))))) (filter-map search-path-definition search-paths)) -- cgit v1.2.3