From 9cca706c2e76bddb3c04ca2ab310cd1262596232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 27 Feb 2015 00:03:17 +0100 Subject: [PATCH] packages: When possible, use a UTF-8 locale in patch-and-repack. * guix/packages.scm (%standard-patch-inputs): Add "locales". (patch-and-repack)[builder]: Add 'locales' variable. When it is true, call 'setenv' and 'setlocale'. --- guix/packages.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index 5b686a122f..b72a6ddc8e 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -335,7 +335,8 @@ (define (%standard-patch-inputs) ("bzip2" ,(ref '(gnu packages compression) 'bzip2)) ("gzip" ,(ref '(gnu packages compression) 'gzip)) ("lzip" ,(ref '(gnu packages compression) 'lzip)) - ("patch" ,(ref '(gnu packages base) 'patch))))) + ("patch" ,(ref '(gnu packages base) 'patch)) + ("locales" ,(ref '(gnu packages base) 'glibc-utf8-locales))))) (define (default-guile) "Return the default Guile package used to run the build code of @@ -411,7 +412,8 @@ (define builder (srfi srfi-1) (guix build utils)) - (let ((out (assoc-ref %outputs "out")) + (let ((locales (assoc-ref %build-inputs "locales")) + (out (assoc-ref %outputs "out")) (xz (assoc-ref %build-inputs "xz")) (decomp (assoc-ref %build-inputs ,decompression-type)) (source (assoc-ref %build-inputs "source")) @@ -433,6 +435,12 @@ (define (first-file directory) (lambda (name) (not (member name '("." ".."))))))) + (when locales + ;; First of all, install a UTF-8 locale so that UTF-8 file names + ;; are correctly interpreted. During bootstrap, LOCALES is #f. + (setenv "LOCPATH" (string-append locales "/lib/locale")) + (setlocale LC_ALL "en_US.UTF-8")) + (setenv "PATH" (string-append xz "/bin" ":" decomp "/bin"))