aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/cuirass.in5
-rw-r--r--bin/evaluate.in5
-rw-r--r--src/cuirass/base.scm22
3 files changed, 31 insertions, 1 deletions
diff --git a/bin/cuirass.in b/bin/cuirass.in
index b41a713..7df5ddb 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -7,6 +7,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
!#
;;;; cuirass -- continuous integration tool
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of Cuirass.
;;;
@@ -34,6 +35,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
--one-shot Evaluate and build jobs only once
--cache-directory=DIR Use DIR for storing repository data
+ -L --load-path=DIR Prepend DIR to Guix package module search path.
-S --specifications=SPECFILE
Add specifications from SPECFILE to database.
-D --database=DB Use DB to store build results.
@@ -48,6 +50,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(define %options
'((one-shot (value #f))
(cache-directory (value #t))
+ (load-path (single-char #\L) (value #t))
(specifications (single-char #\S) (value #t))
(database (single-char #\D) (value #t))
(port (single-char #\p) (value #t))
@@ -68,6 +71,8 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(%package-database (option-ref opts 'database (%package-database)))
(%package-cachedir
(option-ref opts 'cache-directory (%package-cachedir)))
+ (%guix-package-path
+ (option-ref opts 'load-path (%guix-package-path)))
(%use-substitutes? (option-ref opts 'use-substitutes #f)))
(cond
((option-ref opts 'help #f)
diff --git a/bin/evaluate.in b/bin/evaluate.in
index c8a45ce..0508783 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -8,6 +8,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
;;;; evaluate -- convert a specification to a job list
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of Cuirass.
;;;
@@ -32,7 +33,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(define* (main #:optional (args (command-line)))
(match args
- ((command load-path cachedir specstr database)
+ ((command load-path guix-package-path cachedir specstr database)
;; Load FILE, a Scheme file that defines Hydra jobs.
(let ((%user-module (make-fresh-user-module))
(spec (with-input-from-string specstr read))
@@ -58,6 +59,8 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
(exit 1)))
(parameterize ((%package-database database)
(%use-substitutes? (assoc-ref spec #:use-substitutes?)))
+ (unless (string-null? guix-package-path)
+ (set-guix-package-path! guix-package-path))
;; Call the entry point of FILE and print the resulting job sexp.
(let* ((proc-name (assq-ref spec #:proc))
(proc (module-ref %user-module proc-name))
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 8a14ddc..2fde19b 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -1,6 +1,7 @@
;;; base.scm -- Cuirass base module
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of Cuirass.
;;;
@@ -20,6 +21,7 @@
(define-module (cuirass base)
#:use-module (cuirass database)
#:use-module (cuirass utils)
+ #:use-module (gnu packages)
#:use-module (guix derivations)
#:use-module (guix store)
#:use-module (ice-9 format)
@@ -33,7 +35,9 @@
evaluate
build-packages
process-specs
+ set-guix-package-path!
;; Parameters.
+ %guix-package-path
%package-cachedir
%use-substitutes?))
@@ -114,6 +118,7 @@ if required."
(string-append (%package-cachedir) "/"
(assq-ref spec #:name) "/"
(assq-ref spec #:load-path))
+ (%guix-package-path)
(%package-cachedir)
(object->string spec)
(%package-database)))
@@ -174,3 +179,20 @@ if required."
(db-add-stamp db spec commit)))
(for-each process jobspecs))
+
+
+;;;
+;;; Guix package path.
+;;;
+
+(define %guix-package-path
+ ;; Extension of package modules search path.
+ (make-parameter ""))
+
+(define (set-guix-package-path! path)
+ "Use PATH to find custom packages not defined in (gnu packages ...)
+namespace or not already present in current Guile load paths."
+ (%package-module-path (cons path (%package-module-path)))
+ (%patch-path (cons path (%patch-path)))
+ (set! %load-path (cons path %load-path))
+ (set! %load-compiled-path (cons path %load-compiled-path)))