packages: 'package-field-location' preserves the original file name.

Fixes <https://bugs.gnu.org/39425>.
Reported by Alex ter Weele <alex.ter.weele@gmail.com>.

* guix/packages.scm (package-field-location): Remove 'with-fluids' for
'%file-port-name-canonicalization'.  Change the 'file' field of the
resulting location to FILE.
This commit is contained in:
Ludovic Courtès 2020-03-20 23:34:03 +01:00
parent fe4a37276b
commit f2b24f01f4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -355,25 +355,24 @@ (define (goto port line column)
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
;; In general we want to keep relative file names for modules. ;; 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)
(call-with-input-file (search-path %load-path file) (lambda (port)
(lambda (port) (goto port line column)
(goto port line column) (match (read port)
(match (read port) (('package inits ...)
(('package inits ...) (let ((field (assoc field inits)))
(let ((field (assoc field inits))) (match field
(match field ((_ value)
((_ value) (let ((props (source-properties value)))
;; Put the `or' here, and not in the first argument of (and props
;; `and=>', to work around a compiler bug in 2.0.5. ;; Preserve the original file name, which may be a
(or (and=> (source-properties value) ;; relative file name.
source-properties->location) (let ((loc (source-properties->location props)))
(and=> (source-properties field) (set-field loc (location-file) file)))))
source-properties->location))) (_
(_ #f))))
#f)))) (_
(_ #f)))))
#f))))))
(lambda _ (lambda _
#f))) #f)))
(_ #f))) (_ #f)))