diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-04-09 01:00:11 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-04-09 01:01:19 +0200 |
commit | ce405612043810f74b2823d1efff898d020eb6d4 (patch) | |
tree | 8ae37f0b3f53f1c5e75e43fe5ad181cc51389baa | |
parent | e8cfbe6799d7fbe9cfa1241828e5b5b2fa63720e (diff) | |
download | cuirass-ce405612043810f74b2823d1efff898d020eb6d4.tar cuirass-ce405612043810f74b2823d1efff898d020eb6d4.tar.gz |
evaluate: Change directory to SOURCE.
* bin/evaluate.in (with-directory-excursion): Remove.
(main): chdir to SOURCE.
-rw-r--r-- | bin/evaluate.in | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/bin/evaluate.in b/bin/evaluate.in index 3d5bbb6..985b787 100644 --- a/bin/evaluate.in +++ b/bin/evaluate.in @@ -35,17 +35,6 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@" (let ((m (resolve-interface module))) (module-ref m name))) -(define-syntax-rule (with-directory-excursion dir body ...) - "Run BODY with DIR as the process's current directory." - (let ((init (getcwd))) - (dynamic-wind - (lambda () - (chdir dir)) - (lambda () - body ...) - (lambda () - (chdir init))))) - (define %not-colon (char-set-complement (char-set #\:))) @@ -66,18 +55,22 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@" (unless (string-null? guix-package-path) (setenv "GUIX_PACKAGE_PATH" guix-package-path)) + ;; Since we have relative file name canonicalization by default, better + ;; change to SOURCE to make sure things like 'include' with relative + ;; file names work as expected. + (chdir source) + (save-module-excursion (lambda () (set-current-module %user-module) - (with-directory-excursion source - (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))))))) + (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)))))) ;; From there on we can access Guix modules. |