base: Pass the correct load path to the 'evaluate' command.

The previous load path was potentially incorrect since commit
2fe7ff87e2.

* 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.
This commit is contained in:
Ludovic Courtès 2018-04-07 18:18:37 +02:00
parent a3a7c09b06
commit 2ba45edf2f
2 changed files with 27 additions and 10 deletions

View File

@ -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.

View File

@ -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)