Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

West doesn't find extension commands when run in a workspace without additional modules #772

Open
kieranwlc opened this issue Dec 6, 2024 · 5 comments

Comments

@kieranwlc
Copy link

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

  1. 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
  1. Run west or one of the west extension commands
    west help
    west 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
@pdgendt
Copy link
Collaborator

pdgendt commented Dec 6, 2024

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

@pdgendt
Copy link
Collaborator

pdgendt commented Dec 6, 2024

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.

@marc-hb
Copy link
Collaborator

marc-hb commented Dec 6, 2024

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?

@urob
Copy link

urob commented Dec 11, 2024

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.

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.

@marc-hb
Copy link
Collaborator

marc-hb commented Dec 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants