diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-11-18 23:56:07 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-11-18 23:56:07 +0100 |
commit | 0b8749b7bdd68c9b28cf3d520b9a3a9cc1a5bddb (patch) | |
tree | b8d49b94aa148a63d3dbf320aeeff15364b9abdc /guix | |
parent | ac5de156ae5de8cb61870469863fb862b6a1205e (diff) | |
download | gnu-guix-0b8749b7bdd68c9b28cf3d520b9a3a9cc1a5bddb.tar gnu-guix-0b8749b7bdd68c9b28cf3d520b9a3a9cc1a5bddb.tar.gz |
packages: 'package-field-location' returns a relative file name.
* guix/packages.scm (package-field-location): Set
%FILE-PORT-NAME-CANONICALIZATION.
* tests/packages.scm ("package-field-location, relative file name"): New
test.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/packages.scm | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index b25cc52bba..bb7d873973 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -221,24 +221,26 @@ corresponds to the arguments expected by `set-path-environment-variable'." (($ <location> file line column) (catch 'system (lambda () - (call-with-input-file (search-path %load-path file) - (lambda (port) - (goto port line column) - (match (read port) - (('package inits ...) - (let ((field (assoc field inits))) - (match field - ((_ value) - ;; Put the `or' here, and not in the first argument of - ;; `and=>', to work around a compiler bug in 2.0.5. - (or (and=> (source-properties value) - source-properties->location) - (and=> (source-properties field) - source-properties->location))) - (_ - #f)))) - (_ - #f))))) + ;; In general we want to keep relative file names for modules. + (with-fluids ((%file-port-name-canonicalization 'relative)) + (call-with-input-file (search-path %load-path file) + (lambda (port) + (goto port line column) + (match (read port) + (('package inits ...) + (let ((field (assoc field inits))) + (match field + ((_ value) + ;; Put the `or' here, and not in the first argument of + ;; `and=>', to work around a compiler bug in 2.0.5. + (or (and=> (source-properties value) + source-properties->location) + (and=> (source-properties field) + source-properties->location))) + (_ + #f)))) + (_ + #f)))))) (lambda _ #f))) (_ #f))) |