Skip to contentSkip to conversation

Fix issue when locale related distro features missing

PATCH New [email protected] 1 participant 4 messages Dec 5, 2018

lore
Share & tools
lore
#0 lore raw

cover Fix issue when locale related distro features missing

From: Kai Kang <[email protected]>

The original problem is when distro features libc-charsets libc-locale-code and libc-locales are missing, it has installed-vs-shipped qa issue. Then fix for image and other packages depends on glibc locale packages too.

Build image and sdk for qemux86 and qemuarm64 with and without in local.conf:

DISTRO_FEATURES_remove = "libc-charsets libc-locales libc-locale-code"

The following changes since commit 016e3dda2d6acc9b457079d11b5346a5352a431d:

btrfs-tools: update to 4.19 (2018-12-03 12:20:01 +0000)

are available in the Git repository at:

git://git.pokylinux.org/poky-contrib kangkai/glibc-locale
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/glibc-locale

Kai Kang (3):
glibc-locale: fix installed-vs-shipped qa issue
image.bbclass: respect PACKAGE_NO_GCONV
packages: respect PACKAGE_NO_GCONV

 meta/classes/image.bbclass                    |  5 +++++
 meta/classes/libc-package.bbclass             |  4 +---
 meta/conf/distro/include/tclibc-glibc.inc     |  2 +-
 meta/recipes-core/glib-2.0/glib.inc           |  4 +++-
 meta/recipes-core/glibc/glibc-locale.inc      | 15 +++++++++------
 meta/recipes-core/libxml/libxml2_2.9.8.bb     |  4 +++-
 meta/recipes-devtools/mtools/mtools_4.0.19.bb |  4 +++-
 7 files changed, 25 insertions(+), 13 deletions(-)
Signature · 1 line
2.19.0.rc2
#3 lore raw

PATCH 3/3 packages: respect PACKAGE_NO_GCONV

From: Kai Kang <[email protected]>

PACKAGE_NO_GCONV is set in libc-package.bbclass if not all of 'libc-charsets libc-locale-code libc-locales' included in DISTRO_FEATURES. And then no packages glibc-gconv-* glibc-charmap-* and glibc-localedata-* is created. Update recipes and conf file which depend on these packages to check required distro features.

---
 meta/conf/distro/include/tclibc-glibc.inc     | 2 +-
 meta/recipes-core/glib-2.0/glib.inc           | 4 +++-
 meta/recipes-core/libxml/libxml2_2.9.8.bb     | 4 +++-
 meta/recipes-devtools/mtools/mtools_4.0.19.bb | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)
meta/conf/distro/include/tclibc-glibc.inc +1 -1
index 8d1076440f..abe619aaac 100644
@@ -32,7 +32,7 @@ LIBC_LOCALE_DEPENDENCIES = "\
 	glibc-gconv-iso8859-15"
 
 def get_libc_locales_dependencies(d):
-    if 'libc-locales' in (d.getVar('DISTRO_FEATURES') or '').split() :
+    if bb.utils.contains('DISTRO_FEATURES', 'libc-charsets libc-locale-code libc-locales', True, False, d):
         return d.getVar('LIBC_LOCALE_DEPENDENCIES') or ''
     else:
         return ''
meta/recipes-core/glib-2.0/glib.inc +3 -1
index e8215da583..a868b6df23 100644
@@ -29,7 +29,9 @@ PACKAGES += "${PN}-codegen ${PN}-utils"
 
 LEAD_SONAME = "libglib-2.0.*"
 
-inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages
+inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages distro_features_check
+
+REQUIRED_DISTRO_FEATURES_libc-glibc = "${@'libc-charsets libc-locale-code libc-locales' if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d) else ''}"
 
 S = "${WORKDIR}/glib-${PV}"
 
meta/recipes-core/libxml/libxml2_2.9.8.bb +3 -1
index 740bf56a5a..0e2461154b 100644
@@ -38,10 +38,12 @@ PACKAGECONFIG ??= "python \
 PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 
-inherit autotools pkgconfig binconfig-disabled ptest
+inherit autotools pkgconfig binconfig-disabled ptest distro_features_check
 
 inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)}
 
+REQUIRED_DISTRO_FEATURES_libc-glibc = "${@'libc-charsets libc-locale-code libc-locales' if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d) else ''}"
+
 RDEPENDS_${PN}-ptest += "make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell  python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
 
 RDEPENDS_${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}"
