config: Symplify .config.yaml file handling
If no configuration file is specified, we try to load a single .config.yaml from KAS_WORK_DIR and set the top_repo_path to the repo root of this file with fallback to the containing directory. This process is identical to loading explicitly specified configuration files and can therefore be combined into one case. Signed-off-by: Johann Neuhauser <jneuhauser@dh-electronics.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
cbdba7e8e1
commit
bce8a916fa
@ -41,7 +41,9 @@ class Config:
|
||||
self._override_target = target
|
||||
self._override_task = task
|
||||
self._config = {}
|
||||
if filename:
|
||||
if not filename:
|
||||
filename = os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE)
|
||||
|
||||
self.filenames = [os.path.abspath(configfile)
|
||||
for configfile in filename.split(':')]
|
||||
self.top_repo_path = Repo.get_root_path(
|
||||
@ -55,9 +57,6 @@ class Config:
|
||||
raise IncludeException('All concatenated config files must '
|
||||
'belong to the same repository or all '
|
||||
'must be outside of versioning control')
|
||||
else:
|
||||
self.filenames = [os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE)]
|
||||
self.top_repo_path = Repo.get_root_path(ctx.kas_work_dir)
|
||||
|
||||
self.handler = IncludeHandler(self.filenames, self.top_repo_path)
|
||||
self.repo_dict = self._get_repo_dict()
|
||||
|
Loading…
x
Reference in New Issue
Block a user