aboutsummaryrefslogtreecommitdiff
path: root/guix/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-22 15:00:53 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-23 00:23:12 +0100
commitd26e19671e2a50a25d37357aba301bef5df1818e (patch)
tree4b3c6fd70004e12d7ffb2acc5c137cf72dbe4bf5 /guix/derivations.scm
parent6985335faaa23965887b62ce8123f8f12e352bd5 (diff)
downloadgnu-guix-d26e19671e2a50a25d37357aba301bef5df1818e.tar
gnu-guix-d26e19671e2a50a25d37357aba301bef5df1818e.tar.gz
derivations: Raise an error when a module file is not found.
Suggested by Jookia. * guix/derivations.scm (&file-search-error): New error condition. (search-path*): Raise it when 'search-path' returns #f. * guix/gexp.scm (search-path*): Remove. * guix/ui.scm (call-with-error-handling): Add case for 'file-search-error?'. * tests/derivations.scm ("build-expression->derivation and invalid module name"): New test.
Diffstat (limited to 'guix/derivations.scm')
-rw-r--r--guix/derivations.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 2af65b1dc0..2d8584e72d 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -90,7 +90,11 @@
build-derivations
built-derivations
+ file-search-error?
+ file-search-error-file-name
+ file-search-error-search-path
+ search-path*
module->source-file-name
build-expression->derivation)
@@ -1036,10 +1040,22 @@ system, imported, and appears under FINAL-PATH in the resulting store path."
#:guile-for-build guile
#:local-build? #t)))
+;; The "file not found" error condition.
+(define-condition-type &file-search-error &error
+ file-search-error?
+ (file file-search-error-file-name)
+ (path file-search-error-search-path))
+
(define search-path*
;; A memoizing version of 'search-path' so 'imported-modules' does not end
;; up looking for the same files over and over again.
- (memoize search-path))
+ (memoize (lambda (path file)
+ "Search for FILE in PATH and memoize the result. Raise a
+'&file-search-error' condition if it could not be found."
+ (or (search-path path file)
+ (raise (condition
+ (&file-search-error (file file)
+ (path path))))))))
(define (module->source-file-name module)
"Return the file name corresponding to MODULE, a Guile module name (a list