base.bbclass: use os.path.normpath instead of just comparing WORKDIR and S as strings
PATCH 1/3 base.bbclass: use os.path.normpath instead of just comparing WORKDIR and S as strings
* cannot use os.path.samefile, because S/B might not exist at this time yet
* there is issue with PSEUDO_IGNORE_PATHS when some recipe sets e.g. S = "${WORKDIR}/"
whole WORKDIR gets added to PSEUDO_IGNORE_PATHS and then the build can fail with various strange errors, in my case do_package was failing when do_package calls:
fix_perms(.../1.0-r0/package/etc, 755, 0, 0, /etc)
and fails with "[Errno 1] Operation not permitted:"
--- meta/classes/base.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/base.bbclass +2 -2
@@ -388,9 +388,9 @@ python () { oe.utils.features_backfill("DISTRO_FEATURES", d) oe.utils.features_backfill("MACHINE_FEATURES", d) - if d.getVar("WORKDIR") != d.getVar("S"): + if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")): d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}") - if d.getVar("WORKDIR") != d.getVar("B"): + if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")): d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}") # Handle PACKAGECONFIG
Signature · 1 line
2.25.1
PATCH 2/3 mtd-utils: don't use trailing slash in S
--- meta/recipes-devtools/mtd/mtd-utils_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/mtd/mtd-utils_git.bb +1 -1
@@ -17,7 +17,7 @@ SRC_URI = "git://git.infradead.org/mtd-utils.git \ file://add-exclusion-to-mkfs-jffs2-git-2.patch \ " -S = "${WORKDIR}/git/" +S = "${WORKDIR}/git" EXTRA_OECONF += "--enable-install-tests"
Signature · 1 line
2.25.1
PATCH 3/3 base.bbclass: warn when there is trailing slash in S or B variables
In reply to Martin Jansa* to make sure we won't hit such corner cases in future add a warning to prevent trailing slashes and duplicated slashes even when they in most cases don't cause harm
* only a few cases were found in layers included in my world builds:
oe-core: 1
meta-oe: 7
meta-python2: 1
meta-qt5: 1
meta-aws: 1
will send patches for these once this warning is approved for oe-core
--- meta/classes/base.bbclass | 5 +++++ 1 file changed, 5 insertions(+)
meta/classes/base.bbclass +5 -0
@@ -388,6 +388,11 @@ python () { oe.utils.features_backfill("DISTRO_FEATURES", d) oe.utils.features_backfill("MACHINE_FEATURES", d) + if d.getVar("S")[-1] == '/': + bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S"))) + if d.getVar("B")[-1] == '/': + bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B"))) + if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")): d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}") if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
Signature · 1 line
2.25.1