Message ID | 20250225095755.12352-1-gavrosc@yahoo.com |
---|---|
State | Accepted, archived |
Commit | d2fcd9e880126bc33be2ef14e678cc1aa72683c3 |
Headers | show |
Series | [v2] oeqa/selftest: add a newline in local.conf (newbuilddir) | expand |
On Tue, 25 Feb 2025 at 10:58, Christos Gavros via lists.openembedded.org <gavrosc=yahoo.com@lists.openembedded.org> wrote: > + # 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 = None > + for line in f: > + last_line = line You can replace this with 'last_line = f.readlines()[-1]'. Alex
Hello Chistos, Le mar. 25 févr. 2025 à 10:58, Christos Gavros <gavrosc@yahoo.com> a écrit : > If the build-st/conf/local.conf does not end with a newline > when is generated then add one > Fixes [YOCTO #15734] > > CC: Randy MacLeod <randy.macleod@windriver.com> > Reviewed-by: Yoann Congal <yoann.congal@smile.fr> > FYI, you can't add a Reviewed-by from someone without an explicit email (Often stating the full line "Reviewed-by: Xxx Yyy <...@...>"). On your v1, I merely commented, that is not sufficient for adding my reviewed-by. Signed-off-by: Christos Gavros <gavrosc@yahoo.com> > --- > v1->v2 > * the comment is changed > * last_line is initialized to "None" > * add a new line by using f.write("\n") > --- > meta/lib/oeqa/selftest/context.py | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/meta/lib/oeqa/selftest/context.py > b/meta/lib/oeqa/selftest/context.py > index 5eb4cc44fd..9145cbd72b 100644 > --- a/meta/lib/oeqa/selftest/context.py > +++ b/meta/lib/oeqa/selftest/context.py > @@ -102,6 +102,15 @@ 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 = None > + for line in f: > + last_line = line > + 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 > -- > 2.34.1 > >
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 5eb4cc44fd..9145cbd72b 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -102,6 +102,15 @@ 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 = None + for line in f: + last_line = line + 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