question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: Clean workspace command and/or update option

See original GitHub issue

I have on multiple occasions had trouble compiling applications after checking out different versions and west updateing 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:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mbolivarcommented, Sep 26, 2019

My first instincts are against this feature request.

  • west forall -c "git clean -fdx" (or a similar command like west forall -c "git reset --hard HEAD") is enough to clean out every repository west does know about. In general, I want to encourage use of forall for special purposes, keeping the number of built-in commands limited to “very common” use cases like diff and status.
  • I would be pretty terrified to introduce a built-in west command that walked the entire installation to find git repositories it didn’t know about and just deleted them.
  • With a clean build directory, zephyr won’t use any repositories that aren’t managed by west, as ZEPHYR_MODULES is (by default) initialized using west list, and ZEPHYR_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:

diff -u <(west list -f {abspath} | sort) <(find $PWD -name .git -type d | sed 's/\/\.git//' | sort)

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.

1reaction
mbolivarcommented, Oct 11, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspace Cleanup - Jenkins Plugins
This plugin deletes the project workspace when invoked.
Read more >
99.xml - SAP Community
... monthly 0.1 https://answers.sap.com/questions/5940531/want-to-know-rfc-of- ... questions/5773535/save-status-when-adding-carc-link-under-object-lin.html ...
Read more >
sitemap-question-1.xml - Cisco Learning Network
... -ospf-router-subcommand-to-protect-router-memory 2022-12-14T15:33:24.000Z ... .cisco.com/s/question/0D53i00000Kt1tZCAR/updated-ccnp-switch-lab-manual-v7 ...
Read more >
pact-jvm
pact jvm is having multiple option, which is confussing ... You'll have to check the HTTP RFC on the DELETE method, but I...
Read more >
Is there any way to cleanup Jenkins workspace?
First, install Workspace Cleanup Plugin. To clean up the workspace before build: Under Build Environment, check the box that says Delete workspace before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found