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'.
This commit is contained in:
parent
b07901c0cc
commit
441cfb420a
|
@ -383,8 +383,12 @@ current settings and report only settings not already effective."
|
||||||
(let ((search-paths (delete-duplicates
|
(let ((search-paths (delete-duplicates
|
||||||
(append-map manifest-entry-search-paths entries))))
|
(append-map manifest-entry-search-paths entries))))
|
||||||
(filter-map (match-lambda
|
(filter-map (match-lambda
|
||||||
((variable . value)
|
((spec . value)
|
||||||
(environment-variable-definition variable 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))))
|
(evaluate-search-paths search-paths profile getenv))))
|
||||||
|
|
||||||
(define (display-search-paths entries profile)
|
(define (display-search-paths entries profile)
|
||||||
|
|
|
@ -117,12 +117,13 @@ like `string-tokenize', but SEPARATOR is a string."
|
||||||
(define* (evaluate-search-paths search-paths directory
|
(define* (evaluate-search-paths search-paths directory
|
||||||
#:optional (getenv (const #f)))
|
#:optional (getenv (const #f)))
|
||||||
"Evaluate SEARCH-PATHS, a list of search-path specifications, for DIRECTORY,
|
"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."
|
current settings and report only settings not already effective."
|
||||||
(define search-path-definition
|
(define search-path-definition
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <search-path-specification> variable files separator
|
((and spec
|
||||||
type pattern)
|
($ <search-path-specification> variable files separator
|
||||||
|
type pattern))
|
||||||
(let* ((values (or (and=> (getenv variable)
|
(let* ((values (or (and=> (getenv variable)
|
||||||
(cut string-tokenize* <> separator))
|
(cut string-tokenize* <> separator))
|
||||||
'()))
|
'()))
|
||||||
|
@ -141,7 +142,7 @@ current settings and report only settings not already effective."
|
||||||
#:pattern pattern))))
|
#:pattern pattern))))
|
||||||
(if (every (cut member <> values) path)
|
(if (every (cut member <> values) path)
|
||||||
#f ;VARIABLE is already set appropriately
|
#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))
|
(filter-map search-path-definition search-paths))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue