config: Implemented multi-target support
With this patch support for building multiple targets in parallel with bitbake is now supported. Changes: - Its now possible to state a list of targets under the target key in the configuration file. Example: target: - product-image - product-update-image - Its now possible to define multiple targets in the kas command line. Example: $ kas build --target product-image --target product-update-image \ kas.yml - Its now possible to define multiple targets via the environment: Example: $ export KAS_TARGET="product-image product-update-image" $ kas build kas.yml Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
parent
f7d2e5ae20
commit
ab8e4cd375
@ -286,9 +286,11 @@ Configuration reference
|
||||
``local.conf``. Can be overwritten by the ``KAS_DISTRO`` environment
|
||||
variable and defaults to ``poky``.
|
||||
|
||||
* ``target``: string [optional]
|
||||
Contains the target to build by bitbake. Can be overwritten by the
|
||||
``KAS_TARGET`` environment variable and defaults to ``core-image-minimal``.
|
||||
* ``target``: string [optional] or list [optional]
|
||||
Contains the target or a list of targets to build by bitbake. Can be
|
||||
overwritten by the ``KAS_TARGET`` environment variable and defaults to
|
||||
``core-image-minimal``. Space is used as a delimiter if multiple targets
|
||||
should be specified via the environment variable.
|
||||
|
||||
* ``task``: string [optional]
|
||||
Contains the task to build by bitbake. Can be overwritten by the
|
||||
|
@ -26,5 +26,5 @@ __license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) Siemens AG, 2017'
|
||||
|
||||
__version__ = '0.13.0'
|
||||
__file_version__ = 3
|
||||
__file_version__ = 4
|
||||
__compatible_file_version__ = 1
|
||||
|
@ -55,6 +55,7 @@ class Build:
|
||||
bld_psr.add_argument('config',
|
||||
help='Config file')
|
||||
bld_psr.add_argument('--target',
|
||||
action='append',
|
||||
help='Select target to build')
|
||||
bld_psr.add_argument('--task',
|
||||
help='Select which task should be executed')
|
||||
@ -118,6 +119,6 @@ class BuildCommand(Command):
|
||||
"""
|
||||
# Start bitbake build of image
|
||||
bitbake = find_program(config.environ['PATH'], 'bitbake')
|
||||
run_cmd([bitbake, '-k', config.get_bitbake_target(),
|
||||
'-c', config.get_bitbake_task()],
|
||||
run_cmd([bitbake, '-k', '-c', config.get_bitbake_task()] +
|
||||
config.get_bitbake_targets(),
|
||||
env=config.environ, cwd=config.build_dir)
|
||||
|
@ -209,13 +209,19 @@ class Config:
|
||||
repo_dict[repo] = rep
|
||||
return repo_dict
|
||||
|
||||
def get_bitbake_target(self):
|
||||
def get_bitbake_targets(self):
|
||||
"""
|
||||
Return the bitbake target
|
||||
Returns a list of bitbake targets
|
||||
"""
|
||||
return os.environ.get('KAS_TARGET',
|
||||
self._config.get('target',
|
||||
'core-image-minimal'))
|
||||
environ_targets = [i
|
||||
for i in os.environ.get('KAS_TARGET', '').split()
|
||||
if i]
|
||||
if environ_targets:
|
||||
return environ_targets
|
||||
target = self._config.get('target', 'core-image-minimal')
|
||||
if isinstance(target, str):
|
||||
return [target]
|
||||
return target
|
||||
|
||||
def get_bitbake_task(self):
|
||||
"""
|
||||
|
@ -52,6 +52,7 @@ class Shell:
|
||||
sh_prs.add_argument('config',
|
||||
help='Config file')
|
||||
sh_prs.add_argument('--target',
|
||||
action='append',
|
||||
help='Select target to build',
|
||||
default='core-image-minimal')
|
||||
sh_prs.add_argument('--skip',
|
||||
|
Loading…
Reference in New Issue
Block a user