Skip to content

Commit ed61320

Browse files
committed
manifest: clarify schema version check with cosmetic renames
As found in the review of zephyrproject-rtos#904 (migration from pkwalify to jsonschema), the schema version check can be confusing. - Add a couple sentences in MAINTAINERS.rst to clearly state what this version check actually performs and achieves and when (not) to bump the version. - Rename "min_version" to "manifest_version" and swap the perspective "min" and "max" are relative terms, ambiguous when losing track of the point of view. "min_version" stood for "minimum_west_version_needed_to_read_this_manifest". But this is the manifest perspective, which is confusing when reading west code which is the opposite point of view. A given _version_ of west code is never going to change when reading it or running it! So, flip the perspective and look at things from the west point of view when in the west code: rename the also vague _SCHEMA_VER to _MAX_SUPPORTED_SCHEMA_VER. Signed-off-by: Marc Herbert <[email protected]>
1 parent ed868f7 commit ed61320

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

MAINTAINERS.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,15 @@ Summary of what happens:
144144
Decide if west.manifest.SCHEMA_VERSION needs an update:
145145

146146
- SCHEMA_VERSION should be updated to X.Y if release vX.Y will have manifest
147-
syntax changes that earlier versions of west cannot parse.
147+
syntax changes that earlier versions of west cannot parse. The version
148+
check causes earlier west versions to abort and forces users to upgrade
149+
west to use manifests with new syntax or features.
148150

149151
- SCHEMA_VERSION should *not* be changed for west vX.Y if the manifest
150-
syntax is fully compatible with what west vX.(Y-1) can handle.
152+
syntax is fully compatible with what west vX.(Y-1) can handle. This would
153+
force some users to upgrade west unnecessarily when trying to use
154+
manifests wrongly presenting themselves as using new syntax/features that
155+
have not actually changed.
151156

152157
If you want to change SCHEMA_VERSION, send this as a pull request to the
153158
main branch and get it reviewed and merged. (This requires a PR and review

src/west/manifest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#: Git ref space used by west for internal purposes.
5252
QUAL_REFS_WEST = 'refs/west/'
5353

54-
#: The latest manifest schema version supported by this west program.
54+
#: The highest manifest schema version supported by this west version.
5555
#:
5656
#: This value will change whenever a new version of west includes new
5757
#: manifest file features not supported by earlier versions of west.
@@ -204,7 +204,7 @@ class _defaults(NamedTuple):
204204
_DEFAULT_REV = 'master'
205205
_WEST_YML = 'west.yml'
206206
_SCHEMA_PATH = os.path.join(os.path.dirname(__file__), "manifest-schema.yml")
207-
_SCHEMA_VER = parse_version(SCHEMA_VERSION)
207+
_MAX_SUPPORTED_SCHEMA_VER = parse_version(SCHEMA_VERSION)
208208
_EARLIEST_VER_STR = '0.6.99' # we introduced the version feature after 0.6
209209
_VALID_SCHEMA_VERS = [
210210
_EARLIEST_VER_STR,
@@ -616,17 +616,17 @@ def validate(data: Any) -> dict[str, Any]:
616616
#
617617
# version: 0.8
618618
if not isinstance(data['version'], str):
619-
min_version_str = str(data['version'])
619+
manifest_version_str = str(data['version'])
620620
casted_to_str = True
621621
else:
622-
min_version_str = data['version']
622+
manifest_version_str = data['version']
623623
casted_to_str = False
624624

625-
min_version = parse_version(min_version_str)
626-
if min_version > _SCHEMA_VER:
627-
raise ManifestVersionError(min_version_str)
628-
if min_version_str not in _VALID_SCHEMA_VERS:
629-
msg = f'invalid version {min_version_str}; must be one of: ' + ', '.join(
625+
manifest_version = parse_version(manifest_version_str)
626+
if manifest_version > _MAX_SUPPORTED_SCHEMA_VER:
627+
raise ManifestVersionError(manifest_version_str)
628+
if manifest_version_str not in _VALID_SCHEMA_VERS:
629+
msg = f'invalid version {manifest_version_str}; must be one of: ' + ', '.join(
630630
_VALID_SCHEMA_VERS
631631
)
632632
if casted_to_str:

0 commit comments

Comments
 (0)