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.
This commit is contained in:
Ludovic Courtès 2016-03-22 14:58:59 +01:00
parent 8c321299c5
commit 6985335faa
2 changed files with 9 additions and 6 deletions

View File

@ -91,6 +91,7 @@
built-derivations built-derivations
module->source-file-name
build-expression->derivation) build-expression->derivation)
;; Re-export it from here for backward compatibility. ;; 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. ;; up looking for the same files over and over again.
(memoize search-path)) (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 (define* (%imported-modules store modules ;deprecated
#:key (name "module-import") #:key (name "module-import")
(system (%current-system)) (system (%current-system))
@ -1051,9 +1058,7 @@ search path."
;; TODO: Determine the closure of MODULES, build the `.go' files, ;; TODO: Determine the closure of MODULES, build the `.go' files,
;; canonicalize the source files through read/write, etc. ;; canonicalize the source files through read/write, etc.
(let ((files (map (lambda (m) (let ((files (map (lambda (m)
(let ((f (string-append (let ((f (module->source-file-name m)))
(string-join (map symbol->string m) "/")
".scm")))
(cons f (search-path* module-path f)))) (cons f (search-path* module-path f))))
modules))) modules)))
(imported-files store files #:name name #:system system (imported-files store files #:name name #:system system

View File

@ -918,9 +918,7 @@ search path."
;; TODO: Determine the closure of MODULES, build the `.go' files, ;; TODO: Determine the closure of MODULES, build the `.go' files,
;; canonicalize the source files through read/write, etc. ;; canonicalize the source files through read/write, etc.
(let ((files (map (lambda (m) (let ((files (map (lambda (m)
(let ((f (string-append (let ((f (module->source-file-name m)))
(string-join (map symbol->string m) "/")
".scm")))
(cons f (search-path* module-path f)))) (cons f (search-path* module-path f))))
modules))) modules)))
(imported-files files #:name name #:system system (imported-files files #:name name #:system system