[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/08: build-system/gnu: Set $LC_ALL (or similar) to the chosen locale.
From: |
Ludovic Courtès |
Subject: |
04/08: build-system/gnu: Set $LC_ALL (or similar) to the chosen locale. |
Date: |
Fri, 27 Feb 2015 14:09:07 +0000 |
civodul pushed a commit to branch core-updates
in repository guix.
commit 251e8b2ee8a9cb89ce662b9c47d9dcd76dec618b
Author: Ludovic Courtès <address@hidden>
Date: Fri Feb 27 14:54:00 2015 +0100
build-system/gnu: Set $LC_ALL (or similar) to the chosen locale.
Suggested by Mark H Weaver.
* guix/build/utils.scm (locale-category->string): New procedure.
* guix/build/gnu-build-system.scm (install-locale): Add 'setenv' call.
---
guix/build/gnu-build-system.scm | 8 ++++++--
guix/build/utils.scm | 26 +++++++++++++++++++++++++-
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index c3cc3ce..a2bd9d4 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -106,8 +106,12 @@ chance to be set."
(catch 'system-error
(lambda ()
(setlocale locale-category locale)
- (format (current-error-port) "using '~a' locale for category ~a~%"
- locale locale-category)
+
+ ;; While we're at it, pass it to sub-processes.
+ (setenv (locale-category->string locale-category) locale)
+
+ (format (current-error-port) "using '~a' locale for category ~s~%"
+ locale (locale-category->string locale-category))
#t)
(lambda args
;; This is known to fail for instance in early bootstrap where locales
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index f24ed47..f43451b 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -21,6 +21,7 @@
(define-module (guix build utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
+ #:use-module (srfi srfi-60)
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
@@ -65,7 +66,9 @@
patch-/usr/bin/file
fold-port-matches
remove-store-references
- wrap-program))
+ wrap-program
+
+ locale-category->string))
;;;
@@ -909,6 +912,27 @@ the previous wrapper."
(symlink wrapper prog-tmp)
(rename-file prog-tmp prog)))
+
+;;;
+;;; Locales.
+;;;
+
+(define (locale-category->string category)
+ "Return the name of locale category CATEGORY, one of the 'LC_' constants.
+If CATEGORY is a bitwise or of several 'LC_' constants, an approximation is
+returned."
+ (letrec-syntax ((convert (syntax-rules ()
+ ((_)
+ (number->string category))
+ ((_ first rest ...)
+ (if (= first category)
+ (symbol->string 'first)
+ (convert rest ...))))))
+ (convert LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE
+ LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY
+ LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE
+ LC_TIME)))
+
;;; Local Variables:
;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1)
;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1)
- branch core-updates updated (50915d2 -> c9727aa), Ludovic Courtès, 2015/02/27
- 01/08: gnu: gettext: Set encoding to ISO-8859-1 when modifying files., Ludovic Courtès, 2015/02/27
- 04/08: build-system/gnu: Set $LC_ALL (or similar) to the chosen locale.,
Ludovic Courtès <=
- 05/08: utils: Call the progress-report proc when 'dump-port' starts., Ludovic Courtès, 2015/02/27
- 02/08: gnu: Remove now unneeded 'unpack' phases for unzip., Ludovic Courtès, 2015/02/27
- 06/08: download: Abstract the receive buffer size., Ludovic Courtès, 2015/02/27
- 08/08: download: Comment on lack of progress report with chunked encoding., Ludovic Courtès, 2015/02/27
- 03/08: gnu: Remove now unneeded 'localedef' invocations., Ludovic Courtès, 2015/02/27
- 07/08: download: Measure and display the throughput., Ludovic Courtès, 2015/02/27