summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-22 14:58:59 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-23 00:23:12 +0100
commit6985335faaa23965887b62ce8123f8f12e352bd5 (patch)
tree60cdacc2ff16ce733531f7241075163513d43cd2
parent8c321299c532e620c0d2327dd15acad3d6b4476c (diff)
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.
-rw-r--r--guix/derivations.scm11
-rw-r--r--guix/gexp.scm4
2 files changed, 9 insertions, 6 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index f24e3c6f92..2af65b1dc0 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 7cbc79c31c..c408c94c43 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