repos: refactor repo path calculation
Refactored repo path calculation eliminates duplicated code and aligns the matching logic (with respect to url and path) with the documentation. Signed-off-by: Silvano Cirujano Cuesta <silvano.cirujano-cuesta@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
1f1a21992d
commit
0892b37ad6
21
kas/repos.py
21
kas/repos.py
@ -114,26 +114,21 @@ class Repo:
|
||||
path = repo_config.get('path', None)
|
||||
disable_operations = False
|
||||
|
||||
if url is None:
|
||||
# No version control operation on repository
|
||||
if path is None:
|
||||
if path is None:
|
||||
if url is None:
|
||||
path = Repo.get_root_path(repo_fallback_path)
|
||||
logging.info('Using %s as root for repository %s', path,
|
||||
name)
|
||||
else:
|
||||
if not os.path.isabs(path):
|
||||
# Relative pathes are assumed to start from work_dir
|
||||
path = os.path.join(get_context().kas_work_dir, path)
|
||||
path = os.path.join(get_context().kas_work_dir, name)
|
||||
elif not os.path.isabs(path):
|
||||
# Relative pathes are assumed to start from work_dir
|
||||
path = os.path.join(get_context().kas_work_dir, path)
|
||||
|
||||
if url is None:
|
||||
# No version control operation on repository
|
||||
url = path
|
||||
disable_operations = True
|
||||
else:
|
||||
if path is None:
|
||||
path = os.path.join(get_context().kas_work_dir, name)
|
||||
else:
|
||||
if not os.path.isabs(path):
|
||||
# Relative pathes are assumed to start from work_dir
|
||||
path = os.path.join(get_context().kas_work_dir, path)
|
||||
|
||||
if typ == 'git':
|
||||
return GitRepo(name, url, path, refspec, layers, patches,
|
||||
|
Loading…
Reference in New Issue
Block a user