From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: guix-devel@gnu.org
Subject: Re: Locale of build environments
Date: Fri, 27 Feb 2015 11:36:52 +0100 [thread overview]
Message-ID: <87mw3ztzcr.fsf@gnu.org> (raw)
In-Reply-To: <87y4nk6xv1.fsf@netris.org> (Mark H. Weaver's message of "Thu, 26 Feb 2015 18:45:22 -0500")
[-- Attachment #1: Type: text/plain, Size: 894 bytes --]
Mark H Weaver <mhw@netris.org> skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Commit 5335c56 adds an ‘install-locale’ phase to gnu-build-system and
>> the next one adds glibc-utf8-locale to the implicit inputs.
>>
>> During bootstrap, locales aren’t available so we’re still running on the
>> C locale, which is fine in practice because we only get to deal with
>> ASCII file names at that point and do not need UTF-8 for tests or
>> anything.
>>
>> Commit 9cca706 adjust patch-and-repack to use UTF-8 as well when
>> possible–i.e., not during bootstrap.
>
> Thanks!
>
> However, there's a missing piece: I think we should set LANG to the
> chosen locale, otherwise the top-level guile builder will be the only
> process that uses UTF-8. What do you think?
Yes, why not. It’s not strictly necessary but it’s probably a good
idea. Like this?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2470 bytes --]
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)))
+\f
+;;;
+;;; 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)
[-- Attachment #3: Type: text/plain, Size: 191 bytes --]
>> The remain thing that needs to be done is ‘graft-derivation’.
>
> Okay, I'll work on it. I also want to optimize grafting.
Excellent.
Thanks for your feedback!
Ludo’.
next prev parent reply other threads:[~2015-02-27 10:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 20:14 CA certificates Andreas Enge
2015-02-12 16:44 ` Andreas Enge
2015-02-12 17:26 ` Mark H Weaver
2015-02-12 19:48 ` Andreas Enge
2015-02-12 20:20 ` Locale of build environments Ludovic Courtès
2015-02-12 20:28 ` Andreas Enge
2015-02-15 0:12 ` Mark H Weaver
2015-02-26 23:16 ` Ludovic Courtès
2015-02-26 23:45 ` Mark H Weaver
2015-02-27 10:36 ` Ludovic Courtès [this message]
2015-02-27 14:13 ` Ludovic Courtès
2015-03-01 16:48 ` Ludovic Courtès
2015-02-13 7:28 ` CA certificates Mark H Weaver
2015-02-13 10:23 ` Andreas Enge
2015-02-12 20:30 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mw3ztzcr.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.