RFC: Clean workspace command and/or update option
See original GitHub issueI have on multiple occasions had trouble compiling applications after checking out different versions and west update
ing our multi-repo downstream (nRF Connect SDK), because of leftover repos and files. It has been fixable by deleting all the repos except the manifest repo, and running west update
. This is especially prominent when using a single workspace and jumping significantly forward/backward in time.
I propose we introduce a west clean
command that approximates a fresh workspace, without re-downloading all the repos. The steps could be:
- Remove repos/folders not in the manifest (potentially even moving them to a caching folder)
- Run
git clean -fdx
in each project folder.
Alternatively – or complementarily – adding this functionality as an option in west update
could be useful. Then, west update --clean
could be used to bring the rest of the workspace in line with the manifest repo with a single command.
There are several points of discussion, including but probably not limited to:
- Do we even bother?
- Is there some detail about the west/manifest/repo structure that makes implementing this impractical?
- Do we call it
clean
,reset
or something else
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
My first instincts are against this feature request.
west forall -c "git clean -fdx"
(or a similar command likewest forall -c "git reset --hard HEAD"
) is enough to clean out every repository west does know about. In general, I want to encourage use offorall
for special purposes, keeping the number of built-in commands limited to “very common” use cases likediff
andstatus
.ZEPHYR_MODULES
is (by default) initialized usingwest list
, andZEPHYR_EXTRA_MODULES
defaults to the empty list (refer to the zephyr docs for more info on these)For Linux users (macOS ought to work too, unless its BSD
find
doesn’t support some of the flags used here), here is a shell one-liner you can run to compare the git repositories west knows about with all the other ones inside the same workspace:You need to run it from the top level directory in the installation.
I can come up with a Windows equivalent if there’s interest.
@bjda please reopen if you can post some specific examples of incorrect behavior. In the meantime, I believe
west forall
plus the way that zephyr’s build system uses west in a pristine build directory address your concerns.