me
/
guix
Archived
1
0
Fork 0

style: Refer to source files by absolute file names.

Previously, "guix style PACKAGE" would end up modifying a file looked up
under the current directory since the location associated with PACKAGE
is usually a relative file name.

* guix/scripts/style.scm (absolute-location): New procedure.
(simplify-package-inputs): Use it.
master
Ludovic Courtès 2021-12-18 22:45:32 +01:00
parent a5c24f6511
commit a9892f8f2d
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 9 additions and 1 deletions

View File

@ -392,6 +392,14 @@ doing it."
(G_ "would be edited~%")))
str)))
(define (absolute-location loc)
"Replace the file name in LOC by an absolute location."
(location (if (string-prefix? "/" (location-file loc))
(location-file loc)
(search-path %load-path (location-file loc)))
(location-line loc)
(location-column loc)))
(define* (simplify-package-inputs package
#:key (policy 'silent)
(edit-expression edit-expression))
@ -413,7 +421,7 @@ PACKAGE."
#f)
(location
(edit-expression
(location->source-properties location)
(location->source-properties (absolute-location location))
(lambda (str)
(define matches?
(match policy