guix-commits
[Top][All Lists]
Advanced

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

02/05: derivations: Add 'module->source-file-name'.


From: Ludovic Courtès
Subject: 02/05: derivations: Add 'module->source-file-name'.
Date: Tue, 22 Mar 2016 23:23:20 +0000

civodul pushed a commit to branch master
in repository guix.

commit 6985335faaa23965887b62ce8123f8f12e352bd5
Author: Ludovic Courtès <address@hidden>
Date:   Tue Mar 22 14:58:59 2016 +0100

    derivations: Add 'module->source-file-name'.
    
    * guix/derivations.scm (module->source-file-name): New procedure.
    (%imported-modules): Use it.
    * guix/gexp.scm (imported-modules): Likewise.
---
 guix/derivations.scm |   11 ++++++++---
 guix/gexp.scm        |    4 +---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index f24e3c6..2af65b1 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -91,6 +91,7 @@
             built-derivations
 
 
+            module->source-file-name
             build-expression->derivation)
 
   ;; Re-export it from here for backward compatibility.
@@ -1040,6 +1041,12 @@ system, imported, and appears under FINAL-PATH in the 
resulting store path."
   ;; up looking for the same files over and over again.
   (memoize search-path))
 
+(define (module->source-file-name module)
+  "Return the file name corresponding to MODULE, a Guile module name (a list
+of symbols.)"
+  (string-append (string-join (map symbol->string module) "/")
+                 ".scm"))
+
 (define* (%imported-modules store modules         ;deprecated
                             #:key (name "module-import")
                             (system (%current-system))
@@ -1051,9 +1058,7 @@ search path."
   ;; TODO: Determine the closure of MODULES, build the `.go' files,
   ;; canonicalize the source files through read/write, etc.
   (let ((files (map (lambda (m)
-                      (let ((f (string-append
-                                (string-join (map symbol->string m) "/")
-                                ".scm")))
+                      (let ((f (module->source-file-name m)))
                         (cons f (search-path* module-path f))))
                     modules)))
     (imported-files store files #:name name #:system system
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 7cbc79c..c408c94 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -918,9 +918,7 @@ search path."
   ;; TODO: Determine the closure of MODULES, build the `.go' files,
   ;; canonicalize the source files through read/write, etc.
   (let ((files (map (lambda (m)
-                      (let ((f (string-append
-                                (string-join (map symbol->string m) "/")
-                                ".scm")))
+                      (let ((f (module->source-file-name m)))
                         (cons f (search-path* module-path f))))
                     modules)))
     (imported-files files #:name name #:system system



reply via email to

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