guix-commits
[Top][All Lists]
Advanced

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

06/07: guix package: Use 'search-path-as-list' instead of custom code.


From: Ludovic Courtès
Subject: 06/07: guix package: Use 'search-path-as-list' instead of custom code.
Date: Sat, 27 Dec 2014 22:54:54 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit cc9a5c1454f49850c078045c88a300c1195eabc8
Author: Ludovic Courtès <address@hidden>
Date:   Sat Dec 27 23:46:10 2014 +0100

    guix package: Use 'search-path-as-list' instead of custom code.
    
    This will handle the new 'file-type' and 'file-pattern' fields correctly.
    
    * guix/scripts/package.scm 
(search-path-environment-variables)[search-path-definition]:
      Rewrite in terms of 'search-path-as-list'.
---
 guix/scripts/package.scm |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 21dc66c..2f694cd 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -29,7 +29,8 @@
   #:use-module (guix utils)
   #:use-module (guix config)
   #:use-module (guix scripts build)
-  #:use-module ((guix build utils) #:select (directory-exists? mkdir-p))
+  #:use-module ((guix build utils)
+                #:select (directory-exists? mkdir-p search-path-as-list))
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
@@ -362,19 +363,19 @@ current settings and report only settings not already 
effective."
 
     (define search-path-definition
       (match-lambda
-       (($ <search-path-specification> variable directories separator)
-        (let ((values      (or (and=> (getenv variable)
-                                      (cut string-tokenize* <> separator))
-                               '()))
-              (directories (filter file-exists?
-                                   (map (cut string-append profile
-                                             "/" <>)
-                                        directories))))
-          (if (every (cut member <> values) directories)
+       (($ <search-path-specification> variable files separator
+                                       type pattern)
+        (let ((values (or (and=> (getenv variable)
+                                 (cut string-tokenize* <> separator))
+                          '()))
+              (path   (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 directories separator)))))))
+                      (string-join path separator)))))))
 
     (let* ((packages     (filter-map manifest-entry->package entries))
            (search-paths (delete-duplicates



reply via email to

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