summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-03-01 18:26:33 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-05 14:13:48 (GMT)
commit85f9b65306d4097f20614199624339aa9bdd0fed (patch)
tree46295118f7d1514b7297d6a78d8609a1e0ad0b12
parent8abd4d4149af256573fbab3c5a1b129c040bb8e8 (diff)
downloadpoky-85f9b65306d4097f20614199624339aa9bdd0fed.tar.gz
sdk: generate locale archive and remove packages
(From OE-Core rev: c6f1010a47df33b40320aa5784181b659a3254d7) (From OE-Core rev: a043ec4fabad26861af83fdc54838544bb8bb3a8) (From OE-Core rev: 3819f8848e4b7b61a76925586e00b586916ea21a) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 c8b6055..bfe9e3a 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -7,6 +7,51 @@ import shutil
7import glob 7import glob
8import traceback 8import traceback
9 9
10def generate_locale_archive(d, rootfs):
11 # Pretty sure we don't need this for SDK archive generation but
12 # keeping it to be safe...
13 target_arch = d.getVar('SDK_ARCH', True)
14 locale_arch_options = { \
15 "arm": ["--uint32-align=4", "--little-endian"],
16 "armeb": ["--uint32-align=4", "--big-endian"],
17 "aarch64": ["--uint32-align=4", "--little-endian"],
18 "aarch64_be": ["--uint32-align=4", "--big-endian"],
19 "sh4": ["--uint32-align=4", "--big-endian"],
20 "powerpc": ["--uint32-align=4", "--big-endian"],
21 "powerpc64": ["--uint32-align=4", "--big-endian"],
22 "mips": ["--uint32-align=4", "--big-endian"],
23 "mipsisa32r6": ["--uint32-align=4", "--big-endian"],
24 "mips64": ["--uint32-align=4", "--big-endian"],
25 "mipsisa64r6": ["--uint32-align=4", "--big-endian"],
26 "mipsel": ["--uint32-align=4", "--little-endian"],
27 "mipsisa32r6el": ["--uint32-align=4", "--little-endian"],
28 "mips64el": ["--uint32-align=4", "--little-endian"],
29 "mipsisa64r6el": ["--uint32-align=4", "--little-endian"],
30 "i586": ["--uint32-align=4", "--little-endian"],
31 "i686": ["--uint32-align=4", "--little-endian"],
32 "x86_64": ["--uint32-align=4", "--little-endian"]
33 }
34 if target_arch in locale_arch_options:
35 arch_options = locale_arch_options[target_arch]
36 else:
37 bb.error("locale_arch_options not found for target_arch=" + target_arch)
38 bb.fatal("unknown arch:" + target_arch + " for locale_arch_options")
39
40 localedir = oe.path.join(rootfs, d.getVar("libdir_nativesdk", True), "locale")
41 # Need to set this so cross-localedef knows where the archive is
42 env = dict(os.environ)
43 env["LOCALEARCHIVE"] = oe.path.join(localedir, "locale-archive")
44
45 for name in os.listdir(localedir):
46 path = os.path.join(localedir, name)
47 if os.path.isdir(path):
48 try:
49 cmd = ["cross-localedef", "--verbose"]
50 cmd += arch_options
51 cmd += ["--add-to-archive", path]
52 subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT)
53 except Exception as e:
54 bb.fatal("Cannot create locale archive: %s" % e.output)
10 55
11class Sdk(object, metaclass=ABCMeta): 56class Sdk(object, metaclass=ABCMeta):
12 def __init__(self, d, manifest_dir): 57 def __init__(self, d, manifest_dir):
@@ -91,11 +136,18 @@ class Sdk(object, metaclass=ABCMeta):
91 136
92 linguas = self.d.getVar("SDKIMAGE_LINGUAS", True) 137 linguas = self.d.getVar("SDKIMAGE_LINGUAS", True)
93 if linguas: 138 if linguas:
139 import fnmatch
140 # Install the binary locales
94 if linguas == "all": 141 if linguas == "all":
95 pm.install_glob("nativesdk-locale-base-*.utf-8", sdk=True) 142 pm.install_glob("nativesdk-glibc-binary-localedata-*.utf-8", sdk=True)
96 else: 143 else:
97 for lang in linguas.split(): 144 for lang in linguas.split():
98 pm.install("nativesdk-locale-base-%s.utf-8" % lang) 145 pm.install("nativesdk-glibc-binary-localedata-%s.utf-8" % lang)
146 # Generate a locale archive of them
147 generate_locale_archive(self.d, oe.path.join(self.sdk_host_sysroot, self.sdk_native_path))
148 # And now delete the binary locales
149 pkgs = fnmatch.filter(pm.list_installed(), "nativesdk-glibc-binary-localedata-*.utf-8")
150 pm.remove(pkgs)
99 else: 151 else:
100 # No linguas so do nothing 152 # No linguas so do nothing
101 pass 153 pass