diff mbox series

oeqa/selftest: Fix failure when configuration contains BBLAYERS:append

Message ID 20241209202941.1056020-1-ohnatiuk@cisco.com
State Accepted, archived
Commit 516c8e8f722ed0eb85a715a23b5e68d05abe9275
Headers show
Series oeqa/selftest: Fix failure when configuration contains BBLAYERS:append | expand

Commit Message

Oleksandr Hnatiuk Dec. 9, 2024, 8:29 p.m. UTC
When used with `--newbuilddir` option, it replaces relative paths in
BBLAYERS variable with absolute paths by evaluating the final value of
the variable, converting paths and saving result by assignment
(`BBLAYERS =`) at the end of bblayers.conf.

This breaks tests when bblayers.conf contains BBLAYERS:append because
:append statements are evaluated after all assignments and we end up
with the appended layer added twice - first by evaluating final value
of the variable, then again by bitbake evaluating BBLAYERS:append.

The error is as follows:
AssertionError: Command 'bitbake  -e' returned non-zero exit status 1:
ERROR: Found duplicated BBFILE_COLLECTIONS 'layer-name', check bblayers.conf or layer.conf to fix it.

Signed-off-by: Oleksandr Hnatiuk <ohnatiuk@cisco.com>
---
 meta/lib/oeqa/selftest/context.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Oleksandr Hnatiuk Dec. 9, 2024, 8:38 p.m. UTC | #1
This has been previously discussed in: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15679
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index acc3b073bd11..5eb4cc44fd3c 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -114,6 +114,7 @@  class OESelftestTestContext(OETestContext):
                 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 += 'unset BBLAYERS\n'
                     newbblayers += 'BBLAYERS = "%s"\n' % ' '.join(bblayers_abspath)
                     f.write(newbblayers)