summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-02 01:51:56 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-02 01:51:56 +0200
commit94f910355ca989832814e9b27fa6d2b194e22ec7 (patch)
tree201842303299239f1d149963f9fb870c27195199 /bin
parentb185505db018ce99cf2d526418dbf6a8848cde83 (diff)
downloadcuirass-94f910355ca989832814e9b27fa6d2b194e22ec7.tar
cuirass-94f910355ca989832814e9b27fa6d2b194e22ec7.tar.gz
job: Add load-path field to <job-spec>.
Diffstat (limited to 'bin')
-rw-r--r--bin/cuirass.in41
1 files changed, 26 insertions, 15 deletions
diff --git a/bin/cuirass.in b/bin/cuirass.in
index 979c93d..23ac649 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -72,15 +72,22 @@ DIR if required."
commit
(string-append "origin/" branch)))))))))
+(define (set-load-path! cachedir spec)
+ "Set %LOAD-PATH to match what is specified in SPEC."
+ (let* ((name (job-spec-name spec))
+ (path (job-spec-load-path spec))
+ (dir (string-join (list cachedir name path) "/")))
+ (format #t "prepending ~s to the load path~%" dir)
+ (set! %load-path (cons dir %load-path))))
+
(define (evaluate store db cachedir spec)
"Evaluate and build package derivations. Return a list a jobs."
(save-module-excursion
(lambda ()
(set-current-module %user-module)
- (let ((dir (string-append cachedir "/" (job-spec-name spec))))
- (format #t "prepending ~s to the load path~%" dir)
- (set! %load-path (cons dir %load-path)))
- (primitive-load (job-spec-file spec))))
+ ;; Handle both relative and absolute file names for SPEC-FILE.
+ (with-directory-excursion cachedir
+ (primitive-load (job-spec-file spec)))))
(let* ((proc (module-ref %user-module (job-spec-proc spec)))
(jobs (proc store (job-spec-arguments spec))))
(map (λ (job)
@@ -140,16 +147,20 @@ DIR if required."
(for-each
(λ (spec)
(fetch-repository cachedir spec)
- (let ((store ((guix-variable 'store 'open-connection))))
- (dynamic-wind
- (const #t)
- (lambda ()
- (let ((jobs (evaluate store db cachedir spec))
- (set-build-options
- (guix-variable 'store 'set-build-options)))
- (set-build-options store #:use-substitutes? #f)
- (build-packages store db jobs)))
- (lambda ()
- ((guix-variable 'store 'close-connection) store)))))
+ (let ((old-path %load-path))
+ (and (job-spec-load-path spec)
+ (set-load-path! cachedir spec))
+ (let ((store ((guix-variable 'store 'open-connection))))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ (let ((jobs (evaluate store db cachedir spec))
+ (set-build-options
+ (guix-variable 'store 'set-build-options)))
+ (set-build-options store #:use-substitutes? #f)
+ (build-packages store db jobs)))
+ (lambda ()
+ ((guix-variable 'store 'close-connection) store)
+ (set! %load-path old-path))))))
specs)
(sleep (string->number interval))))))))))