summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-01 20:44:46 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-02 22:39:10 +0000
commit8ecade388edec105d88b1fa6b2c5f30fea42dc24 (patch)
treef8fd2fff07819ab6be3231be129a51ff22bd6d2f
parenta50a0733b83f4247e45b764903971cccf061b5d6 (diff)
downloadchrome-ec-8ecade388edec105d88b1fa6b2c5f30fea42dc24.tar.gz
zephyr: zmake: Only support one Zephyr version per project
Change the per-project config to support only one Zephyr version per project. If a project is supporting multiple versions, it can do so by registering multiple projects. BUG=b:193815337 BRANCH=none TEST=unit tests pass Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iee900ad359a657caa0ef85cef88c17414cabfef6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3256036 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--zephyr/zmake/tests/test_project.py6
-rw-r--r--zephyr/zmake/tests/test_toolchains.py2
-rw-r--r--zephyr/zmake/tests/test_version.py2
-rw-r--r--zephyr/zmake/tests/test_zmake.py2
-rw-r--r--zephyr/zmake/zmake/project.py4
-rw-r--r--zephyr/zmake/zmake/zmake.py9
6 files changed, 10 insertions, 15 deletions
diff --git a/zephyr/zmake/tests/test_project.py b/zephyr/zmake/tests/test_project.py
index 266a6cb6f0..2797a1bc92 100644
--- a/zephyr/zmake/tests/test_project.py
+++ b/zephyr/zmake/tests/test_project.py
@@ -58,7 +58,7 @@ def test_find_dts_overlays(modules):
zephyr_board=board,
output_packer=zmake.output_packers.ElfPacker,
supported_toolchains=["llvm"],
- supported_zephyr_versions=["v2.7"],
+ zephyr_version="v2.7",
project_dir=pathlib.Path("/fakebuild"),
)
)
@@ -93,7 +93,7 @@ def test_prune_modules(modules):
zephyr_board="native_posix",
output_packer=zmake.output_packers.ElfPacker,
supported_toolchains=["coreboot-sdk"],
- supported_zephyr_versions=["v2.7"],
+ zephyr_version="v2.7",
project_dir=pathlib.Path("/fake"),
modules=modules,
),
@@ -116,7 +116,7 @@ def test_prune_modules_unavailable():
zephyr_board="native_posix",
output_packer=zmake.output_packers.ElfPacker,
supported_toolchains=["coreboot-sdk"],
- supported_zephyr_versions=["v2.7"],
+ zephyr_version="v2.7",
project_dir=pathlib.Path("/fake"),
modules=["hal_stm32", "cmsis"],
),
diff --git a/zephyr/zmake/tests/test_toolchains.py b/zephyr/zmake/tests/test_toolchains.py
index 86d87272c4..09d37c4c4e 100644
--- a/zephyr/zmake/tests/test_toolchains.py
+++ b/zephyr/zmake/tests/test_toolchains.py
@@ -66,7 +66,7 @@ def fake_project(tmp_path):
project.ProjectConfig(
project_name="foo",
zephyr_board="foo",
- supported_zephyr_versions=["v2.6"],
+ zephyr_version="v2.6",
supported_toolchains=[
"coreboot-sdk",
"host",
diff --git a/zephyr/zmake/tests/test_version.py b/zephyr/zmake/tests/test_version.py
index 0550eb4ce1..cbc1ceff88 100644
--- a/zephyr/zmake/tests/test_version.py
+++ b/zephyr/zmake/tests/test_version.py
@@ -57,7 +57,7 @@ def _setup_example_repos(tmp_path):
zephyr_board="foo",
output_packer=zmake.output_packers.RawBinPacker,
supported_toolchains=["coreboot-sdk"],
- supported_zephyr_versions=["v2.6"],
+ zephyr_version="v2.6",
project_dir=project_path,
),
)
diff --git a/zephyr/zmake/tests/test_zmake.py b/zephyr/zmake/tests/test_zmake.py
index 89be16e82e..589ee72c66 100644
--- a/zephyr/zmake/tests/test_zmake.py
+++ b/zephyr/zmake/tests/test_zmake.py
@@ -39,7 +39,7 @@ class FakeProject:
project_name="fakeproject",
zephyr_board="fakeboard",
supported_toolchains=["llvm"],
- supported_zephyr_versions=["v2.5"],
+ zephyr_version="v2.5",
output_packer=zmake.output_packers.ElfPacker,
project_dir=pathlib.Path("FakeProjectDir"),
)
diff --git a/zephyr/zmake/zmake/project.py b/zephyr/zmake/zmake/project.py
index 0fa7bf36b7..60f2ecf6ec 100644
--- a/zephyr/zmake/zmake/project.py
+++ b/zephyr/zmake/zmake/project.py
@@ -91,9 +91,7 @@ class ProjectConfig:
zephyr_board: str
supported_toolchains: "list[str]"
output_packer: type
- supported_zephyr_versions: "list[str]" = dataclasses.field(
- default_factory=lambda: ["v2.7"],
- )
+ zephyr_version: str = dataclasses.field(default="v2.7")
modules: "list[str]" = dataclasses.field(
default_factory=lambda: modules.known_modules,
)
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index a393b1c3e8..becc201c64 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -252,18 +252,15 @@ class Zmake:
coverage=False,
):
"""Set up a build directory to later be built by "zmake build"."""
- supported_versions = [
- util.parse_zephyr_version(v)
- for v in project.config.supported_zephyr_versions
- ]
- zephyr_base = self.locate_zephyr_base(max(supported_versions)).resolve()
+ supported_version = util.parse_zephyr_version(project.config.zephyr_version)
+ zephyr_base = self.locate_zephyr_base(supported_version).resolve()
# Ignore the patchset from the Zephyr version.
zephyr_version = util.read_zephyr_version(zephyr_base)[:2]
if (
not ignore_unsupported_zephyr_version
- and zephyr_version not in supported_versions
+ and zephyr_version != supported_version
):
raise ValueError(
"The Zephyr OS version (v{}.{}) is not supported by the "