From 49cb9b7a7ba950c668ec950eb10d363bbf45f9e0 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sat, 8 Jul 2017 19:20:21 +0200 Subject: [PATCH] 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 --- kas/build.py | 3 +-- kas/config.py | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kas/build.py b/kas/build.py index dea3deb..ad343f2 100644 --- a/kas/build.py +++ b/kas/build.py @@ -55,8 +55,7 @@ class Build: bld_psr.add_argument('config', help='Config file') bld_psr.add_argument('--target', - help='Select target to build', - default='core-image-minimal') + help='Select target to build') bld_psr.add_argument('--task', help='Select which task should be executed', default='build') diff --git a/kas/config.py b/kas/config.py index 892b680..9e6d311 100644 --- a/kas/config.py +++ b/kas/config.py @@ -248,7 +248,7 @@ class ConfigPython(Config): """ 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) def get_proxy_config(self): @@ -323,7 +323,7 @@ class ConfigStatic(Config): Implements the static kas configuration based on config files. """ - def __init__(self, filename, _): + def __init__(self, filename, target): from .includehandler import GlobalIncludes, IncludeException super().__init__() self.setup_environ() @@ -357,6 +357,9 @@ class ConfigStatic(Config): (self._config, missing_repo_names) = \ self.handler.get_config(repos=repo_paths) + if target: + self._config['target'] = target + def get_repos(self): """ Returns the list of repos.