West doesn't find extension commands when run in a workspace without additional modules
Describe the bug
When running west within a workspace that only contains zephyr and no additional modules, west doesn't find the extension commands in /scripts/west_commands.yml. E.g. 'zephyr-export.'
To Reproduce
- Initialise a workspace with a manifest that just contains zephyr and no additional modules: E.g. app/west.yml
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v4.0.0
west init -l app
west update
- Run west or one of the west extension commands
west helpwest zephyr-export
Expected behavior
West should be able to detect and run the extension commands in /zephyr
Impact
Annoyance
Logs and console output
west: unknown command "zephyr-export"; workspace {workspace_path} does not define this extension command -- try "west help" and "west -vv status"
Environment (please complete the following information):
- OS: Linux
- Toolchain: just Zephyr
- v4.0.0
You didn't import anything from the project, but you could add the west-commands entry manually
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v4.0.0
west-commands: scripts/west-commands.yml
Maybe the bug is that if you do something like
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v4.0.0
import:
name-allowlist:
- cmsis
The extension commands from Zephyr are added implicitly.
When running west within a workspace that only contains zephyr and no additional modules, west doesn't find the extension commands in /scripts/west_commands.yml.
The documentation could be clearer but I think extensions are not implicitly loaded:
https://docs.zephyrproject.org/4.0.0/develop/west/extensions.html
The extension commands from Zephyr are added implicitly.
This looks more like a bug, @pdgendt maybe file it and close this one?
Maybe the bug is that if you do something like
manifest: remotes: - name: zephyrproject-rtos url-base: https://github.com/zephyrproject-rtos projects: - name: zephyr remote: zephyrproject-rtos revision: v4.0.0 import: name-allowlist: - cmsisThe extension commands from Zephyr are added implicitly.
The documentation is a bit fuzzy but my interpretation is that using a mapping keyword like name-allowlist (or any of the other three import variants) merges that project's manifest with the parent manifest. The mapping filter only restrict which projects are imported from zephyr/west.yml. Because the extensions are sourced in self, they are added when the manifest is imported regardless of any restrictions imposed by any of the mapping filters.
Thanks @urob!
but my interpretation is that using a mapping keyword like name-allowlist (or any of the other three import variants) merges that project's manifest with the parent manifest.
name: zephyr; import: true also imports zephyr/scripts/west-commands.yml through zephyr/west.yml. I just tested it. import: false (the default) does not.
The mapping filter only restrict which projects are imported from zephyr/west.yml. Because the extensions are sourced in self, they are added when the manifest is imported regardless of any restrictions imposed by any of the mapping filters.
Yes, definitely looks like it!
The documentation is a bit fuzzy
I have not scanned every single line but it looks like there is indeed a documentation gap here.
It would also be good to check the source code to make sure this is all as intended but so far this all seems consistent.