[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/10: style: Refer to source files by absolute file names.
From: |
guix-commits |
Subject: |
09/10: style: Refer to source files by absolute file names. |
Date: |
Sat, 18 Dec 2021 16:54:10 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit a9892f8f2daceb5bc8595e4d01611936e2c403a4
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Dec 18 22:45:32 2021 +0100
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.
---
guix/scripts/style.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 86a46f6..01196eb 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -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
- branch master updated (cfcfda5 -> f6e79ef), guix-commits, 2021/12/18
- 01/10: gnu: Add Guile-Plotutils., guix-commits, 2021/12/18
- 06/10: gnu: sssd: Fix build with glibc-2.33, guix-commits, 2021/12/18
- 05/10: gnu: Add xfoil., guix-commits, 2021/12/18
- 03/10: gnu: Move instrumentation tools to instrumentation module., guix-commits, 2021/12/18
- 09/10: style: Refer to source files by absolute file names.,
guix-commits <=
- 10/10: style: Gracefully handle errors such as EACCES when opening files., guix-commits, 2021/12/18
- 02/10: gnu: Add Dyninst., guix-commits, 2021/12/18
- 04/10: gnu: babeltrace, lttng-tools: Simplify inputs., guix-commits, 2021/12/18
- 07/10: import: elpa: Support ‘upstream-name’ property., guix-commits, 2021/12/18
- 08/10: gnu: go-ipfs: Update to 0.11.0., guix-commits, 2021/12/18