west manifest: forbid --freeze/--resolve + manifest.project-filter

Internal discussion at Nordic indicates that the semantics for 'west
manifest --resolve' should probably be something along the lines of
"resolve the manifest but ignore the value of manifest.project-filter,
and print the resolved result". This is consistent with the way that
these commands are not affected by the value of manifest.group-filter.

However, we don't have a way to support this right now: west.manifest
has no API for loading itself but with manifest.project-filter
ignored. Such an API would be straightforward to add, but we don't
have time for that right now, as we're under time pressure to add
support for this option to resolve an issue during the zephyr v3.4
stabilization period.

For now, work around the issue by just erroring out if the option is
set at all, telling the user that they can get in touch with us
if they need this. We'll let the level of noise that results be
our guide in prioritizing this enhancement.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2023-05-31 16:51:28 -07:00 committed by Carles Cufí
parent 9e41f68791
commit 9f551ef273
1 changed files with 9 additions and 0 deletions

View File

@ -552,8 +552,10 @@ class ManifestCommand(_ProjectCommand):
if args.validate:
pass # nothing more to do
elif args.resolve:
self._die_if_manifest_project_filter('resolve')
self._dump(args, manifest.as_yaml(**dump_kwargs))
elif args.freeze:
self._die_if_manifest_project_filter('freeze')
self._dump(args, manifest.as_frozen_yaml(**dump_kwargs))
elif args.path:
self.inf(manifest.path)
@ -561,6 +563,13 @@ class ManifestCommand(_ProjectCommand):
# Can't happen.
raise RuntimeError(f'internal error: unhandled args {args}')
def _die_if_manifest_project_filter(self, action):
if self.config.get('manifest.project-filter') is not None:
self.die(f'"west manifest --{action}" is not (yet) supported '
'when the manifest.project-filter option is set. '
'Please contact the west developers if you have a '
'use case for this.')
def _dump(self, args, to_dump):
if args.out:
with open(args.out, 'w') as f: