config: Fix repo-relative include file handling if no config file is given
If we do not specify a configuration file for the "kas build" command, the repository anchor is set to the current working directory, which breaks the resolution of repo-relative include file paths in the IncludeHandler class if repo root != current working directory. Sets the repository anchor to the root path of the repository with fallback to KAS_WORK_DIR if we use .config.yaml from KAS_WORK_DIR. Signed-off-by: Johann Neuhauser <jneuhauser@dh-electronics.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
a9cc7d06b3
commit
cbdba7e8e1
@ -57,7 +57,7 @@ class Config:
|
|||||||
'must be outside of versioning control')
|
'must be outside of versioning control')
|
||||||
else:
|
else:
|
||||||
self.filenames = [os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE)]
|
self.filenames = [os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE)]
|
||||||
self.top_repo_path = os.getcwd()
|
self.top_repo_path = Repo.get_root_path(ctx.kas_work_dir)
|
||||||
|
|
||||||
self.handler = IncludeHandler(self.filenames, self.top_repo_path)
|
self.handler = IncludeHandler(self.filenames, self.top_repo_path)
|
||||||
self.repo_dict = self._get_repo_dict()
|
self.repo_dict = self._get_repo_dict()
|
||||||
|
@ -378,9 +378,8 @@ def ssh_no_host_key_check():
|
|||||||
|
|
||||||
def setup_parser_common_args(parser):
|
def setup_parser_common_args(parser):
|
||||||
parser.add_argument('config',
|
parser.add_argument('config',
|
||||||
help='Config file, using .config.yaml if none is '
|
help='Config file, using .config.yaml in KAS_WORK_DIR '
|
||||||
'specified and using the current directory as '
|
'if none is specified',
|
||||||
'repository anchor',
|
|
||||||
nargs='?')
|
nargs='?')
|
||||||
parser.add_argument('--skip',
|
parser.add_argument('--skip',
|
||||||
help='Skip build steps',
|
help='Skip build steps',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user