context: Add support for relative KAS_WORK/BUILD/REPO_REF_DIR paths

No one asked for this so far but the result of providing a relative
path, e.g. to KAS_WORK_DIR, is so confusing that it is better to simply
resolve all those vars to absolute paths.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2021-08-17 16:18:48 +02:00
parent ff99bf2226
commit 4c81f96742

View File

@ -71,11 +71,13 @@ class Context:
Implements the kas build context.
"""
def __init__(self, args):
self.__kas_work_dir = os.environ.get('KAS_WORK_DIR', os.getcwd())
self.__kas_build_dir = os.environ.get('KAS_BUILD_DIR',
os.path.join(self.__kas_work_dir,
'build'))
self.__kas_repo_ref_dir = os.environ.get('KAS_REPO_REF_DIR', None)
work_dir = os.environ.get('KAS_WORK_DIR', os.getcwd())
self.__kas_work_dir = os.path.abspath(work_dir)
build_dir = os.environ.get('KAS_BUILD_DIR',
os.path.join(self.__kas_work_dir, 'build'))
self.__kas_build_dir = os.path.abspath(build_dir)
ref_dir = os.environ.get('KAS_REPO_REF_DIR', None)
self.__kas_repo_ref_dir = os.path.abspath(ref_dir) if ref_dir else None
self.setup_initial_environ()
self.config = None
self.args = args