summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-03-01 18:26:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-05 15:11:15 +0100
commit3819f8848e4b7b61a76925586e00b586916ea21a (patch)
tree9e67e905b6ee7a26f94a63cc07a4e2ff7ff894b8
parent1dbffc25936733ca03b6d03c5bacb3fb496a61a5 (diff)
downloadopenembedded-core-3819f8848e4b7b61a76925586e00b586916ea21a.tar.gz
openembedded-core-3819f8848e4b7b61a76925586e00b586916ea21a.tar.bz2
openembedded-core-3819f8848e4b7b61a76925586e00b586916ea21a.zip
sdk: generate locale archive and remove packages
(From OE-Core rev: c6f1010a47df33b40320aa5784181b659a3254d7) (From OE-Core rev: a043ec4fabad26861af83fdc54838544bb8bb3a8) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> [Fixup for getVar True bit] Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/lib/oe/sdk.py56
1 files changed, 54 insertions, 2 deletions
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index c8b6055420..bfe9e3a744 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -7,6 +7,51 @@ import shutil
import glob
import traceback
+def generate_locale_archive(d, rootfs):
+ # Pretty sure we don't need this for SDK archive generation but
+ # keeping it to be safe...
+ target_arch = d.getVar('SDK_ARCH', True)
+ locale_arch_options = { \
+ "arm": ["--uint32-align=4", "--little-endian"],
+ "armeb": ["--uint32-align=4", "--big-endian"],
+ "aarch64": ["--uint32-align=4", "--little-endian"],
+ "aarch64_be": ["--uint32-align=4", "--big-endian"],
+ "sh4": ["--uint32-align=4", "--big-endian"],
+ "powerpc": ["--uint32-align=4", "--big-endian"],
+ "powerpc64": ["--uint32-align=4", "--big-endian"],
+ "mips": ["--uint32-align=4", "--big-endian"],
+ "mipsisa32r6": ["--uint32-align=4", "--big-endian"],
+ "mips64": ["--uint32-align=4", "--big-endian"],
+ "mipsisa64r6": ["--uint32-align=4", "--big-endian"],
+ "mipsel": ["--uint32-align=4", "--little-endian"],
+ "mipsisa32r6el": ["--uint32-align=4", "--little-endian"],
+ "mips64el": ["--uint32-align=4", "--little-endian"],
+ "mipsisa64r6el": ["--uint32-align=4", "--little-endian"],
+ "i586": ["--uint32-align=4", "--little-endian"],
+ "i686": ["--uint32-align=4", "--little-endian"],
+ "x86_64": ["--uint32-align=4", "--little-endian"]
+ }
+ if target_arch in locale_arch_options:
+ arch_options = locale_arch_options[target_arch]
+ else:
+ bb.error("locale_arch_options not found for target_arch=" + target_arch)
+ bb.fatal("unknown arch:" + target_arch + " for locale_arch_options")
+
+ localedir = oe.path.join(rootfs, d.getVar("libdir_nativesdk", True), "locale")
+ # Need to set this so cross-localedef knows where the archive is
+ env = dict(os.environ)
+ env["LOCALEARCHIVE"] = oe.path.join(localedir, "locale-archive")
+
+ for name in os.listdir(localedir):
+ path = os.path.join(localedir, name)
+ if os.path.isdir(path):
+ try:
+ cmd = ["cross-localedef", "--verbose"]
+ cmd += arch_options
+ cmd += ["--add-to-archive", path]
+ subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT)
+ except Exception as e:
+ bb.fatal("Cannot create locale archive: %s" % e.output)
class Sdk(object, metaclass=ABCMeta):
def __init__(self, d, manifest_dir):
@@ -91,11 +136,18 @@ class Sdk(object, metaclass=ABCMeta):
linguas = self.d.getVar("SDKIMAGE_LINGUAS", True)
if linguas:
+ import fnmatch
+ # Install the binary locales
if linguas == "all":
- pm.install_glob("nativesdk-locale-base-*.utf-8", sdk=True)
+ pm.install_glob("nativesdk-glibc-binary-localedata-*.utf-8", sdk=True)
else:
for lang in linguas.split():
- pm.install("nativesdk-locale-base-%s.utf-8" % lang)
+ pm.install("nativesdk-glibc-binary-localedata-%s.utf-8" % lang)
+ # Generate a locale archive of them
+ generate_locale_archive(self.d, oe.path.join(self.sdk_host_sysroot, self.sdk_native_path))
+ # And now delete the binary locales
+ pkgs = fnmatch.filter(pm.list_installed(), "nativesdk-glibc-binary-localedata-*.utf-8")
+ pm.remove(pkgs)
else:
# No linguas so do nothing
pass