[PATCH v2 1/2] consistently use openembedded as default build_system

4 views
Skip to first unread message

Felix Moessbauer

unread,
Jun 3, 2026, 7:04:07 AMJun 3
to kas-...@googlegroups.com, jan.k...@siemens.com, Felix Moessbauer
Currently, the build system is handled inconsistently across kas and
kas-container. While the default in kas-container is openembedded, kas
probes all permutations if no build system is provided (without
setting the build_system internally after finding a script).

We clean this up by directly loading the default value from the schema
and provide that to all callers across kas. This allows us to simplify
the init script probing. The effect of the schema change is limited to
isar users building directly with kas (no kas-container). As most (if
not all) isar users are container-based, this has no practical impact.
By that, we don't increase the schema version.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
Changes since v1:

- improved commit message to better reflect the behavior changes

docs/userguide/project-configuration.rst | 13 ++++++-------
kas/config.py | 3 ++-
kas/libkas.py | 11 +++--------
kas/schema-kas.json | 1 +
4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/docs/userguide/project-configuration.rst b/docs/userguide/project-configuration.rst
index 04c887b54..71d17ec4f 100644
--- a/docs/userguide/project-configuration.rst
+++ b/docs/userguide/project-configuration.rst
@@ -259,13 +259,12 @@ Configuration reference

``build_system``: string [optional]
:kasschemadesc:`build_system`
- Known build systems are
- ``openembedded`` (or ``oe``) and ``isar``. If set, this restricts the
- search of kas for the init script in the configured repositories to
- ``oe-init-build-env`` or ``isar-init-build-env``, respectively. If
- ``kas-container`` finds this property in the top-level kas configuration
- file (includes are not evaluated), it will automatically select the
- required container image and invocation mode.
+ Supported build systems are ``openembedded`` (or ``oe``) and ``isar``.
+ This value determines which init script is searched for in the configured
+ repositories (``oe-init-build-env`` or ``isar-init-build-env``,
+ respectively). ``kas-container`` evaluates this property in the top-level kas
+ configuration file only (includes are not evaluated) to select the required
+ container image and invocation mode.

``defaults``: dict [optional]
:kasschemadesc:`defaults`
diff --git a/kas/config.py b/kas/config.py
index cebc7494a..3ebdda822 100644
--- a/kas/config.py
+++ b/kas/config.py
@@ -69,7 +69,8 @@ class Config:
"""
Returns the pre-selected build system
"""
- return self._config.get('build_system', '')
+ default_bs = CONFIGSCHEMA['properties']['build_system']['default']
+ return self._config.get('build_system', default_bs)

def find_missing_repos(self, repo_paths={}):
"""
diff --git a/kas/libkas.py b/kas/libkas.py
index f5f5c45ed..bdfcf1712 100644
--- a/kas/libkas.py
+++ b/kas/libkas.py
@@ -404,15 +404,10 @@ def get_build_environ(build_system):

init_repo = None
if build_system in ['openembedded', 'oe']:
- scripts = ['oe-init-build-env']
+ script = 'oe-init-build-env'
elif build_system == 'isar':
- scripts = ['isar-init-build-env']
- else:
- scripts = ['oe-init-build-env', 'isar-init-build-env']
- permutations = \
- [(repo, script) for repo in get_context().config.get_repos()
- for script in scripts]
- for (repo, script) in permutations:
+ script = 'isar-init-build-env'
+ for repo in get_context().config.get_repos():
if os.path.exists(repo.path + '/' + script):
if init_repo:
raise InitBuildEnvError(
diff --git a/kas/schema-kas.json b/kas/schema-kas.json
index f3594a247..b8dc86c6c 100644
--- a/kas/schema-kas.json
+++ b/kas/schema-kas.json
@@ -80,6 +80,7 @@
},
"build_system": {
"description": "Defines the bitbake-based build system.",
+ "default": "openembedded",
"enum": [
"openembedded",
"oe",
--
2.53.0

Felix Moessbauer

unread,
Jun 3, 2026, 7:04:08 AMJun 3
to kas-...@googlegroups.com, jan.k...@siemens.com, Felix Moessbauer
This function is called from a Macro with a specific context. Instead of
relying on the global context, use the specific one that is provided to
the caller.

While this does not make any difference in the current behavior, it
reduces the global state and aligns the architecture with other commands.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
kas/libcmds.py | 4 +++-
kas/libkas.py | 10 +++++-----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/kas/libcmds.py b/kas/libcmds.py
index 70eb95cd1..5f3b7ee3f 100644
--- a/kas/libcmds.py
+++ b/kas/libcmds.py
@@ -470,7 +470,9 @@ class SetupEnviron(Command):
return 'setup_environ'

def execute(self, ctx):
- ctx.environ.update(get_build_environ(ctx.config.get_build_system()))
+ ctx.environ.update(
+ get_build_environ(ctx.config.get_build_system(), ctx)
+ )


class WriteBBConfig(Command):
diff --git a/kas/libkas.py b/kas/libkas.py
index bdfcf1712..0331d092a 100644
--- a/kas/libkas.py
+++ b/kas/libkas.py
@@ -395,7 +395,7 @@ def get_buildtools_version():
return -1


-def get_build_environ(build_system):
+def get_build_environ(build_system, ctx):
"""
Creates the build environment variables.
"""
@@ -407,7 +407,7 @@ def get_build_environ(build_system):
script = 'oe-init-build-env'
elif build_system == 'isar':
script = 'isar-init-build-env'
- for repo in get_context().config.get_repos():
+ for repo in ctx.config.get_repos():
if os.path.exists(repo.path + '/' + script):
if init_repo:
raise InitBuildEnvError(
@@ -420,7 +420,7 @@ def get_build_environ(build_system):
if not init_repo:
raise InitBuildEnvError('Did not find any init-build-env script')

- conf_buildtools = get_context().config.get_buildtools()
+ conf_buildtools = ctx.config.get_buildtools()
buildtools_env = ""

if conf_buildtools:
@@ -475,7 +475,7 @@ def get_build_environ(build_system):
env = {}
env['PATH'] = '/usr/sbin:/usr/bin:/sbin:/bin'

- (_, output) = run_cmd([str(get_bb_env_file), get_context().build_dir],
+ (_, output) = run_cmd([str(get_bb_env_file), ctx.build_dir],
cwd=init_repo.path, env=env)
if init_script_log != '/dev/null':
with open(init_script_log) as log:
@@ -492,7 +492,7 @@ def get_build_environ(build_system):
except ValueError:
pass

- conf_env = get_context().config.get_environment()
+ conf_env = ctx.config.get_environment()

env_vars = ['SSTATE_DIR', 'SSTATE_MIRRORS', 'DL_DIR', 'TMPDIR']
env_vars.extend(conf_env)
--
2.53.0

Jan Kiszka

unread,
Jun 3, 2026, 8:45:35 AMJun 3
to Felix Moessbauer, kas-...@googlegroups.com
Thanks, both applied.

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center
Reply all
Reply to author
Forward
0 new messages