libc-package.bbclass: split binary localedata even more if asked to
PATCH 1/1 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.
--- meta/classes/libc-package.bbclass | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-)
meta/classes/libc-package.bbclass +25 -14
@@ -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!")
Signature · 1 line
2.7.4
Quoted 12 lines · Andreas Oberritter
If
GLIBC_SPLIT_LC_PACKAGESis 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 needLC_COLLATEfor example.Some regex code was removed from
output_locale_binary_rdepends, becauselegitimize_package_namealready converts to lowercase.
This looks ok. May be add some documentation around GLIBC_SPLIT_LC_PACKAGES in extended local.conf sample.
I am worried about dependency changes, may be comparing old and new would help.
Quoted 84 lines
Signed-off-by Andreas Oberritter <[email protected]>---
meta/classes/libc-package.bbclass | 39 +++++++++++++++++++++++++--------------1 file changed, 25 insertions(+), 14 deletions(-)meta/classes/libc-package.bbclass +0
-0@@ -9,6 +9,8 @@
GLIBC_INTERNAL_USE_BINARY_LOCALE?= "ondevice"meta/classes/libc-package.bbclass +2
-0+GLIBC_SPLIT_LC_PACKAGES ?= "0" +python
__anonymous() {
enabled =d.getVar("ENABLE_BINARY_LOCALE_GENERATION", True)meta/classes/libc-package.bbclass +23
-14@@ -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!")Signature · 7 lines
2.7.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 9 lines · Khem Raj
Quoted 9 lines · Andreas Oberritter
If
GLIBC_SPLIT_LC_PACKAGESis 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 needLC_COLLATEfor example.
Quoted 6 lines
Quoted 3 lines
Some regex code was removed from
output_locale_binary_rdepends, becauselegitimize_package_namealready converts to lowercase.This looks ok. May be add some documentation around
GLIBC_SPLIT_LC_PACKAGESin extended local.conf sample.
OK, will send a v2.
Quoted 2 lines
I am worried about dependency changes, may be comparing old and new would help.
The generated meta packages make sure that dependencies stay intact. I didn't observe any deviation in my test builds, with or without setting GLIBC_SPLIT_LC_PACKAGES to 1.
Regards,
Andreas
PATCH v2 1/1 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.
---
v2: Added description to local.conf.sample.extended.
meta/classes/libc-package.bbclass | 39 +++++++++++++++++++++++------------- meta/conf/local.conf.sample.extended | 7 +++++++ 2 files changed, 32 insertions(+), 14 deletions(-)
meta/classes/libc-package.bbclass +25 -14
@@ -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!")
meta/conf/local.conf.sample.extended +7 -0
@@ -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
Signature · 1 line
2.7.4
Quoted 17 lines · Andreas Oberritter
Quoted 9 lines · Khem Raj
Quoted 9 lines · Andreas Oberritter
If
GLIBC_SPLIT_LC_PACKAGESis 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 needLC_COLLATEfor example.Quoted 6 lines
Quoted 3 lines
Some regex code was removed from
output_locale_binary_rdepends, becauselegitimize_package_namealready converts to lowercase.This looks ok. May be add some documentation around
GLIBC_SPLIT_LC_PACKAGESin extended local.conf sample.
Quoted 8 lines
OK, will send a v2.
Quoted 2 lines
I am worried about dependency changes, may be comparing old and new would help.
The generated meta packages make sure that dependencies stay intact. I didn't observe any deviation in my test builds, with or without setting
GLIBC_SPLIT_LC_PACKAGESto 1.
Thats comforting. did you also try a online package upgrade ?
Quoted 4 lines
Regards,
Andreas
Quoted 20 lines · Khem Raj
Quoted 19 lines · Andreas Oberritter
Quoted 9 lines · Khem Raj
Quoted 9 lines · Andreas Oberritter
If
GLIBC_SPLIT_LC_PACKAGESis 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 needLC_COLLATEfor example.Quoted 6 lines
Quoted 3 lines
Some regex code was removed from
output_locale_binary_rdepends, becauselegitimize_package_namealready converts to lowercase.This looks ok. May be add some documentation around
GLIBC_SPLIT_LC_PACKAGESin extended local.conf sample.OK, will send a v2.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I am worried about dependency changes, may be comparing old and new would help.
The generated meta packages make sure that dependencies stay intact. I didn't observe any deviation in my test builds, with or without setting
GLIBC_SPLIT_LC_PACKAGESto 1.Thats comforting. did you also try a online package upgrade ?
Yes, but you can't switch existing package feeds from one setting to another with deb, because of file conflicts (unless you run apt-get -f install after upgrading). This would need additional RREPLACES, RCONFLICTS (and RBREAKS?) statements, which IMHO are impossible to automate. I'm not sure about other package managers. But it's a very common problem when moving files from one package to another.
Regards,
Andreas