diff options
author | Andreas Oberritter <obi@opendreambox.org> | 2016-12-01 13:37:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-08 10:26:13 +0000 |
commit | 40b4b31092058f8833ada3dfc254d362dd3139c1 (patch) | |
tree | 90526e2a637a5f2dbc5ea556688ac09cc398e490 | |
parent | 6310833bfbbb3ed3852af0693fd68ea1fa7b054a (diff) | |
download | openembedded-core-40b4b31092058f8833ada3dfc254d362dd3139c1.tar.gz openembedded-core-40b4b31092058f8833ada3dfc254d362dd3139c1.tar.bz2 openembedded-core-40b4b31092058f8833ada3dfc254d362dd3139c1.zip |
libc-package.bbclass: split binary localedata even more if asked to
If GLIBC_SPLIT_LC_PACKAGES is set to a non-zero value, convert
glibc-binary-localedata-XX-YY to be a meta package depending on
glibc-binary-localedata-XX-YY-lc-address and so on. This enables
saving quite some space if someone doesn't need LC_COLLATE for
example.
Some regex code was removed from output_locale_binary_rdepends,
because legitimize_package_name already converts to lowercase.
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r-- | meta/classes/libc-package.bbclass | 39 | ||||
-rw-r--r-- | meta/conf/local.conf.sample.extended | 7 |
2 files changed, 32 insertions, 14 deletions
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 2dc90c44d7..071978b519 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass @@ -9,6 +9,8 @@ GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice" +GLIBC_SPLIT_LC_PACKAGES ?= "0" + python __anonymous () { enabled = d.getVar("ENABLE_BINARY_LOCALE_GENERATION", True) @@ -219,13 +221,12 @@ python package_do_split_gconvs () { (locale, encoding, locale)) def output_locale_binary_rdepends(name, pkgname, locale, encoding): - m = re.match("(.*)\.(.*)", name) - if m: - libc_name = "%s.%s" % (m.group(1), m.group(2).lower()) - else: - libc_name = name - d.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('%s-binary-localedata-%s' \ - % (mlprefix+bpn, libc_name))) + dep = legitimize_package_name('%s-binary-localedata-%s' % (bpn, name)) + lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES', True) + if lcsplit and int(lcsplit): + d.appendVar('PACKAGES', ' ' + dep) + d.setVar('ALLOW_EMPTY_%s' % dep, '1') + d.setVar('RDEPENDS_%s' % pkgname, mlprefix + dep) commands = {} @@ -337,6 +338,11 @@ python package_do_split_gconvs () { else: output_locale('%s.%s' % (base, charset), base, charset) + def metapkg_hook(file, pkg, pattern, format, basename): + name = basename.split('/', 1)[0] + metapkg = legitimize_package_name('%s-binary-localedata-%s' % (mlprefix+bpn, name)) + d.appendVar('RDEPENDS_%s' % metapkg, ' ' + pkg) + if use_bin == "compile": makefile = base_path_join(d.getVar("WORKDIR", True), "locale-tree", "Makefile") m = open(makefile, "w") @@ -350,13 +356,18 @@ python package_do_split_gconvs () { bb.build.exec_func("oe_runmake", d) bb.note("collecting binary locales from locale tree") bb.build.exec_func("do_collect_bins_from_locale_tree", d) - do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ - output_pattern=bpn+'-binary-localedata-%s', \ - description='binary locale definition for %s', extra_depends='', allow_dirs=True) - elif use_bin == "precompiled": - do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ - output_pattern=bpn+'-binary-localedata-%s', \ - description='binary locale definition for %s', extra_depends='', allow_dirs=True) + + if use_bin in ('compile', 'precompiled'): + lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES', True) + if lcsplit and int(lcsplit): + do_split_packages(d, binary_locales_dir, file_regex='^(.*/LC_\w+)', \ + output_pattern=bpn+'-binary-localedata-%s', \ + description='binary locale definition for %s', recursive=True, + hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True) + else: + do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ + output_pattern=bpn+'-binary-localedata-%s', \ + description='binary locale definition for %s', extra_depends='', allow_dirs=True) else: bb.note("generation of binary locales disabled. this may break i18n!") diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended index 57f656a065..f7cabf095d 100644 --- a/meta/conf/local.conf.sample.extended +++ b/meta/conf/local.conf.sample.extended @@ -47,6 +47,13 @@ # less than 128MB RAM. #ENABLE_BINARY_LOCALE_GENERATION = "1" +# If GLIBC_SPLIT_LC_PACKAGES is set to a non-zero value, convert +# glibc-binary-localedata-XX-YY to be a meta package depending on +# glibc-binary-localedata-XX-YY-lc-address and so on. This enables +# saving quite some space if someone doesn't need LC_COLLATE for +# example. +#GLIBC_SPLIT_LC_PACKAGES = "1" + # Set GLIBC_GENERATE_LOCALES to the locales you wish to generate should you not # wish to perform the time-consuming step of generating all LIBC locales. # NOTE: If removing en_US.UTF-8 you will also need to uncomment, and set |