summaryrefslogtreecommitdiff
path: root/guix/build/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-27 14:54:00 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-27 15:08:37 +0100
commit251e8b2ee8a9cb89ce662b9c47d9dcd76dec618b (patch)
treece1c10d833c1b5817a85e38681d44047a6854d8e /guix/build/utils.scm
parent7184b4b1bd839cd4fd0c9630c050c7854174057d (diff)
downloadgnu-guix-251e8b2ee8a9cb89ce662b9c47d9dcd76dec618b.tar
gnu-guix-251e8b2ee8a9cb89ce662b9c47d9dcd76dec618b.tar.gz
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.
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r--guix/build/utils.scm26
1 files changed, 25 insertions, 1 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index f24ed47f3e..f43451bd35 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)