From e27dffd2e5003020e7cad13160b4f5311898ceba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Thu, 12 Sep 2019 12:56:09 +0100 Subject: Fail if we try to build a BST_FORMAT_VERSION we do not support anymore bst-1.x support BST_FORMAT_VERSION == 17, as that is not supported by master I think is ok to set BST_FORMAT_VERSION_MIN = 18 --- doc/examples/autotools/project.conf | 2 +- doc/examples/developing/project.conf | 2 +- doc/examples/first-project/project.conf | 2 +- doc/examples/integration-commands/project.conf | 2 +- doc/examples/junctions/autotools/project.conf | 2 +- doc/examples/junctions/project.conf | 2 +- doc/examples/running-commands/project.conf | 2 +- doc/source/format_project.rst | 2 +- src/buildstream/_project.py | 8 ++++++++ src/buildstream/_versions.py | 6 ++++++ src/buildstream/data/projectconfig.yaml | 4 ++-- tests/frontend/workspaced-build-dep/project.conf | 2 +- tests/frontend/workspaced-runtime-dep/project.conf | 2 +- 13 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/examples/autotools/project.conf b/doc/examples/autotools/project.conf index 96e0284e0..6c1142340 100644 --- a/doc/examples/autotools/project.conf +++ b/doc/examples/autotools/project.conf @@ -2,7 +2,7 @@ name: autotools # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/developing/project.conf b/doc/examples/developing/project.conf index 1ae2e08be..3b0920991 100644 --- a/doc/examples/developing/project.conf +++ b/doc/examples/developing/project.conf @@ -2,7 +2,7 @@ name: developing # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/first-project/project.conf b/doc/examples/first-project/project.conf index 2182d35a1..2e3d086b1 100644 --- a/doc/examples/first-project/project.conf +++ b/doc/examples/first-project/project.conf @@ -2,7 +2,7 @@ name: first-project # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/integration-commands/project.conf b/doc/examples/integration-commands/project.conf index 9ae5b2a3c..c6c59906b 100644 --- a/doc/examples/integration-commands/project.conf +++ b/doc/examples/integration-commands/project.conf @@ -2,7 +2,7 @@ name: integration-commands # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/junctions/autotools/project.conf b/doc/examples/junctions/autotools/project.conf index 2cf58245d..216816335 100644 --- a/doc/examples/junctions/autotools/project.conf +++ b/doc/examples/junctions/autotools/project.conf @@ -2,7 +2,7 @@ name: autotools # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/junctions/project.conf b/doc/examples/junctions/project.conf index 7f8ca6a38..cb9a83716 100644 --- a/doc/examples/junctions/project.conf +++ b/doc/examples/junctions/project.conf @@ -2,7 +2,7 @@ name: junctions # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/examples/running-commands/project.conf b/doc/examples/running-commands/project.conf index 7127b0db9..aafb6a9f2 100644 --- a/doc/examples/running-commands/project.conf +++ b/doc/examples/running-commands/project.conf @@ -2,7 +2,7 @@ name: running-commands # Required BuildStream format version -format-version: 9 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/doc/source/format_project.rst b/doc/source/format_project.rst index c4988527a..85c97ddc0 100644 --- a/doc/source/format_project.rst +++ b/doc/source/format_project.rst @@ -54,7 +54,7 @@ the ``format-version`` field, e.g.: .. code:: yaml # The minimum base BuildStream format - format-version: 0 + format-version: 18 BuildStream will increment its core YAML format version at least once in any given minor point release where the format has been extended diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py index ceba4c44b..6ae8aa9db 100644 --- a/src/buildstream/_project.py +++ b/src/buildstream/_project.py @@ -39,6 +39,7 @@ from ._sourcefactory import SourceFactory from .types import CoreWarnings from ._projectrefs import ProjectRefs, ProjectRefStorage from ._versions import BST_FORMAT_VERSION +from ._versions import BST_FORMAT_VERSION_MIN from ._loader import Loader from .element import Element from .types import FastEnum @@ -590,6 +591,13 @@ class Project(): # Assert project's format version early, before validating toplevel keys format_version = pre_config_node.get_int('format-version') + if format_version < BST_FORMAT_VERSION_MIN: + major, minor = utils.get_bst_version() + raise LoadError( + "Project requested format version {}, but BuildStream {}.{} only supports format version {} or above." + "Use latest 1.x release" + .format(format_version, major, minor, BST_FORMAT_VERSION_MIN), LoadErrorReason.UNSUPPORTED_PROJECT) + if BST_FORMAT_VERSION < format_version: major, minor = utils.get_bst_version() raise LoadError( diff --git a/src/buildstream/_versions.py b/src/buildstream/_versions.py index 2270bc05a..ad749865d 100644 --- a/src/buildstream/_versions.py +++ b/src/buildstream/_versions.py @@ -25,6 +25,12 @@ # BST_FORMAT_VERSION = 25 +# The mimimum BuildStream format version supported +# +# This version is the minimum format version supported by the +# current buildstream version +# +BST_FORMAT_VERSION_MIN = 18 # The base BuildStream artifact version # diff --git a/src/buildstream/data/projectconfig.yaml b/src/buildstream/data/projectconfig.yaml index ee4055cf5..d84edbf92 100644 --- a/src/buildstream/data/projectconfig.yaml +++ b/src/buildstream/data/projectconfig.yaml @@ -4,8 +4,8 @@ # General configuration defaults # -# Require format version 0 -format-version: 0 +# Require format version 18 +format-version: 18 # Elements are found at the project root element-path: . diff --git a/tests/frontend/workspaced-build-dep/project.conf b/tests/frontend/workspaced-build-dep/project.conf index e017957da..48da02ff0 100644 --- a/tests/frontend/workspaced-build-dep/project.conf +++ b/tests/frontend/workspaced-build-dep/project.conf @@ -2,7 +2,7 @@ name: test # Required BuildStream format version -format-version: 12 +format-version: 18 # Subdirectory where elements are stored element-path: elements diff --git a/tests/frontend/workspaced-runtime-dep/project.conf b/tests/frontend/workspaced-runtime-dep/project.conf index e017957da..48da02ff0 100644 --- a/tests/frontend/workspaced-runtime-dep/project.conf +++ b/tests/frontend/workspaced-runtime-dep/project.conf @@ -2,7 +2,7 @@ name: test # Required BuildStream format version -format-version: 12 +format-version: 18 # Subdirectory where elements are stored element-path: elements -- cgit v1.2.1