[OE-core] [RFC][PATCH] libc-package.bbclass: Improve handling of GLIBC_GENERATE_LOCALES

Jacob Kroon jacob.kroon at mikrodidakt.se
Mon Jun 9 07:19:44 UTC 2014


Currently, setting GLIBC_GENERATE_LOCALES to the empty string means that
all supported binary locales are generated.

Improve the situation by adding a weak assignment to "all",
in order to keep current default behaviour when GLIBC_GENERATE_LOCALES
is not set by the user, and change the code to do no special handling of
the empty string value. This makes it possible to skip generating
binary locales altogether by setting GLIBC_GENERATE_LOCALES = "".

Since locales directory can now be empty, make sure it is not packaged
in this situation.

Signed-off-by: Jacob Kroon <jacob.kroon at mikrodidakt.se>
---
 meta/classes/libc-package.bbclass | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass
index c1bc399..c2f7f2f 100644
--- a/meta/classes/libc-package.bbclass
+++ b/meta/classes/libc-package.bbclass
@@ -2,11 +2,15 @@
 # This class knows how to package up [e]glibc. Its shared since prebuild binary toolchains
 # may need packaging and its pointless to duplicate this code.
 #
+# Caller should set GLIBC_GENERATE_LOCALES to a space-separated list of
+# locales to generate. "all" will generate all supported locales
+#
 # Caller should set GLIBC_INTERNAL_USE_BINARY_LOCALE to one of:
 #  "compile" - Use QEMU to generate the binary locale files
 #  "precompiled" - The binary locale files are pregenerated and already present
 #  "ondevice" - The device will build the locale files upon first boot through the postinst
 
+GLIBC_GENERATE_LOCALES ?= "all"
 GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice"
 
 python __anonymous () {
@@ -111,6 +115,12 @@ do_prep_locale_tree() {
 do_collect_bins_from_locale_tree() {
 	treedir=${WORKDIR}/locale-tree
 
+	# When no binary locales are generated we return early in order
+	# to skip creating empty directories that QA will warn about.
+	if [ -z "$(ls $treedir/${localedir})" ]; then
+		return
+	fi
+
 	parent=$(dirname ${localedir})
 	mkdir -p ${PKGD}/$parent
 	tar -cf - -C $treedir/$parent -p $(basename ${localedir}) | tar -xf - -C ${PKGD}$parent
@@ -220,9 +230,8 @@ python package_do_split_gconvs () {
                 continue
             supported[locale] = charset
 
-    # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales
     to_generate = d.getVar('GLIBC_GENERATE_LOCALES', True)
-    if not to_generate or to_generate == 'all':
+    if to_generate == 'all':
         to_generate = supported.keys()
     else:
         to_generate = to_generate.split()
-- 
1.9.3




More information about the Openembedded-core mailing list