[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: utils: Treat 'configure' and Makefiles with an 8-bit encoding.
From: |
Ludovic Courtès |
Subject: |
01/01: utils: Treat 'configure' and Makefiles with an 8-bit encoding. |
Date: |
Sat, 28 Feb 2015 12:24:50 +0000 |
civodul pushed a commit to branch core-updates
in repository guix.
commit dd0a8ef15f903422c6b020e7d793986427add927
Author: Ludovic Courtès <address@hidden>
Date: Sat Feb 28 12:25:22 2015 +0100
utils: Treat 'configure' and Makefiles with an 8-bit encoding.
* guix/build/utils.scm (patch-makefile-SHELL, patch-/usr/bin/file): Wrap
'substitute*' in 'with-fluids'. Fixes
<http://hydra.gnu.org/build/262895>.
---
guix/build/utils.scm | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index c98c4ca..a5a6167 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -712,16 +712,18 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are
kept unchanged."
shell))
(let ((st (stat file)))
- (substitute* file
- (("^ *SHELL[[:blank:]]*:?=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)(.*)$"
- _ dir shell args)
- (let* ((old (string-append dir shell))
- (new (or (find-shell shell) old)))
- (unless (string=? new old)
- (format (current-error-port)
- "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to
`~a'~%"
- file old new))
- (string-append "SHELL = " new args))))
+ ;; Consider FILE is using an 8-bit encoding to avoid errors.
+ (with-fluids ((%default-port-encoding #f))
+ (substitute* file
+ (("^
*SHELL[[:blank:]]*:?=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)(.*)$"
+ _ dir shell args)
+ (let* ((old (string-append dir shell))
+ (new (or (find-shell shell) old)))
+ (unless (string=? new old)
+ (format (current-error-port)
+ "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to
`~a'~%"
+ file old new))
+ (string-append "SHELL = " new args)))))
(when keep-mtime?
(set-file-time file st))))
@@ -738,13 +740,15 @@ unchanged."
"patch-/usr/bin/file: warning: \
no replacement 'file' command, doing nothing~%")
(let ((st (stat file)))
- (substitute* file
- (("/usr/bin/file")
- (begin
- (format (current-error-port)
- "patch-/usr/bin/file: ~a: changing `~a' to `~a'~%"
- file "/usr/bin/file" file-command)
- file-command)))
+ ;; Consider FILE is using an 8-bit encoding to avoid errors.
+ (with-fluids ((%default-port-encoding #f))
+ (substitute* file
+ (("/usr/bin/file")
+ (begin
+ (format (current-error-port)
+ "patch-/usr/bin/file: ~a: changing `~a' to `~a'~%"
+ file "/usr/bin/file" file-command)
+ file-command))))
(when keep-mtime?
(set-file-time file st)))))