zephyrproject-rtos/west

Provide a command line option for skipping unwanted portions of manifest

omkar3141 opened this issue · 3 comments

Doing a west update can consume a significant amount of time if there are many dependencies specified in the west.yml file. It will be really great to have a command line option to skip updates of certain repositories.

For example:
west update --skip "matter,homekit,liblc3codec,hal_st,other-unwanted-stuff"

Such an option should apply the filter to all nested manifest files (if any) and not just the top-level west.yml file.

Such commands can then be converted to shorthand aliases to quickly swap your checked-out repos depending on the projects being worked on. This can also help save some amount of disk space.

Feels like a duplicate of

See also

Short story, I thought about it and it's likely to be nontrivial.

If I'm going to do this, it would need to be prioritized against other ongoing work. If someone else is going to do this, they will need to become very familiar with the internal APIs related to manifest imports and the way west starts up to be successful.

A quick sketch of the scope of changes from a short think over it are (note this is not a guarantee of scope of work, it's just an initial sketch):

  • in the presence of this feature, we can't count on a complete workspace, so all commands which require a manifest to work would need to be revisited and correct semantics decided upon (e.g. if I do west init + west update --skip foo + west list, and 'foo' has some imports in it, the manifest will fail to load and west list won't have all the information it needs to do its job. Should it fail? Do we want something else? Etc.)
  • if --skip is given during west update, the command needs to assume that the manifest loaded at startup failed (for the reason above), and anyway needs to resolve the manifest again with ImportFlag.FORCE_PROJECTS set
  • in the main loop which updates projects we've resolved already, we can just skip them, that's easy
  • but then in the internal importer callback that we forced with FORCE_PROJECTS, check and see if the given project is in the skip list, and skip it if so
  • but then what do we do for the projects that we would have updated recursively after resolving the import? we're skipping the project, so we may not even have the data locally on the file system, and so I think the only safe thing to do is that we also skip anything that would have been updated after the import was done and the imported data are available, but...
  • that would result in subtly different semantics! the problem is that if I skip project 'foo', and ordinarily 'foo' has an import which pulls in project 'bar', then i would have project 'bar' from 'foo'. But then if 'foo' has another 'sibling' project 'baz' in the same projects list, and 'baz' has an import which also brings in 'bar', then ordinarily we would NOT get 'bar' from 'baz', but we would start getting 'bar' from 'baz' in this scenario instead of from 'foo'. It is really not obvious to me that this is desirable.

TL;DR the whole thing would need to be thought over very carefully and a lot of tests would need to be written to validate the design

TL;DR the whole thing would need to be thought over very carefully and a lot of tests would need to be written to validate the design

... or we would need to limit the scope of the feature, e.g. "you can't skip a project update if the project has imports", something like that. Even then I'm not totally sure it's trivial.