Skip to contentSkip to conversation

meson.bblcass: Remove empty egg-info directories before running meson

PATCH New Peter Kjellerstedt 1 participant 2 messages Oct 25, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 meson.bblcass: Remove empty egg-info directories before running meson

sstate.bbclass no longer removes empty directories to avoid a race (see commit 4f94d929 "sstate/staging: Handle directory creation race issue"). Unfortunately Python apparently treats an empty egg-info directory as if the version it previously contained still exists and fails if a newer version is required, which Meson does. To avoid this, make sure there are no empty egg-info directories from previous versions left behind.

---

PATCHv2: Ignore all errors from rmdir since apparently egg-info may be
files rather than directories.

 meta/classes/meson.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/meson.bbclass +10 -0
index e124d18144..da58cb4bec 100644
@@ -103,6 +103,16 @@ meson_do_configure() {
     # https://github.com/mesonbuild/meson/commit/ef9aeb188ea2bc7353e59916c18901cde90fa2b3
     unset LD
 
+    # sstate.bbclass no longer removes empty directories to avoid a race (see
+    # commit 4f94d929 "sstate/staging: Handle directory creation race issue").
+    # Unfortunately Python apparently treats an empty egg-info directory as if
+    # the version it previously contained still exists and fails if a newer
+    # version is required, which Meson does. To avoid this, make sure there are
+    # no empty egg-info directories from previous versions left behind. Ignore
+    # all errors from rmdir since the egg-info may be a file rather than a
+    # directory.
+    rmdir ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/*.egg-info 2>/dev/null || :
+
     # Work around "Meson fails if /tmp is mounted with noexec #2972"
     mkdir -p "${B}/meson-private/tmp"
     export TMPDIR="${B}/meson-private/tmp"
#1 lore raw

PATCH v2 2/2 qemu.inc: Remove empty egg-info directories before running meson

This is the same solution that has been applied to meson.bbclass to allow building with meson after it has been updated to a new version. It needs to be applied here as well since qemu uses meson without inheriting meson.bbclass.

---
 meta/recipes-devtools/qemu/qemu.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +6 -2
index 57e5e1a015..33052a9d49 100644
@@ -9,7 +9,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
 RDEPENDS:${PN}-ptest = "bash"
 
 require qemu-targets.inc
-inherit pkgconfig ptest
+inherit pkgconfig ptest python3-dir
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
                     file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
@@ -111,7 +111,11 @@ do_configure:prepend:class-native() {
 }
 
 do_configure() {
-    ${S}/configure ${EXTRA_OECONF}
+	# This is taken from meson.bbclass to avoid errors when updating to a
+	# new version of meson.
+	rmdir ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/*.egg-info 2>/dev/null || :
+
+	${S}/configure ${EXTRA_OECONF}
 }
 do_configure[cleandirs] += "${B}"