mirror of https://notabug.org/mthl/cuirass.git
cuirass: add "--load-path" option
* bin/cuirass.in (%options): Add "--load-path" and "-L" command line options. (show-help): Adapt. * src/cuirass/base.scm (%load-package-path): New variable. (preprend-to-package-module-path): New method. (evaluate)[arguments]: Pass %load-package-path. * bin/evaluate.in (main): Read new "load-package-path" argument and add it to load lists with "preprend-to-package-module-path".pull/3/head
parent
d0a5801e39
commit
f44922c046
|
@ -34,6 +34,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
|
||||||
|
|
||||||
--one-shot Evaluate and build jobs only once
|
--one-shot Evaluate and build jobs only once
|
||||||
--cache-directory=DIR Use DIR for storing repository data
|
--cache-directory=DIR Use DIR for storing repository data
|
||||||
|
-L --load-path=DIR Prepend DIR to the package module search path.
|
||||||
-S --specifications=SPECFILE
|
-S --specifications=SPECFILE
|
||||||
Add specifications from SPECFILE to database.
|
Add specifications from SPECFILE to database.
|
||||||
-D --database=DB Use DB to store build results.
|
-D --database=DB Use DB to store build results.
|
||||||
|
@ -48,6 +49,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
|
||||||
(define %options
|
(define %options
|
||||||
'((one-shot (value #f))
|
'((one-shot (value #f))
|
||||||
(cache-directory (value #t))
|
(cache-directory (value #t))
|
||||||
|
(load-path (single-char #\L) (value #t))
|
||||||
(specifications (single-char #\S) (value #t))
|
(specifications (single-char #\S) (value #t))
|
||||||
(database (single-char #\D) (value #t))
|
(database (single-char #\D) (value #t))
|
||||||
(port (single-char #\p) (value #t))
|
(port (single-char #\p) (value #t))
|
||||||
|
@ -68,6 +70,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
|
||||||
(%package-database (option-ref opts 'database (%package-database)))
|
(%package-database (option-ref opts 'database (%package-database)))
|
||||||
(%package-cachedir
|
(%package-cachedir
|
||||||
(option-ref opts 'cache-directory (%package-cachedir)))
|
(option-ref opts 'cache-directory (%package-cachedir)))
|
||||||
|
(%load-package-path (option-ref opts 'load-path (%load-package-path)))
|
||||||
(%use-substitutes? (option-ref opts 'use-substitutes #f)))
|
(%use-substitutes? (option-ref opts 'use-substitutes #f)))
|
||||||
(cond
|
(cond
|
||||||
((option-ref opts 'help #f)
|
((option-ref opts 'help #f)
|
||||||
|
|
|
@ -32,7 +32,7 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
|
||||||
|
|
||||||
(define* (main #:optional (args (command-line)))
|
(define* (main #:optional (args (command-line)))
|
||||||
(match args
|
(match args
|
||||||
((command load-path cachedir specstr database)
|
((command load-path load-package-path cachedir specstr database)
|
||||||
;; Load FILE, a Scheme file that defines Hydra jobs.
|
;; Load FILE, a Scheme file that defines Hydra jobs.
|
||||||
(let ((%user-module (make-fresh-user-module))
|
(let ((%user-module (make-fresh-user-module))
|
||||||
(spec (with-input-from-string specstr read))
|
(spec (with-input-from-string specstr read))
|
||||||
|
@ -58,6 +58,8 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
|
||||||
(exit 1)))
|
(exit 1)))
|
||||||
(parameterize ((%package-database database)
|
(parameterize ((%package-database database)
|
||||||
(%use-substitutes? (assoc-ref spec #:use-substitutes?)))
|
(%use-substitutes? (assoc-ref spec #:use-substitutes?)))
|
||||||
|
(if load-package-path
|
||||||
|
(prepend-to-package-module-path load-package-path))
|
||||||
;; Call the entry point of FILE and print the resulting job sexp.
|
;; Call the entry point of FILE and print the resulting job sexp.
|
||||||
(let* ((proc-name (assq-ref spec #:proc))
|
(let* ((proc-name (assq-ref spec #:proc))
|
||||||
(proc (module-ref %user-module proc-name))
|
(proc (module-ref %user-module proc-name))
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#:use-module (cuirass utils)
|
#:use-module (cuirass utils)
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
|
#:use-module (gnu packages)
|
||||||
#:use-module (ice-9 format)
|
#:use-module (ice-9 format)
|
||||||
#:use-module (ice-9 popen)
|
#:use-module (ice-9 popen)
|
||||||
#:use-module (ice-9 rdelim)
|
#:use-module (ice-9 rdelim)
|
||||||
|
@ -33,14 +34,20 @@
|
||||||
evaluate
|
evaluate
|
||||||
build-packages
|
build-packages
|
||||||
process-specs
|
process-specs
|
||||||
|
prepend-to-package-module-path
|
||||||
;; Parameters.
|
;; Parameters.
|
||||||
%package-cachedir
|
%package-cachedir
|
||||||
|
%load-package-path
|
||||||
%use-substitutes?))
|
%use-substitutes?))
|
||||||
|
|
||||||
(define %use-substitutes?
|
(define %use-substitutes?
|
||||||
;; Define whether to use substitutes
|
;; Define whether to use substitutes
|
||||||
(make-parameter #f))
|
(make-parameter #f))
|
||||||
|
|
||||||
|
(define %load-package-path
|
||||||
|
;; Extension of package module search path.
|
||||||
|
(make-parameter #f))
|
||||||
|
|
||||||
(define %package-cachedir
|
(define %package-cachedir
|
||||||
;; Define to location of cache directory of this package.
|
;; Define to location of cache directory of this package.
|
||||||
(make-parameter (or (getenv "CUIRASS_CACHEDIR")
|
(make-parameter (or (getenv "CUIRASS_CACHEDIR")
|
||||||
|
@ -52,6 +59,12 @@
|
||||||
(scm-error 'wrong-type-arg
|
(scm-error 'wrong-type-arg
|
||||||
"%package-cachedir" "Not a string: ~S" (list #f) #f)))))
|
"%package-cachedir" "Not a string: ~S" (list #f) #f)))))
|
||||||
|
|
||||||
|
(define (prepend-to-package-module-path load-path)
|
||||||
|
(%package-module-path (cons load-path (%package-module-path)))
|
||||||
|
(%patch-path (cons load-path (%patch-path)))
|
||||||
|
(set! %load-path (cons load-path %load-path))
|
||||||
|
(set! %load-compiled-path (cons load-path %load-compiled-path)))
|
||||||
|
|
||||||
(define (call-with-time thunk kont)
|
(define (call-with-time thunk kont)
|
||||||
"Call THUNK and pass KONT the elapsed time followed by THUNK's return
|
"Call THUNK and pass KONT the elapsed time followed by THUNK's return
|
||||||
values."
|
values."
|
||||||
|
@ -114,6 +127,7 @@ if required."
|
||||||
(string-append (%package-cachedir) "/"
|
(string-append (%package-cachedir) "/"
|
||||||
(assq-ref spec #:name) "/"
|
(assq-ref spec #:name) "/"
|
||||||
(assq-ref spec #:load-path))
|
(assq-ref spec #:load-path))
|
||||||
|
(%load-package-path)
|
||||||
(%package-cachedir)
|
(%package-cachedir)
|
||||||
(object->string spec)
|
(object->string spec)
|
||||||
(%package-database)))
|
(%package-database)))
|
||||||
|
|
Loading…
Reference in New Issue