diff options
author | Richard Tollerton <rich.tollerton@ni.com> | 2016-01-21 19:46:53 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-30 11:36:57 +0000 |
commit | 3b5288f0a28205289063424afc474675cbaa05b8 (patch) | |
tree | 22c9241f9e2727543cdd7b2f5c7767e9f9bb89de /meta/classes/libc-package.bbclass | |
parent | 4f3ef90ae1db877541e7d3adee70228b0b7fa949 (diff) | |
download | poky-3b5288f0a28205289063424afc474675cbaa05b8.tar.gz |
libc-package.bbclass: add LOCALE_UTF8_IS_DEFAULT
python hard-codes the encoding of many locales; for instance, en_US is
always assumed to be ISO-8859-1, regardless of the actual encoding of
the en_US locale on the system. cf
https://hg.python.org/cpython/file/7841e9b614eb/Lib/locale.py#l1049,
getdefaultlocale(), etc. This code appears to date back to python 2.0.
The source of this hard-coding is Xorg's locale.alias but is ultimately
justified by glibc's SUPPORTED.
This causes problems on OE, because any locale lacking an explicit
encoding suffix (e.g. en_US) is UTF-8. It has been this way from the
beginning (svn r1). That is not a bug, per se -- no specification
prohibits this AFAIK. But it seems to be at odds with virtually every
other glibc-based distribution in existence. To avoid needlessly
aggravating hidden bugs that nobody else might hit, it makes sense to
disable this behavior such that locales are named precisely as specified
by SUPPORTED.
I suppose that reasonable minds may disagree on whether or not the
current behavior is prudent; at the very least, this is likely to break
IMAGE_LINGUAS settings. So let's create a new distro variable
LOCALE_UTF8_IS_DEFAULT to allow either behavior. Set it to 0 and all
your locales get named exactly like they are in SUPPORTED. Leave it at 1
to preserve current OE locale naming conventions.
(From OE-Core rev: fcde0c43f7b57ec6f8201226ad98e6e46708d288)
Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/libc-package.bbclass')
-rw-r--r-- | meta/classes/libc-package.bbclass | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index adb423034d..467d567923 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass | |||
@@ -332,6 +332,8 @@ python package_do_split_gconvs () { | |||
332 | bb.build.exec_func("do_prep_locale_tree", d) | 332 | bb.build.exec_func("do_prep_locale_tree", d) |
333 | 333 | ||
334 | utf8_only = int(d.getVar('LOCALE_UTF8_ONLY', True) or 0) | 334 | utf8_only = int(d.getVar('LOCALE_UTF8_ONLY', True) or 0) |
335 | utf8_is_default = int(d.getVar('LOCALE_UTF8_IS_DEFAULT', True) or 0) | ||
336 | |||
335 | encodings = {} | 337 | encodings = {} |
336 | for locale in to_generate: | 338 | for locale in to_generate: |
337 | charset = supported[locale] | 339 | charset = supported[locale] |
@@ -344,10 +346,11 @@ python package_do_split_gconvs () { | |||
344 | else: | 346 | else: |
345 | base = locale | 347 | base = locale |
346 | 348 | ||
347 | # Precompiled locales are kept as is, obeying SUPPORTED, while | 349 | # Non-precompiled locales may be renamed so that the default |
348 | # others are adjusted, ensuring that the non-suffixed locales | 350 | # (non-suffixed) encoding is always UTF-8, i.e., instead of en_US and |
349 | # are utf-8, while the suffixed are not. | 351 | # en_US.UTF-8, we have en_US and en_US.ISO-8859-1. This implicitly |
350 | if use_bin == "precompiled": | 352 | # contradicts SUPPORTED. |
353 | if use_bin == "precompiled" or not utf8_is_default: | ||
351 | output_locale(locale, base, charset) | 354 | output_locale(locale, base, charset) |
352 | else: | 355 | else: |
353 | if charset == 'UTF-8': | 356 | if charset == 'UTF-8': |