summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-27 00:03:17 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-27 00:03:17 +0100
commit9cca706c2e76bddb3c04ca2ab310cd1262596232 (patch)
tree264dce173621206362ddf13235e16f38c0354d1d
parentb0fd2bd3c5c1b04c3452473cdf104a8258bb7649 (diff)
downloadguix-9cca706c2e76bddb3c04ca2ab310cd1262596232.tar.gz
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'.
-rw-r--r--guix/packages.scm12
1 files 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 @@ corresponds to the arguments expected by `set-path-environment-variable'."
       ("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 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
                     (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 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
                          (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"))