guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/05: environment: Use 'evaluate-search-paths'.


From: Ludovic Courtès
Subject: 04/05: environment: Use 'evaluate-search-paths'.
Date: Tue, 05 May 2015 13:14:15 +0000

civodul pushed a commit to branch master
in repository guix.

commit b9ea6c6bf4948fd15876c915febad430e3177e42
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 5 14:10:57 2015 +0200

    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.
---
 guix/scripts/environment.scm |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 36d7beb..cf402d3 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 David Thompson <address@hidden>
+;;; Copyright © 2015 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,7 +26,6 @@
   #:use-module (guix search-paths)
   #:use-module (guix utils)
   #:use-module (guix monads)
-  #:use-module (guix build utils)
   #:use-module (guix scripts build)
   #:use-module (gnu packages)
   #:use-module (ice-9 format)
@@ -41,25 +41,24 @@
 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
 path value is appended."
-  (let ((paths (append-map (lambda (drv)
-                             (map (match-lambda
-                                   ((_ . output)
-                                    (derivation-output-path output)))
-                                  (derivation-outputs drv)))
-                           derivations)))
+  (let ((directories (append-map (lambda (drv)
+                                   (map (match-lambda
+                                          ((_ . output)
+                                           (derivation-output-path output)))
+                                        (derivation-outputs drv)))
+                                 derivations))
+        (paths       (cons $PATH
+                           (delete-duplicates
+                            (append-map package-native-search-paths
+                                        inputs)))))
     (for-each (match-lambda
-               (($ <search-path-specification>
-                   variable directories separator)
-                (let* ((current (getenv variable))
-                       (path    (search-path-as-list directories paths))
-                       (value   (list->search-path-as-string path separator)))
-                  (proc variable
-                        (if (and current (not pure?))
-                            (string-append value separator current)
-                            value)))))
-              (cons* $PATH
-                     (delete-duplicates
-                      (append-map package-native-search-paths inputs))))))
+                ((($ <search-path-specification> variable _ sep) . value)
+                 (let ((current  (getenv variable)))
+                   (proc variable
+                         (if (and current (not pure?))
+                             (string-append value sep current)
+                             value)))))
+              (evaluate-search-paths paths directories))))
 
 ;; Protect some env vars from purification.  Borrowed from nix-shell.
 (define %precious-variables



reply via email to

[Prev in Thread] Current Thread [Next in Thread]