aboutsummaryrefslogtreecommitdiff
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
parentb185505db018ce99cf2d526418dbf6a8848cde83 (diff)
downloadcuirass-94f910355ca989832814e9b27fa6d2b194e22ec7.tar
cuirass-94f910355ca989832814e9b27fa6d2b194e22ec7.tar.gz
job: Add load-path field to <job-spec>.
-rw-r--r--bin/cuirass.in41
-rw-r--r--build-aux/pre-inst-env.in7
-rw-r--r--src/cuirass/job.scm9
-rw-r--r--tests/hello-subset.scm3
4 files changed, 36 insertions, 24 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))))))))))
diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in
index f6af39b..5b61cb2 100644
--- a/build-aux/pre-inst-env.in
+++ b/build-aux/pre-inst-env.in
@@ -22,6 +22,7 @@ abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`"
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/src${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
GUILE_LOAD_PATH="$abs_top_builddir/src:$abs_top_srcdir/src${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
+export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
PATH="$abs_top_builddir/bin:$PATH"
export PATH
@@ -29,10 +30,4 @@ export PATH
CUIRASS_CACHEDIR="$abs_top_builddir/cache"
export CUIRASS_CACHEDIR
-# Append Guix cloned repository to Guile load paths.
-guixdir="$CUIRASS_CACHEDIR/guix"
-GUILE_LOAD_COMPILED_PATH="$guixdir:$GUILE_LOAD_COMPILED_PATH"
-GUILE_LOAD_PATH="$guixdir:$GUILE_LOAD_PATH"
-export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
-
exec "$@"
diff --git a/src/cuirass/job.scm b/src/cuirass/job.scm
index 2e2c304..b6f92c9 100644
--- a/src/cuirass/job.scm
+++ b/src/cuirass/job.scm
@@ -32,6 +32,7 @@
job-spec?
job-spec-name
job-spec-url
+ job-spec-load-path
job-spec-branch
job-spec-commit
job-spec-tag
@@ -58,10 +59,11 @@
metadata)))))
(define-record-type <job-spec>
- (%make-job-spec name url branch commit file proc arguments)
+ (%make-job-spec name url load-path branch commit file proc arguments)
job-spec?
(name job-spec-name) ;string
(url job-spec-url) ;string
+ (load-path job-spec-load-path) ;string
(branch job-spec-branch) ;string
(commit job-spec-commit) ;string
(tag job-spec-tag) ;string
@@ -69,6 +71,7 @@
(proc job-spec-proc) ;symbol
(arguments job-spec-arguments)) ;alist
-(define* (make-job-spec #:key name url commit tag file proc arguments
+(define* (make-job-spec #:key name url load-path
+ commit tag file proc arguments
(branch "master"))
- (%make-job-spec name url branch tag file proc arguments))
+ (%make-job-spec name url load-path branch tag file proc arguments))
diff --git a/tests/hello-subset.scm b/tests/hello-subset.scm
index b270ded..f904782 100644
--- a/tests/hello-subset.scm
+++ b/tests/hello-subset.scm
@@ -27,6 +27,7 @@
(list (make-job-spec
#:name "guix"
#:url "git://git.savannah.gnu.org/guix.git"
+ #:load-path "."
#:branch "master"
#:file (local-file "gnu-system.scm")
#:proc 'hydra-jobs
@@ -34,6 +35,7 @@
(make-job-spec
#:name "guix"
#:url "git://git.savannah.gnu.org/guix.git"
+ #:load-path "."
#:branch "core-updates"
#:file (local-file "gnu-system.scm")
#:proc 'hydra-jobs
@@ -41,6 +43,7 @@
(make-job-spec
#:name "guix"
#:url "git://git.savannah.gnu.org/guix.git"
+ #:load-path "."
#:tag "v0.9.0"
#:file (local-file "gnu-system.scm")
#:proc 'hydra-jobs