diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-04-07 18:17:12 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-04-07 18:17:12 +0200 |
commit | a3a7c09b06027bd30a96ae4607fa40bd790af840 (patch) | |
tree | 108b3ac75740f44b30225dea30c59214ffdcbb0d /bin/evaluate.in | |
parent | b9b53e67ba0eb341e0165434fcaa0c92d344afe3 (diff) | |
download | cuirass-a3a7c09b06027bd30a96ae4607fa40bd790af840.tar cuirass-a3a7c09b06027bd30a96ae4607fa40bd790af840.tar.gz |
evaluate: Honor the given load path.
* bin/evaluate.in (main): Prepend LOAD-PATH to '%load-path' for the
dynamic extend of the 'primitive-load' call.
Diffstat (limited to 'bin/evaluate.in')
-rw-r--r-- | bin/evaluate.in | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bin/evaluate.in b/bin/evaluate.in index 0d2ef9c..622e4c5 100644 --- a/bin/evaluate.in +++ b/bin/evaluate.in @@ -33,6 +33,9 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@" (guix derivations) (guix store)) +(define %not-colon + (char-set-complement (char-set #\:))) + (define* (main #:optional (args (command-line))) (match args ((command load-path guix-package-path source specstr) @@ -40,12 +43,21 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@" (let ((%user-module (make-fresh-user-module)) (spec (with-input-from-string specstr read)) (stdout (current-output-port)) - (stderr (current-error-port))) + (stderr (current-error-port)) + (load-path (string-tokenize load-path %not-colon))) (save-module-excursion (lambda () (set-current-module %user-module) (with-directory-excursion source - (primitive-load (assq-ref spec #:file))))) + (let ((original-path %load-path)) + (dynamic-wind + (lambda () + (set! %load-path (append load-path original-path))) + (lambda () + (primitive-load (assq-ref spec #:file))) + (lambda () + (set! %load-path original-path))))))) + (with-store store (unless (assoc-ref spec #:use-substitutes?) ;; Make sure we don't resort to substitutes. |