Bläddra i källkod

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 <yoann.congal@smile.fr>
CC: Randy MacLeod <randy.macleod@windriver.com>
CC: Alexander Kanavin <alex.kanavin@gmail.com>
(From OE-Core rev: d2fcd9e880126bc33be2ef14e678cc1aa72683c3)

Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Christos Gavros 3 månader sedan
förälder
incheckning
de51bc3cd9
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      meta/lib/oeqa/selftest/context.py

+ 7 - 0
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