Skip to contentSkip to conversation

xcb-proto: solve python cache colliion

PATCH In review Ross Burton 2 participants 5 messages Mar 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 xcb-proto: solve python cache colliion

Because I didn't really want python3-native to be at the bottom of the entire X11 stack this recipe jumps through a small hoop to use the host Python to run some modules it installs into the sysroot.

The Makefile compiles the Python module, which is good as the cache file is recorded in the sstate manifest so when the package is removed from the sysroot all of it is removed.

However in an enviroment where the sstate is shared between multiple hosts it is possible that a different Python is used and this will generate a new cache when the code is executed, which is not recorded in the manifest. Eventually you'll end up with ownerless cache files in a sysroot which conflict with the same file coming from a sstate upgrade.

Solve this with a SSTATE_INST_POSTRM which is ran when sstate is removed to ensure that there are no Python cache files left behind.

[ YOCTO #11809 ]

---
 meta/recipes-graphics/xorg-proto/xcb-proto_1.12.bb | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
meta/recipes-graphics/xorg-proto/xcb-proto_1.12.bb +17 -0
index 712ab6c59ab..25a8373e0b9 100644
@@ -34,3 +34,20 @@ RDEPENDS_${PN}-dev = ""
 RRECOMMENDS_${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
 
 BBCLASSEXTEND = "native nativesdk"
+
+# Need to do this dance because we're forcing the use of host Python above and
+# if xcb-proto is built with Py3.5 and then re-used from sstate on a host with
+# Py3.6 the second build will write new cache files into the sysroot which won't
+# be listed in the manifest so won't be deleted, resulting in an error on
+# rebuilds.  Solve this by deleting the entire cache directory when this package
+# is removed from the sysroot.
+SSTATEPOSTINSTFUNCS += "xcb_sstate_postinst"
+xcb_sstate_postinst() {
+	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+	then
+		cat <<EOF >${SSTATE_INST_POSTRM}
+#!/bin/sh
+rm -rf ${libdir}/xcb-proto/xcbgen/__pycache__
+EOF
+	fi
+}
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/4 testexport-tarball: sync with buildtools-tarball

This is basically a copy/paste of buildtools-tarball so copy some of the recent changes to buildtools across.

---
 meta/recipes-core/meta/testexport-tarball.bb | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
meta/recipes-core/meta/testexport-tarball.bb +16 -2
index 72f5531c5c5..c38ac902a06 100644
@@ -10,7 +10,13 @@ TOOLCHAIN_TARGET_TASK ?= ""
 
 TOOLCHAIN_HOST_TASK ?= "${TEST_EXPORT_SDK_PACKAGES}"
 
-SDK_PACKAGE_ARCHS += "tesexport-tools-${SDKPKGSUFFIX}"
+MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
+PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}"
+PACKAGE_ARCHS = ""
+TARGET_ARCH = "none"
+TARGET_OS = "none"
+
+SDK_PACKAGE_ARCHS += "testexport-tools-${SDKPKGSUFFIX}"
 
 TOOLCHAIN_OUTPUTNAME ?= "${TEST_EXPORT_SDK_NAME}"
 
@@ -22,7 +28,15 @@ EXCLUDE_FROM_WORLD = "1"
 
 inherit meta
 inherit populate_sdk
-inherit toolchain-scripts
+inherit toolchain-scripts-base
+inherit nopackages
+
+deltask install
+deltask populate_sysroot
+
+do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}"
+
+REAL_MULTIMACH_TARGET_SYS = "none"
 
 create_sdk_files_append () {
 	rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-*
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/4 sdk: only install locales if we're using glibc

In reply to Ross Burton

Using glibc-locale to install locales only makes sense if we're using glibc.

---
 meta/lib/oe/sdk.py | 4 ++++
 1 file changed, 4 insertions(+)
meta/lib/oe/sdk.py +4 -0
index 76fe02c37b2..6cd4115202f 100644
@@ -130,6 +130,10 @@ class Sdk(object, metaclass=ABCMeta):
             bb.warn("cannot remove SDK dir: %s" % path)
 
     def install_locales(self, pm):
+        # This is only relevant for glibc
+        if self.d.getVar("TCLIBC") != "glibc":
+            return
+
         linguas = self.d.getVar("SDKIMAGE_LINGUAS")
         if linguas:
             import fnmatch
Signature · 1 line
2.11.0
#3 lore raw

PATCH 4/4 populate_sdk_base: depend on nativesdk-glibc-locale

In reply to Ross Burton

If we're building a SDK and we're using glibc so may be installing locales, add a build-dependency on natiesdk-glibc-locale so the locales we need will exist.

---
 meta/classes/populate_sdk_base.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/populate_sdk_base.bbclass +1 -0
index be5970a4bbc..60a5abc7dc8 100644
@@ -47,6 +47,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
 
 SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
 SDK_DEPENDS = "virtual/fakeroot-native pixz-native cross-localedef-native"
+SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale"
 
 # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
 # could be set to the MACHINE_ARCH
Signature · 1 line
2.11.0
Tested-by on v1 4/4
#4 lore raw

Re: [PATCH 4/4] populate_sdk_base: depend on nativesdk-glibc-locale

Quoted 4 lines · Ross Burton

If we're building a SDK and we're using glibc so may be installing locales, add a build-dependency on natiesdk-glibc-locale so the locales we need will exist.

Thanks, fixes the sdk build failures I was seeing since Sunday.

Quoted 25 lines
---
 meta/classes/populate_sdk_base.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/populate_sdk_base.bbclass +1 -0
index be5970a4bbc..60a5abc7dc8 100644
@@ -47,6 +47,7 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
 
 SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
 SDK_DEPENDS = "virtual/fakeroot-native pixz-native cross-localedef-native"
+SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale"
 
 # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
 # could be set to the MACHINE_ARCH
Signature · 7 lines
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]