environment: Use 'evaluate-search-paths'.
This allows 'guix environment' to correctly handle non-directory and/or pattern search-path specifications, such as that for 'XML_CATALOG_FILES'. * guix/scripts/environment.scm (for-each-search-path): Use 'evaluate-search-paths' instead of 'search-path-as-list' & co.
This commit is contained in:
parent
fdfa753c69
commit
b9ea6c6bf4
|
@ -1,5 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
||||||
|
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
#:use-module (guix search-paths)
|
#:use-module (guix search-paths)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (guix monads)
|
#:use-module (guix monads)
|
||||||
#:use-module (guix build utils)
|
|
||||||
#:use-module (guix scripts build)
|
#:use-module (guix scripts build)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
|
@ -41,25 +41,24 @@
|
||||||
Use the output paths of DERIVATIONS to build each search path. When PURE? is
|
Use the output paths of DERIVATIONS to build each search path. When PURE? is
|
||||||
#t, the existing search path value is ignored. Otherwise, the existing search
|
#t, the existing search path value is ignored. Otherwise, the existing search
|
||||||
path value is appended."
|
path value is appended."
|
||||||
(let ((paths (append-map (lambda (drv)
|
(let ((directories (append-map (lambda (drv)
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
((_ . output)
|
((_ . output)
|
||||||
(derivation-output-path output)))
|
(derivation-output-path output)))
|
||||||
(derivation-outputs drv)))
|
(derivation-outputs drv)))
|
||||||
derivations)))
|
derivations))
|
||||||
|
(paths (cons $PATH
|
||||||
|
(delete-duplicates
|
||||||
|
(append-map package-native-search-paths
|
||||||
|
inputs)))))
|
||||||
(for-each (match-lambda
|
(for-each (match-lambda
|
||||||
(($ <search-path-specification>
|
((($ <search-path-specification> variable _ sep) . value)
|
||||||
variable directories separator)
|
(let ((current (getenv variable)))
|
||||||
(let* ((current (getenv variable))
|
|
||||||
(path (search-path-as-list directories paths))
|
|
||||||
(value (list->search-path-as-string path separator)))
|
|
||||||
(proc variable
|
(proc variable
|
||||||
(if (and current (not pure?))
|
(if (and current (not pure?))
|
||||||
(string-append value separator current)
|
(string-append value sep current)
|
||||||
value)))))
|
value)))))
|
||||||
(cons* $PATH
|
(evaluate-search-paths paths directories))))
|
||||||
(delete-duplicates
|
|
||||||
(append-map package-native-search-paths inputs))))))
|
|
||||||
|
|
||||||
;; Protect some env vars from purification. Borrowed from nix-shell.
|
;; Protect some env vars from purification. Borrowed from nix-shell.
|
||||||
(define %precious-variables
|
(define %precious-variables
|
||||||
|
|
Loading…
Reference in New Issue