Add build_system property to config file

This allows to pre-select the build system, specifically avoiding
confusion when kas-container is accidentally not called with --isar for
an isar config. For that, build_system needs to be defined in the
lop-level config file passed to kas-container.

Theoretically, this also allows to combine layers which have both
oe-init-build-env and isar-init-build-env scripts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2020-11-15 09:57:51 +01:00
parent f502f92afe
commit 6a8abf277c
8 changed files with 70 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2017-2018
# Copyright (c) Siemens AG, 2017-2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -23,10 +23,10 @@
This module contains the version of kas.
"""
__license__ = 'MIT'
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
__copyright__ = 'Copyright (c) Siemens AG, 2017-2020'
__version__ = '2.2'
# Please update docs/format-changelog.rst when changing the file version.
__file_version__ = 9
__file_version__ = 10
__compatible_file_version__ = 1

View File

@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2017-2018
# Copyright (c) Siemens AG, 2017-2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -53,6 +53,12 @@ class Config:
self.handler = IncludeHandler(self.filenames)
self.repo_dict = self._get_repo_dict()
def get_build_system(self):
"""
Returns the pre-selected build system
"""
return self._config.get('build_system', '')
def find_missing_repos(self):
"""
Returns repos that are in config but not on disk

View File

@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2017-2018
# Copyright (c) Siemens AG, 2017-2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
@@ -72,6 +72,10 @@ CONFIGSCHEMA = {
},
},
},
'build_system': {
'type': 'string',
'enum': ['openembedded', 'oe', 'isar'],
},
'defaults': {
'type': 'object',
'additionalProperties': False,

View File

@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2017-2018
# Copyright (c) Siemens AG, 2017-2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -225,7 +225,7 @@ class SetupEnviron(Command):
return 'setup_environ'
def execute(self, ctx):
ctx.environ.update(get_build_environ())
ctx.environ.update(get_build_environ(ctx.config.get_build_system()))
class WriteBBConfig(Command):

View File

@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2017-2018
# Copyright (c) Siemens AG, 2017-2020
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -183,7 +183,7 @@ def repos_apply_patches(repos):
sys.exit(task.result())
def get_build_environ():
def get_build_environ(build_system):
"""
Creates the build environment variables.
"""
@@ -191,9 +191,15 @@ def get_build_environ():
# creates the conf directory
init_repo = None
if build_system in ['openembedded', 'oe']:
scripts = ['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 ['oe-init-build-env', 'isar-init-build-env']]
for script in scripts]
for (repo, script) in permutations:
if os.path.exists(repo.path + '/' + script):
if init_repo: