From: Jose Quaresma Date: Mon, 27 Mar 2023 15:59:37 +0000 (+0000) Subject: oeqa/selftest: OESelftestTestContext: convert relative to full path when newbuilddir... X-Git-Tag: yocto-4.1.4~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41f169ea23078cc8f4a6b6fc6b59230f05cb758b;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git oeqa/selftest: OESelftestTestContext: convert relative to full path when newbuilddir is provided Relative paths in BBLAYERS only works when the new build dir are on the same ascending directory node: . ├── build ├── build-st It works because they share the same ascending relative directory node. So use the full path when the argument newbuilddir is provided to make the oe-selftest work everywere regardless of the location chosen. Signed-off-by: Jose Quaresma Signed-off-by: Alexandre Belloni (cherry picked from commit 2e022c1977bc1006c00a87e08a2dca5b69db4801) Signed-off-by: Steve Sakoman --- diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 0d26a07438f..0e3244a1c5c 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -91,6 +91,16 @@ class OESelftestTestContext(OETestContext): # Tried to used bitbake-layers add/remove but it requires recipe parsing and hence is too slow subprocess.check_output("sed %s/conf/bblayers.conf -i -e 's#%s#%s#g'" % (newbuilddir, selftestdir, newselftestdir), cwd=newbuilddir, shell=True) + # Relative paths in BBLAYERS only works when the new build dir share the same ascending node + if self.newbuilddir: + bblayers = subprocess.check_output("bitbake-getvar --value BBLAYERS | tail -1", cwd=builddir, shell=True, text=True) + if '..' in bblayers: + bblayers_abspath = [os.path.abspath(path) for path in bblayers.split()] + with open("%s/conf/bblayers.conf" % newbuilddir, "a") as f: + newbblayers = "# new bblayers to be used by selftest in the new build dir '%s'\n" % newbuilddir + newbblayers += 'BBLAYERS = "%s"\n' % ' '.join(bblayers_abspath) + f.write(newbblayers) + for e in os.environ: if builddir + "/" in os.environ[e]: os.environ[e] = os.environ[e].replace(builddir + "/", newbuilddir + "/")