Fix overwriting of target via command line with static configs

ConfigStatic does not respect the --target overwrite so far. Fix this
by pulling the default definition into ConfigPython (ConfigStatic
already does that via the Config base class) and set the target provided
via the command line in the static config after parsing all files.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2017-07-08 19:20:21 +02:00 committed by Daniel Wagner
parent 7f1ccba5ea
commit 49cb9b7a7b
2 changed files with 6 additions and 4 deletions

View File

@ -55,8 +55,7 @@ class Build:
bld_psr.add_argument('config', bld_psr.add_argument('config',
help='Config file') help='Config file')
bld_psr.add_argument('--target', bld_psr.add_argument('--target',
help='Select target to build', help='Select target to build')
default='core-image-minimal')
bld_psr.add_argument('--task', bld_psr.add_argument('--task',
help='Select which task should be executed', help='Select which task should be executed',
default='build') default='build')

View File

@ -248,7 +248,7 @@ class ConfigPython(Config):
""" """
Sets the configuration for `target` Sets the configuration for `target`
""" """
self.target = target self.target = 'core-image-minimal' if target is None else target
self.repos = self._config['get_repos'](self, target) self.repos = self._config['get_repos'](self, target)
def get_proxy_config(self): def get_proxy_config(self):
@ -323,7 +323,7 @@ class ConfigStatic(Config):
Implements the static kas configuration based on config files. Implements the static kas configuration based on config files.
""" """
def __init__(self, filename, _): def __init__(self, filename, target):
from .includehandler import GlobalIncludes, IncludeException from .includehandler import GlobalIncludes, IncludeException
super().__init__() super().__init__()
self.setup_environ() self.setup_environ()
@ -357,6 +357,9 @@ class ConfigStatic(Config):
(self._config, missing_repo_names) = \ (self._config, missing_repo_names) = \
self.handler.get_config(repos=repo_paths) self.handler.get_config(repos=repo_paths)
if target:
self._config['target'] = target
def get_repos(self): def get_repos(self):
""" """
Returns the list of repos. Returns the list of repos.