meta/recipes-devtools/mtools/mtools_4.0.19.bb +3 -1
index 09742773e0..9972762b4e 100644
@@ -37,7 +37,9 @@ SRC_URI = "${GNU_MIRROR}/mtools/mtools-${PV}.tar.bz2 \
 
 SRC_URI_append_class-native = " file://disable-hardcoded-configs.patch"
 
-inherit autotools texinfo
+inherit autotools texinfo distro_features_check
+
+REQUIRED_DISTRO_FEATURES_libc-glibc = "libc-charsets libc-locale-code libc-locales"
 
 EXTRA_OECONF = "--without-x"
 
Signature · 1 line
2.19.0.rc2
#1 lore raw

PATCH 1/3 glibc-locale: fix installed-vs-shipped qa issue

In reply to [email protected]

From: Kai Kang <[email protected]>

Variable PACKAGE_NO_GCONV is set in libc-package.bbclass when none of libc-charsets, libc-locales and libc-locale-code set in DISTRO_FEATURES. Then it causes installed-vs-shipped qa issue of glibc-locale:

| ERROR: glibc-locale-2.28-r0 do_package: QA Issue: glibc-locale:
| Files/directories were installed but not shipped in any package:
|   /usr/share/i18n
|   /usr/share/i18n/charmaps
|   /usr/share/i18n/locales
|   /usr/share/i18n/charmaps/CP737.gz
|   ...
|   /usr/share/i18n/locales/ru_RU
|   ...
|   /usr/lib64/gconv/gconv-modules
| Please set FILES such that these items are packaged. Alternatively if they
| are unneeded, avoid installing them or delete them within do_install.
| glibc-locale: 843 installed and not shipped files. [installed-vs-shipped]

So check PACKAGE_NO_GCONV during do_install and not copy those files if PACKAGE_NO_GCONV has been set.

Simplify call of bb.utils.contains() in libc-package.bbclass as well.

---
 meta/classes/libc-package.bbclass        |  4 +---
 meta/recipes-core/glibc/glibc-locale.inc | 15 +++++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)
meta/classes/libc-package.bbclass +1 -3
index 6b1e84ef7e..82d642e15e 100644
@@ -39,9 +39,7 @@ python __anonymous () {
                 break
 
     # try to fix disable charsets/locales/locale-code compile fail
-    if bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d) and \
-            bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d) and \
-            bb.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d):
+    if bb.utils.contains('DISTRO_FEATURES', 'libc-charsets libc-locales libc-locale-code', True, False, d):
         d.setVar('PACKAGE_NO_GCONV', '0')
     else:
         d.setVar('PACKAGE_NO_GCONV', '1')
meta/recipes-core/glibc/glibc-locale.inc +9 -6
index 57b465dd5d..6384f9cbf1 100644
@@ -72,7 +72,7 @@ FILES_localedef = "${bindir}/localedef"
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
 do_install () {
-	mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir}
+	mkdir -p ${D}${bindir} ${D}${datadir}
 	if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
 		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
 	fi
@@ -80,11 +80,14 @@ do_install () {
 		mkdir -p ${D}${localedir}
 		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
 	fi
-	if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-	fi
-	if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
+	if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
+		mkdir -p ${D}${libdir}
+		if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
+			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
+		fi
+		if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
+			cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
+		fi
 	fi
 	if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
 		cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
Signature · 1 line
2.19.0.rc2
#2 lore raw

PATCH 2/3 image.bbclass: respect PACKAGE_NO_GCONV

In reply to [email protected]

From: Kai Kang <[email protected]>

It installs locale-base-* packages according to var IMAGE_LINGUAS. Packages locale-base-* are split in libc-package.bbclass if variable PACKAGE_NO_GCONV is not set. When none of ditro features libc-charsets libc-locales and libc-locale-code is set, PACKAGE_NO_GCONV is set. Then no locale-base-* is created and fails to create image.

Clear IMAGE_LINGUAS in such situation.

---
 meta/classes/image.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/image.bbclass +5 -0
index 276d0d31f4..11927f39f5 100644
@@ -176,6 +176,11 @@ IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
 
 LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
 
+python () {
+    if not bb.utils.contains('DISTRO_FEATURES', 'libc-charsets libc-locale-code libc-locales', True, False, d):
+        d.setVar('IMAGE_LINGUAS', '')
+}
+
 # Prefer image, but use the fallback files for lookups if the image ones
 # aren't yet available.
 PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
Signature · 1 line
2.19.0.rc2