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'.
This commit is contained in:
Ludovic Courtès 2015-02-27 00:03:17 +01:00
parent b0fd2bd3c5
commit 9cca706c2e

View file

@ -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"))