[PATCH] libcmds: Remove conf/templateconf.cfg before getting build environment

1,256 views
Skip to first unread message

Diego Sueiro

unread,
Sep 21, 2022, 11:19:36 AM9/21/22
to kas-...@googlegroups.com, n...@arm.com, Diego Sueiro
When switching between kirkstone and master branch the following error is produced:
ERROR - Command "/[...]/layers/poky$ /tmp/tmpeyolf6qy/get_bb_env /[...]/build" failed
--- Error summary ---
Error: TEMPLATECONF value points to nonexistent directory 'meta-poky/conf'

This is caused because the .templateconf in master changed to
TEMPLATECONF=${TEMPLATECONF:-meta-poky/conf/templates/default}

To workaround it we can simply remove the conf/templateconf.cfg before calling
get_build_system, since kas does not make usage of the TEMPLATECONF feature.

Signed-off-by: Diego Sueiro <diego....@arm.com>
---
kas/libcmds.py | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/kas/libcmds.py b/kas/libcmds.py
index 8104aa9..463b24f 100644
--- a/kas/libcmds.py
+++ b/kas/libcmds.py
@@ -248,6 +248,15 @@ class SetupEnviron(Command):
return 'setup_environ'

def execute(self, ctx):
+ """
+ Remove the conf/templateconf.cfg file to avoid errors during
+ oe-init-build-env call if the path from templateconf.cfg becomes
+ invalid.
+ """
+ filename = ctx.build_dir + '/conf/templateconf.cfg'
+ if os.path.exists(filename):
+ os.remove(filename)
+
ctx.environ.update(get_build_environ(ctx.config.get_build_system()))


--
2.35.1

Henning Schild

unread,
Sep 22, 2022, 5:00:58 AM9/22/22
to Diego Sueiro, kas-...@googlegroups.com, n...@arm.com
Am Wed, 21 Sep 2022 16:19:17 +0100
schrieb Diego Sueiro <diego....@arm.com>:

> When switching between kirkstone and master branch the following
> error is produced: ERROR - Command "/[...]/layers/poky$
> /tmp/tmpeyolf6qy/get_bb_env /[...]/build" failed --- Error summary ---
> Error: TEMPLATECONF value points to nonexistent directory
> 'meta-poky/conf'
>
> This is caused because the .templateconf in master changed to
> TEMPLATECONF=${TEMPLATECONF:-meta-poky/conf/templates/default}
>
> To workaround it we can simply remove the conf/templateconf.cfg
> before calling get_build_system, since kas does not make usage of the
> TEMPLATECONF feature.

Not sure i get this. But kas does not seem to do anything with
TEMPLATECONF, and it should probably stay like that.

Seems to me like you might want to patch your "oe-init-build-env",
maybe in a way that a new oe can handle an old builddir ... i.e. by
deleting the old one ;)

Such a patch should be proposed to OE, and in the meantime can be
applied with kas on that layer. So kas likely does not have to change.

Henning

Henning Schild

unread,
Sep 22, 2022, 5:04:42 AM9/22/22
to Diego Sueiro, kas-...@googlegroups.com, n...@arm.com
Am Wed, 21 Sep 2022 16:19:17 +0100
schrieb Diego Sueiro <diego....@arm.com>:

If kas takes this i would suggest

try:
os.remove(ctx.build_dir + '/conf/templateconf.cfg')
catch FileNotFoundError as e:
pass

Henning

> +
> ctx.environ.update(get_build_environ(ctx.config.get_build_system()))
>
>

Bezdeka, Florian

unread,
Sep 22, 2022, 5:22:42 AM9/22/22
to diego....@arm.com, Schild, Henning, kas-...@googlegroups.com, n...@arm.com
AFAIR os.path.join() is the python way of path concatenations.

As Henning already said: kas doesn't touch templateconf.cfg, so there
is no reason for kas to delete such a file.

As the file stays here after switching branches you are missing a
"clean" step somewhere or oe-init-build-env does not support that use-
case.
Reply all
Reply to author
Forward
0 new messages