diff --git a/docs/format-changelog.rst b/docs/format-changelog.rst index 23c5380..bc7d24d 100644 --- a/docs/format-changelog.rst +++ b/docs/format-changelog.rst @@ -130,3 +130,11 @@ Added - Variables used in the ``env`` section can now be assigned 'None' as value. In this case the variables are only exported to the bb env whitelist. + +Version 14 +---------- + +Added +~~~~~ + +- The ``overrides`` top-level entry can be used to pin floating repo refspecs. diff --git a/docs/userguide.rst b/docs/userguide.rst index b72dbb1..a6b1c5b 100644 --- a/docs/userguide.rst +++ b/docs/userguide.rst @@ -455,6 +455,22 @@ Configuration reference * ``path``: string [required] The path to one patch file or a quilt formatted patchset directory. +* ``overrides``: dict [optional] + This object provides a mechanism to override kas configuration items + without defining them. By that, only items that already exist are + overridden. Note, that all entries below this key are reserved for + auto-generation using kas plugins. Do not manually add entries. + + * ``repos``: dict [optional] + Mapps to the top-level ``repos`` entry. + + * ````: dict [optional] + Mapps to the ```` entry. + + * ``refspec``: string [optional] + Pinned refspec which overrides the ``refspec`` of the corresponding + repo. This refspec must be resolved (i.e. no branch or tag name). + * ``bblayers_conf_header``: dict [optional] This contains strings that should be added to the ``bblayers.conf`` before any layers are included. diff --git a/kas/__version__.py b/kas/__version__.py index 05ca12b..5f16121 100644 --- a/kas/__version__.py +++ b/kas/__version__.py @@ -28,5 +28,5 @@ __copyright__ = 'Copyright (c) Siemens AG, 2017-2020' __version__ = '3.2.3' # Please update docs/format-changelog.rst when changing the file version. -__file_version__ = 13 +__file_version__ = 14 __compatible_file_version__ = 1 diff --git a/kas/config.py b/kas/config.py index 091e727..b3eb311 100644 --- a/kas/config.py +++ b/kas/config.py @@ -104,11 +104,14 @@ class Config: `name`. """ repo_defaults = self._config.get('defaults', {}).get('repos', {}) + overrides = self._config.get('overrides', {}) \ + .get('repos', {}).get(name, {}) config = self.get_repos_config()[name] or {} return Repo.factory(name, config, repo_defaults, - self.top_repo_path) + self.top_repo_path, + overrides) def _get_repo_dict(self): """ diff --git a/kas/repos.py b/kas/repos.py index cfec816..410e290 100644 --- a/kas/repos.py +++ b/kas/repos.py @@ -90,7 +90,8 @@ class Repo: self.path, self._layers) @staticmethod - def factory(name, repo_config, repo_defaults, repo_fallback_path): + def factory(name, repo_config, repo_defaults, repo_fallback_path, + repo_overrides={}): """ Returns a Repo instance depending on params. """ @@ -119,8 +120,8 @@ class Repo: url = repo_config.get('url', None) name = repo_config.get('name', name) typ = repo_config.get('type', 'git') - refspec = repo_config.get('refspec', - repo_defaults.get('refspec', None)) + refspec = repo_overrides.get('refspec', repo_config.get('refspec', + repo_defaults.get('refspec', None))) if refspec is None and url is not None: logging.error('No refspec specified for repository "%s". This is ' 'only allowed for local repositories.', name) diff --git a/kas/schema-kas.json b/kas/schema-kas.json index 6775463..77072e7 100644 --- a/kas/schema-kas.json +++ b/kas/schema-kas.json @@ -89,6 +89,24 @@ } } }, + "overrides": { + "type": "object", + "additionalProperties": false, + "properties": { + "repos": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "properties": { + "refspec" : { + "type": "string" + } + } + } + } + } + }, "machine": { "type": "string" },