summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-04-07 18:18:37 +0200
committerLudovic Courtès <ludo@gnu.org>2018-04-07 18:33:27 +0200
commit2ba45edf2f4dfdd57e9416735128052ad4d5ee12 (patch)
tree6535b8c4c01e9c282416c90d32ac7621d8396d98
parenta3a7c09b06027bd30a96ae4607fa40bd790af840 (diff)
downloadcuirass-2ba45edf2f4dfdd57e9416735128052ad4d5ee12.tar
cuirass-2ba45edf2f4dfdd57e9416735128052ad4d5ee12.tar.gz
base: Pass the correct load path to the 'evaluate' command.
The previous load path was potentially incorrect since commit 2fe7ff87e23b18d49bd33cffc4766b7eaa382054. * src/cuirass/base.scm (evaluate)[tokenize, load-path]: New variables. Assume #:load-path is colon-separated. Pass LOAD-PATH as the second argument to 'evaluate'. * doc/cuirass.texi (Database): Adjust documentation.
-rw-r--r--doc/cuirass.texi15
-rw-r--r--src/cuirass/base.scm22
2 files changed, 27 insertions, 10 deletions
diff --git a/doc/cuirass.texi b/doc/cuirass.texi
index fcebef6..b5b27e8 100644
--- a/doc/cuirass.texi
+++ b/doc/cuirass.texi
@@ -11,7 +11,8 @@ This manual is for Cuirass version @value{VERSION}, a build automation
server.
Copyright @copyright{} 2016, 2017 Mathieu Lirzin@*
-Copyright @copyright{} 2017 Mathieu Othacehe
+Copyright @copyright{} 2017 Mathieu Othacehe@*
+Copyright @copyright{} 2018 Ludovic Courtès
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -248,12 +249,16 @@ specification itself.
The URL of the repository.
@item load_path
-This text field holds the name of the subdirectory in the checked out
-repository that is passed to the @code{evaluate} tool as the Guile load
-path. This directory is interpreted relative to the repository in the
-Cuirass cache directory. This will usually be the current directory
+This field holds a colon-separated list of directories that are
+prepended to the Guile load path when evaluating @code{file} (see
+below.)
+
+Each entry that is not an absolute file name is interpreted relative to
+the source code checkout. Often, @code{load_path} has just one entry,
@code{"."}.
+When @code{load_path} is empty, the load path is left unchanged.
+
@item file
The absolute name of the Scheme file containing PROC.
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index c9c5ec1..9e930d4 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -253,12 +253,24 @@ in SOURCE directory. Return a list of jobs."
(#:system . ,(derivation-system drv))
,@job)))
+ (define (tokenize str)
+ (string-tokenize str (char-set-complement (char-set #\:))))
+
+ (define load-path
+ (match (assq-ref spec #:load-path)
+ (#f
+ "")
+ ((= tokenize path)
+ (string-join (map (lambda (entry)
+ (if (string-prefix? "/" entry)
+ entry
+ (string-append source "/" entry)))
+ path)
+ ":"))))
+
(let* ((port (non-blocking-port
- (open-pipe* OPEN_READ
- "evaluate"
- (string-append (%package-cachedir) "/"
- (assq-ref spec #:name) "/"
- (assq-ref spec #:load-path))
+ (open-pipe* OPEN_READ "evaluate"
+ load-path
(%guix-package-path)
source (object->string spec))))
(result (match (read/non-blocking port)