diff options
author | Jürg Billeter <j@bitron.ch> | 2020-02-06 08:49:28 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-02-11 21:07:39 +0100 |
commit | 2d0ef3aa9edb9794ac79abda98e6350efbee8b57 (patch) | |
tree | 7821528e6abc47da42dfa917c797450e75ce98d3 /src | |
parent | 2ddcc45138adaabd4b9c81d96c859c76794978bc (diff) | |
download | buildstream-2d0ef3aa9edb9794ac79abda98e6350efbee8b57.tar.gz |
_workspaces.py: Increment format version, drop support for old versions
Do not accept old versions as bst 1.x workspaces do not separate source
and build files.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_workspaces.py | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/buildstream/_workspaces.py b/src/buildstream/_workspaces.py index 478b7d3b5..3035411d6 100644 --- a/src/buildstream/_workspaces.py +++ b/src/buildstream/_workspaces.py @@ -21,12 +21,11 @@ import os from . import utils from . import _yaml -from .node import MappingNode, ScalarNode from ._exceptions import LoadError from .exceptions import LoadErrorReason -BST_WORKSPACE_FORMAT_VERSION = 3 +BST_WORKSPACE_FORMAT_VERSION = 4 BST_WORKSPACE_PROJECT_FORMAT_VERSION = 1 WORKSPACE_PROJECT_FILE = ".bstproject.yaml" @@ -511,38 +510,17 @@ class Workspaces: "Format version is not an integer in workspace configuration", LoadErrorReason.INVALID_DATA ) - if version == 0: - # Pre-versioning format can be of two forms - for element, config in workspaces.items(): - config_type = type(config) - - if config_type is ScalarNode: - pass - - elif config_type is MappingNode: - sources = list(config.values()) - if len(sources) > 1: - detail = ( - "There are multiple workspaces open for '{}'.\n" - + "This is not supported anymore.\n" - + "Please remove this element from '{}'." - ) - raise LoadError(detail.format(element, self._get_filename()), LoadErrorReason.INVALID_DATA) - - workspaces[element] = sources[0] - - else: - raise LoadError("Workspace config is in unexpected format.", LoadErrorReason.INVALID_DATA) - - res = { - element: Workspace(self._toplevel_project, path=config.as_str()) - for element, config in workspaces.items() - } + if version < 4: + # bst 1.x workspaces do not separate source and build files. + raise LoadError( + "Workspace configuration format version {} not supported." + "Please recreate this workspace.".format(version), + LoadErrorReason.INVALID_DATA, + ) - elif 1 <= version <= BST_WORKSPACE_FORMAT_VERSION: + if 4 <= version <= BST_WORKSPACE_FORMAT_VERSION: workspaces = workspaces.get_mapping("workspaces", default={}) res = {element: self._load_workspace(node) for element, node in workspaces.items()} - else: raise LoadError( "Workspace configuration format version {} not supported." |