diff options
author | Tristan Maat <tm@tlater.net> | 2018-03-16 13:27:42 +0000 |
---|---|---|
committer | Tristan Maat <tm@tlater.net> | 2018-03-16 14:55:30 +0000 |
commit | 33d56425963609e536f6f9d0458eecc737600a6f (patch) | |
tree | 8564f1dca3fad983f19a125aac6ce76e2aa82d8c | |
parent | 90491b1479febe563f00dfb7855f599e18efed43 (diff) | |
download | buildstream-33d56425963609e536f6f9d0458eecc737600a6f.tar.gz |
_project.py: Add stricter version checks
-rwxr-xr-x[-rw-r--r--] | buildstream/_project.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py index 9d3b7d643..70c0a079f 100644..100755 --- a/buildstream/_project.py +++ b/buildstream/_project.py @@ -460,9 +460,9 @@ class Project(): # def _ensure_workspace_config_format(self): needs_rewrite = False - version = _yaml.node_get(self._workspaces, int, "version", default_value=0) - if "version" not in self._workspaces: + + if version == 0: # Pre-versioning format can be of two forms for element, config in _yaml.node_items(self._workspaces): if isinstance(config, str): @@ -485,8 +485,6 @@ class Project(): raise LoadError(LoadErrorReason.INVALID_DATA, "Workspace config is in unexpected format.") - version = _yaml.node_get(self._workspaces, int, "version", default_value=0) - if version < 1: self._workspaces = { element: {"path": config} for element, config in _yaml.node_items(self._workspaces) @@ -494,6 +492,15 @@ class Project(): self._workspaces["version"] = 1 needs_rewrite = True + elif version == 1: + pass + + else: + raise LoadError(LoadErrorReason.INVALID_DATA, + "Workspace configuration format version {} not supported." + "Your version of buildstream may be too old. Max supported version: {}" + .format(version, 1)) + if needs_rewrite: self._save_workspace_config() |