From: Christos Gavros Date: Tue, 25 Feb 2025 17:56:51 +0000 (+0100) Subject: oeqa/selftest: add a newline in local.conf (newbuilddir) X-Git-Tag: yocto-5.2~393 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2fcd9e880126bc33be2ef14e678cc1aa72683c3;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git oeqa/selftest: add a newline in local.conf (newbuilddir) If the build-st/conf/local.conf does not end with a newline when is generated then add one [YOCTO #15734] CC: Yoann Congal CC: Randy MacLeod CC: Alexander Kanavin Signed-off-by: Christos Gavros Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 5eb4cc44fd3..16f82c6737d 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -102,6 +102,13 @@ class OESelftestTestContext(OETestContext): oe.path.copytree(builddir + "/cache", newbuilddir + "/cache") oe.path.copytree(selftestdir, newselftestdir) + # if the last line of local.conf in newbuilddir is not empty and does not end with newline then add one + localconf_path = newbuilddir + "/conf/local.conf" + with open(localconf_path, "r+", encoding="utf-8") as f: + last_line = f.readlines()[-1] + if last_line and not last_line.endswith("\n"): + f.write("\n") + subprocess.check_output("git init && git add * && git commit -a -m 'initial'", cwd=newselftestdir, shell=True) # Tried to used bitbake-layers add/remove but it requires recipe parsing and hence is too slow