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

Best known "de-initialization" method should be at least documented #593

Closed
marc-hb opened this issue Jul 25, 2022 · 6 comments
Closed

Best known "de-initialization" method should be at least documented #593

marc-hb opened this issue Jul 25, 2022 · 6 comments

Comments

@marc-hb
Copy link
Collaborator

marc-hb commented Jul 25, 2022

The only way currently is to remove the .west directory. However, instead of hard-coding the location, you may wish to consider using this API to find it: https://docs.zephyrproject.org/latest/develop/west/west-apis.html#west.util.west_dir

There's no explicit "de-" or "re-" initialization mechanism. We tried to design one during west's early days, and got into a bunch of internal arguments about what to do, then abandoned the idea until a compelling use case came along that would justify bringing it in again. Is this that time? If so, please file an issue.

Originally posted by @mbolivar-nordic in thesofproject/sof#6005 (comment)

@marc-hb
Copy link
Collaborator Author

marc-hb commented Jul 25, 2022

I don't know how "compelling" it is but the use case in sof#6005 above is: switching from zephyr/west.yml to sof/west.yml. Ignoring the particular SOF history that led to that situation, I think anyone who wants to switch to work on a specific Zephyr module and track its active development without having to shuffle git repositories around their hard drive could end in a similar "deinit" situation (depending on project specifics of course)

I can imagine switching from/to some "downstream" manifests is more or less the same requirement.

Anecdotal (e.g.: discord) evidence shows people currently achieve west "de-initialization" by simply deleting their .west/ directory. Short of a (future and?) more abstract and more official west deinit command, this best-known-so-far rm -rf .west/ method should be at least mentioned briefly in west's documentation.

@mbolivar-nordic
Copy link
Contributor

switching from zephyr/west.yml to sof/west.yml

So is this a case where you're switching back and forth? Or permanently switching one time?

Switching back and forth is already supported. You reconfigure manifest.path (and, if necessary, manifest.file) and run west update again. I could be a weasel and claim that this is documented here:

https://docs.zephyrproject.org/latest/develop/west/config.html#west-config-cmd

which, while technically true, is definitely not in a place where anyone looking for the answer to this question would look for it, so we can move that somewhere else if it's helpful.

Permanently switching one time would require deleting all of the repositories in the workspace, though, so that's a bit of an rm -rf zephyrprpoject, not an rm -rf zephyrproject/.west.

@marc-hb
Copy link
Collaborator Author

marc-hb commented Aug 19, 2022

So is this a case where you're switching back and forth? Or permanently switching one time?

In our case it was just once but I can imagine users wanting go switch back and forth - for instance between upstream and downstream?

so we can move that somewhere else if it's helpful.

I think some better visibility would not hurt. A pointer to this west config section would be enough. Maybe here or here:

Funny enough the last search does find the "Configuration" page but the extract is not relevant and misleading.

Permanently switching one time would require deleting all of the repositories in the workspace, though, so that's a bit of an rm -rf zephyrprpoject, not an rm -rf zephyrproject/.west.

I don't understand why you're making a difference between "back and forth" and "once". I believe the important difference is between "manifest switch" versus "de-initialization" (where the latter can provide an indirect solution for the former).

I also don't understand why de-initialization seems to require deleting all git repos. This is something we certainly did not want to ask our users to do and everything went fine. So you're saying west does not automatically pick up git clones already there, automagically adding the missing manifest-rev branch? In my experience it does. Is this an "accidental" feature that could disappear in the future?

@mbolivar-nordic
Copy link
Contributor

mbolivar-nordic commented Aug 26, 2022

So you're saying west does not automatically pick up git clones already there, automagically adding the missing manifest-rev branch?

No, I'm saying I don't know anything about the sof manifest, and there are edge cases. E.g. if foo/bar/ is a git repository in zephyr/west.yml and sof defines foo/bar/baz as a project, west will happily stick baz inside of bar without removing bar (if you switch from zephyr/west.yml to sof/west.yml).

@mbolivar-nordic
Copy link
Contributor

I think some better visibility would not hurt. A pointer to this west config section would be enough. Maybe here or here:

I'll add this to the v0.14 docs pr I'm working on, thanks.

@mbolivar-nordic
Copy link
Contributor

@marc-hb I'm going to close this one since west will tell the user how to do this when circumstances require:

msg = ("\n Hint: if you do not want a workspace there, \n"

I figured that would be better than documentation, since people are more likely to read error messages than docs. Please reopen if I didn't get your meaning.

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

2 participants