From 7fa75d94c0bed29346dc9df079f9604d79e55be8 Mon Sep 17 00:00:00 2001 From: Georg Lutz Date: Thu, 25 Jan 2018 11:12:58 +0100 Subject: [PATCH] repos: Fix relative path for repos If a repo path is relative, append the kas work dir to it. Background: The path ends up in bblayers.conf Without this change the following example will fail: -------------------------------------------------------- header: version: 4 machine: qemux86 repos: poky: url: "https://git.yoctoproject.org/git/poky" refspec: "rocko" path: "thirdparty/poky" layers: meta: meta-poky: -------------------------------------------------------- Signed-off-by: Georg Lutz --- docs/userguide.rst | 1 + kas/repos.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/userguide.rst b/docs/userguide.rst index 17c9b54..f5cc731 100644 --- a/docs/userguide.rst +++ b/docs/userguide.rst @@ -338,6 +338,7 @@ Configuration reference If the ``url`` as well as the ``path`` is defined, the path is used to overwrite the checkout directory, that defaults to ``kas_work_dir`` + ``repo.name``. + In case of a relative path name ``kas_work_dir`` is prepended. * ``layers``: dict [optional] Contains the layers from this repository that should be added to the diff --git a/kas/repos.py b/kas/repos.py index 0d96ab4..519ed6c 100644 --- a/kas/repos.py +++ b/kas/repos.py @@ -96,7 +96,12 @@ class Repo: url = path disable_operations = True else: - path = path or os.path.join(config.kas_work_dir, name) + if path is None: + path = os.path.join(config.kas_work_dir, name) + else: + if not os.path.isabs(path): + # Relative pathes are assumed to start from work_dir + path = os.path.join(config.kas_work_dir, path) if typ == 'git': return GitRepo(url, path, refspec, layers, disable_operations)