From 0c7db599fdf2fcdcb525cc31af8a23425ca10c3b Mon Sep 17 00:00:00 2001 From: Henning Schild Date: Fri, 5 Jan 2018 16:00:28 +0100 Subject: [PATCH] repos: introduce a new repo conf parameter "type" This will be used to carry the type of repo we are talking about. At the moment it defaults to "git". Signed-off-by: Henning Schild --- docs/format-changelog.rst | 9 +++++++++ kas/__version__.py | 2 +- kas/config.py | 6 ++++-- kas/configschema.py | 3 +++ kas/repos.py | 6 ++++-- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/format-changelog.rst b/docs/format-changelog.rst index 19b9e09..1315083 100644 --- a/docs/format-changelog.rst +++ b/docs/format-changelog.rst @@ -57,3 +57,12 @@ Added - ``env`` key now allows to pass custom environment variables to the bitbake build process. + +Version 7 +--------- + +Added +~~~~~ + +- ``type`` property to ``repos`` to be able to express which version control + system to use. diff --git a/kas/__version__.py b/kas/__version__.py index 4872fdc..6a13d0f 100644 --- a/kas/__version__.py +++ b/kas/__version__.py @@ -28,5 +28,5 @@ __copyright__ = 'Copyright (c) Siemens AG, 2017' __version__ = '0.15.0' # Please update docs/format-changelog.rst when changing the file version. -__file_version__ = 6 +__file_version__ = 7 __compatible_file_version__ = 1 diff --git a/kas/config.py b/kas/config.py index 710879d..a199532 100644 --- a/kas/config.py +++ b/kas/config.py @@ -187,6 +187,7 @@ class Config: layers_dict)) url = repo_config_dict[repo].get('url', None) name = repo_config_dict[repo].get('name', repo) + typ = repo_config_dict[repo].get('type', 'git') refspec = repo_config_dict[repo].get('refspec', None) path = repo_config_dict[repo].get('path', None) dis_ops = False @@ -204,8 +205,9 @@ class Config: else: path = path or os.path.join(self.kas_work_dir, name) - rep = Repo.factory(url=url, path=path, refspec=refspec, - layers=layers, disable_operations=dis_ops) + rep = Repo.factory(url=url, path=path, typ=typ, + refspec=refspec, layers=layers, + disable_operations=dis_ops) repo_dict[repo] = rep return repo_dict diff --git a/kas/configschema.py b/kas/configschema.py index 2d1e2ab..292a497 100644 --- a/kas/configschema.py +++ b/kas/configschema.py @@ -114,6 +114,9 @@ CONFIGSCHEMA = { 'url': { 'type': 'string', }, + 'type': { + 'type': 'string', + }, 'refspec': { 'type': 'string', }, diff --git a/kas/repos.py b/kas/repos.py index ea6b263..052b770 100644 --- a/kas/repos.py +++ b/kas/repos.py @@ -69,12 +69,14 @@ class Repo: self.path, self._layers) @staticmethod - def factory(url, path, refspec, layers, disable_operations): + def factory(url, path, typ, refspec, layers, disable_operations): """ Return an instance Repo depending on params. """ # pylint: disable=too-many-arguments - return GitRepo(url, path, refspec, layers, disable_operations) + if typ == 'git': + return GitRepo(url, path, refspec, layers, disable_operations) + raise NotImplementedError('Repo typ "%s" not supported.' % typ) @staticmethod def get_root_path(path, environ):