-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Multiple Git Repositories #6770
Comments
Options to achieve this goal:
Additional tools that achieve similar objectives:
|
Perhaps this is discussed already in other forums but why do we need to have multiple git repositories in first place? |
In my view, Zephyr already has multiple Git repositories. Examples: https://github.com/zephyrproject-rtos/zephyr At least zephyr and net-tools are already required to use many networking samples in Zephyr in important cases. Just as Zephyr's networking subsystem already benefits from multiple repositories, why would other areas not also potentially find this useful? |
I am not questioning this issue. I was just wondering the reasoning because the issue started to talk about requirements but was not describing the "why" part. |
@jukkar good point. Updated with the "why" part. We had this documented somewhere else. |
what also could be considered: e.g. at the moment zephr master is working with net-tools master, but there is no pinning at the moment to a specific version, like it would be with git submodules |
@locomuco definitely. net-tools can (and probably will) be part of the default manifest |
Relevant PR: #7338 |
@carlescufi @SebastianBoe @mbolivar Random brain dump below: In some previous discussion, people (can't remember who) said they'd prefer if One advantage of having a branch checked out is that IIRC, someone also said that rebasing on sync in Having a local branch leads to some tricky design decisions:
Detached HEAD might be simpler to implement and less "magic". No juggling with local branches. I have a prototype working for that (though there's probably a lot of robustness stuff to add). I could try to do the branch thing though and see if it runs into other trickiness. Another random thing I thought of: Might want to use "branch" instead of "revision" in Bit worried that we're reinventing the wheel here too. |
Hmz... maybe the sanest thing if we go for the branch thing would be to always switch over to it and then rebase ( Might be able to switch back to the previous location too, with |
This RFC adds manifest parsing and three basic commands (sync, diff, and status). More error checking needs to be added. This is mostly to get some feedback on the approach. There are some cases that turn tricky if you always keep a local branch to avoid a detached HEAD. I'm wondering if 'revision' is supposed to always point to a branch (as opposed to e.g. a SHA). SHAs would be more flexible, but make it even trickier to keep a local branch. I've written a bit in zephyrproject-rtos/zephyr#6770 as well. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This RFC adds manifest parsing and three basic commands (sync, diff, and status). More error checking needs to be added. This is mostly to get some feedback on the approach. There are some cases that turn tricky if you always keep a local branch to avoid a detached HEAD. I'm wondering if 'revision' is supposed to always point to a branch (as opposed to e.g. a SHA). SHAs would be more flexible, but make it even trickier to keep a local branch. I've written a bit in zephyrproject-rtos/zephyr#6770 as well. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This RFC adds manifest parsing and three basic commands (sync, diff, and status). More error checking needs to be added. This is mostly to get some feedback on the approach. There are some cases that turn tricky if you always keep a local branch to avoid a detached HEAD. I'm wondering if 'revision' is supposed to always point to a branch (as opposed to e.g. a SHA). SHAs would be more flexible, but make it even trickier to keep a local branch. I've written a bit in zephyrproject-rtos/zephyr#6770 as well. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This RFC adds manifest parsing and three basic commands (sync, diff, and status). More error checking needs to be added. This is mostly to get some feedback on the approach. There are some cases that turn tricky if you always keep a local branch to avoid a detached HEAD. I'm wondering if 'revision' is supposed to always point to a branch (as opposed to e.g. a SHA). SHAs would be more flexible, but make it even trickier to keep a local branch. I've written a bit in zephyrproject-rtos/zephyr#6770 as well. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This RFC adds manifest parsing and three basic commands (sync, diff, and status). More error checking needs to be added. This is mostly to get some feedback on the approach. There are some cases that turn tricky if you always keep a local branch to avoid a detached HEAD. I'm wondering if 'revision' is supposed to always point to a branch (as opposed to e.g. a SHA). SHAs would be more flexible, but make it even trickier to keep a local branch. I've written a bit in zephyrproject-rtos/zephyr#6770 as well. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
@marc-hb The thing is though that the submodules @carlescufi mentions fit that bill pretty niely - external vendor HALs, external cbor libs, mbedtls, etc. They're supposed to be more or less static in the context. As soon as you try to find a solution for subrepos that don't fit that description, you're flying very close to the sun and will probably, after much time and effort spent, find that you're running into the same design headaches that the guys behind repo/submodules ran into and couldn't find an elegant solution to. |
Hi @tautologyclub and thanks very much for your comments!
The devil is very much in the details here, I'm afraid. I encourage you to try fleshing out the "have it present some well-defined interface (such as a specific directory structure) that the build system can infer stuff from reliably" idea in detail for Zephyr. We certainly tried approaches like that (see #7338 for one example from one of Zephyr's core maintainers), and they all fell down in one use case or another. Some other comments follow.
I claim that this can't be done in a sane way when you're integrating repositories from multiple external sources without doing what this comment by @marc-hb proposes...
... which is exactly what we (my company, foundries.io, which has been helping a bit with west) has been doing with google repo in a Zephyr project for quite some time (about 2 years). We tried to push a similar approach upstream in west. It was dead on arrival as it was a dealbreaker for some users. We didn't learn this until quite late in the development cycle; recovering the design was a bit of a last minute roller coaster :).
("They're" above is referring to "vendor HALs, external cbor libs, mbedtls, etc.".) I disagree about this "supposed to be". I think it's far more common that users will want to mix and match one or two components but leave the rest mostly the same. I think having a manifest file like repo or west (or a DEPS file like chromium, etc.) makes this easier than alternatives I've seen. And I must say I don't agree with the idea we should just give up if we can't make them static as described here:
I certainly do feel that we've run into many of the same design headaches they have in the past year plus that we have been working on west and trying to gather requirements for and from Zephyr users. I suppose we'll see if we've missed any critical ones and our wings melt, or not. I am sure that the fun is far from over. I hope you wish us luck! |
Hi there @marc-hb:
Bootloader (and in particular, MCUboot) integration is a killer app for me personally. I've maintained some out of tree scripts for a while now that make it easier to build and flash Zephyr images that are child-loaded by MCUboot, and I can tell you from experience both using them myself and helping out members of my team that are less deeply invested in the details of the Zephyr build system than I am that it is really nice to have (especially since we are a remote work company across many timezones, simplicity of interface is a big win UX wise). A lot of the differences between boards and flashing mechanisms can be suitably abstracted away if you have a tool that understands not just the build system but also the details of flashing different zephyr boards with different backends. We (my company) are also working on some additional tooling for doing automated testing of a multi-repo tree across multiple boards and sample applications -- think shippable but real Zephyr hardware. West integration is a nice selling point as we can rely on the above and extend it. I would get it if that that feels like vaporware to you -- and, from what's available upstream, some of it is (though not all of it, as I've been steadily upstreaming the bootloader integration and plan on finishing the job this week once west is finally merged and part of the core workflow.) But I invite you to watch the space as there is real code somewhere in the haze :) |
Hi @pfalcon
Given your winky emoticon I am not sure whether you meant this as a joke, but I can assure you I am 100% sure that newt has nothing to do with it from where I am sitting. The features provided by the Android build system (the one in AOSP for building entire images, not the IDE ones for building apps) and tools like repo, fastboot, and adb are a much bigger design influence on me. |
"supposed" and "more or less" isn't good enough. To prove that git submodules are a good fit you'd have to know how every Zephyr project is organized, including closed-source projects and... future projects. Looking at https://docs.google.com/document/d/1HrrMZ11nULWoAv3mR70VxT6nB_I1qMytpnmxFcVPCpM the intention is to very clearly support more than one git repo actively developed at a time.
The high-level design of west-multirepo seems relatively close to Google's repo (at least much closer to it than to submodules). This does mean a fair amount of work but not rocket science either. So quite far from the sun ;-)
Google's repo may not always be "elegant" but it "does the job" - a massive amount of production work actually. Running into design headaches that have been already solved doesn't seem like a bad idea even if some of those solutions were not "elegant" and optimal. "Evolution not revolution"? Plus the ambition is (unfortunately...) limited to support only Zephyr for now. |
@marc-hb I'm sorry as I meant to reply to some of your other comments in my earlier response but I forgot and hit send. Rather than edit, I'll just add another comment here:
I do believe that "one stop shop" is not totally as vague as it seems on the surface :). For example, the ability to do things like, say, this:
is a win that a variety of tools on the PATH -- no matter how carefully named or documented -- will not be able to match in terms of discoverability and ease of use. I think there is a reason why
Yes. We are trying. I would love this to be generic and usable as a separate tool someday too, believe me, but it's just not practical for now. But we aren't losing sight of this. |
@marc-hb you are right about this. We basically started with a reimplementation of the minimal subset of google repo that we figured we could get away with, except:
If you watch this (by now very out of date) status update I gave on west to the zephyr TSC, you'll hear me admit that we tried to just use repo, but couldn't, mostly because of these issues, towards the end when I raced to recap the multirepo parts: https://www.youtube.com/watch?v=P6s0HSZAua8 At the end of the day, we had to change tack and incorporate some submodule-style features because the free-form way repo allows the individual repositories to vary did not meet the requirements of some zephyr users. |
This is in the issue description and needs an update |
Thanks for the response. Yeah, there's a bit of joke in every joke ;-). So, a case with MyNewt and its "newt" tool must be a coincidence then ;-). Well, seriously, all in one management tools are well-known pattern in bigger IT ("python setup.py" for all things modules in Python, Django's, etc. application frameworks' management tools (from starting an app to fishing in its database)). In embedded space Zephyr isn't the first either. MyNewt is an obvious affinity suspect, but then there're also mbedOS' yotta build/package management tool, and PlatformIO which is built on this concept. |
Fixed, thanks! |
Thanks @mbolivar for further commenting on the process that has led us here. I would like to further clarify what has already been said, especially given the latest feedback by @tautologyclub and @marc-hb: west has been designed around a set of requirements and needs from some of the contributors to the Zephyr project. In particular, and as is described in this issue and in the official west documentation, we have focused on being able to retrieve a subset of repositories without having to modify the upstream tree, on the ability to maintain downstream forks that replace a subset of repositories and on full support for Linux, macOS and Windows. There is a reason we are doing this, and it is exclusively related to trying to adapt to how the embedded world deals with software today. |
Id suggest adding another requirement:
|
This is the most clear and compelling core requirement and justification related to multi-repo support I've seen. It's also the first time I've seen it stated this way. I'm not entirely convinced that it couldn't have been satisfied with existing solutions, nor that it would withstand a rigorous validation process, but it does at least provide a basis for assessing potential solutions. However, it's long past the point of requirements specification: we have what we have and mighta/coulda/shoulda gets us nowhere. My intent is to give west a shot and if it proves to have problems work to resolve them, develop an alternative solution, or move on in some other way. |
Thanks, I will add this to the issue description then. |
Agreed, will add. |
Well, the key point is "mixing and matching", not "doing active development on". It's active development that becomes annoying when using submodules/repo. Cloning an external HAL and some helper libs that you don't intend to modify can surely not be seen as a nightmare using existing tools...?
Absolutely, not trying to bring you down - it's certainly odd that no one has managed to find a good solution to this problem given the wide audience and the awkwardness of all existing tools. What I'm trying to argue for is that perhaps your needs could be satisfied WITHOUT reinventing the wheel and instead wrapping existing wheels with some python :P |
Speaking personally as someone whose company chases tip on multiple projects and usually carries out of tree patches in forks of those repositories (that rebase regularly, because those patches make their way upstream often), I do intend to modify, frequently. So while I can see your point for the "doesn't change often" situation, I don't think it covers all the users.
Sure, and I understand that. As you've said, nobody seems to have a really good general solution to this problem, though. We're just scratching our own itch. To echo @carlescufi, this was definitely not our first choice. If I really believed existing tools could do the job, I would have advocated for them, but I don't believe that's the case. If that turns out to be a mistake, I'm all on board to learn from it and move on. But this is the best way forward that I can see right now. Thanks again for your feedback. |
Well, let me further argue. Here's the arguments against submodules:
I can't see how this holds if you allow the plumbing to be submodules but the porcelain to be
To reiterate, I can't see how submodules + thin wrapper doesn't accomodate requirements. |
To start (well, continue), this is a misconception. To use submodules, you don't need to add them to the main Zephyr repo. Anybody can add submodules to their fork/clone. Anybody can update to any revision of a submodule in their branch. Anybody can replace an existing submodule with something else. When they do 2 of the last actions, they expectedly will get a conflict when upstream also updates their submodule definition. To be fair, I dunno how conflict resolution is handled in that case, but I bet that in git 2019, it's done much better than in mytool-v0.NIH-beta. And of course, someone doesn't have to checkout all submodules. One can chose only those that needed. The whole subconscious idea here is that there must be something hard in git. It stems from those time when cvs-, at most svn-, familiar developer stood on the entrance of git. Eerie sounds and flickering. A year after, nothing's eerie in day to day git, but something must eerie must be lurking someone in the corner! Myth of frightening git submodules serves that role. The whole myth is based on mixing up "tracking and matching multiple projects is hard" with "git submodules are hard". That said, all this discussion is rather theoretic now, given that "west" was merged into the mainline. |
I think you missed my comment about submodules above, the one where I referred to real nights and real week-ends. Plus a few other thousands people sharing their real-world experience on the Internet. All too stupid to use submodules? Most likely! A "myth": certainly not. For git itself the best summary is this: https://stevebennett.me/2012/02/24/10-things-i-hate-about-git/ It describes perfectly my years of real-world experience as "the local git support desk" for real people across multiple projects, many of them actively (and of course wrongly) not interested in version control. Off-topic sorry. |
I've never wondered about the value of this type of tighter integration, sorry for any confusion. I don't know much about it but it seems to make a lot of sense to me. The only "integration" question I still have and that you haven't answer yet is very specific and unfortunately getting lost in other, vaguer discussions. The value that is really not obvious to me (yet?) is just the supposed "integration" of:
Making version control for Zephyr artificially specific to Zephyr actually makes me wonder about potentially negative value because it means implementing things like Continuous Integration for instance become potentially more Zephyr-specific too which means more work for a smaller community. For instance:
Very interesting! The output of west --help is very clearly split between TWO sections: 1. one for multirepo commands 2. the other section for the Zephyr-specific rest. This tends to show that these two sections could be TWO (not "a variety") separate tools for no usability or user-friendliness difference.
https://docs.docker.com/engine/reference/commandline/ has a fairly large number of commands but they're all (closely) related to managing images and containers and none of them deals with versioning. "docker history" is a log file and checkpointing system images is very far from versioning code edited by humans.
In other words and despite all the digital ink above I've seen no clear rationale yet for thinking too small. |
Here on github I see dozens of people having dozens of cases of not being able to rebase or fix merge conflict correctly. What does it tell us?
This? I thought this: https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/ , where a google employee explains the reasoning of creating ugly tools like "repo", though thru all that a confession rings along the lines of "the best thing we've come up with is one giant monorepo where we commit half of the world, flat". Of course, there're still sleepless nights for support staff - that's unavoidable part of enterprise software development. But at least git submodules can't be blamed. |
Code freeze for Zephyr v1.14 LTS is this Friday. We barely squeaked by getting west merged into master with a bunch of Zephyr-specific assumptions baked into it. We will be supporting LTS for over a year and west missing this deadline would have been a Big Problem. I'm all for generalizing the multi-repo pieces of it when we have time, but we just don't right now. And the haters implying we're too dumb to realize we should have been using submodules all along, or are afraid of git or something, may well be right. And there really are a variety of things in west which are zephyr specific.
Could we have cleanly separated these things into their own Zephyr-specific and generic portions, and uploaded the non-generic portions to PyPI in their own clean To all the requests for a generic tool, I think the only real response is "yes, we know, we'd like that too, all in good time if it's appropriate". I hope the above helps clarify why.
There isn't any documentation up for this yet (we're working on it) but the big idea here is that any repository can provide west extension commands and they will show up here. For details, see the comments in our manifest file pykwalify schema describing each project entry: https://github.com/zephyrproject-rtos/west/blob/master/src/west/manifest-schema.yml#L73 And the related schema for the files which each project which declares extension commands in the manifest must then provide: So this is in fact arbitrarily many extension commands from arbitrarily many repositories, as determined by the corporate user, SoC vendor, Zephyr downstream distributor, individual hacker, other random upstream project in the manifest (like They will all show up in a unified way in the We've been getting this "it's just two sets of commands" since the beginning, but it's really not, promise. Hopefully the above starts to make clear why. |
Thanks! This doesn't match the initial impression(s) the current documentation gave to me and probably others. On one hand I feel somewhat guilty we just pressured the west developers to justify and share all this while you were working hard on a still evolving implementation and trying to make a deadline. On the other hand I'm happy all these rationales and information were elaborated and shared here because not just the documentation about "how" but also the "why" is extremely important for features affecting the top-level user interface and workflows that much.
You bet! |
Absolutely. I am very committed to making that happen for v1.14. Just needed to get the code in first -- zephyr's release management policies make it possible to write documentation after code freeze, so there's a lot of documentation still to be written that unfortunately is just in the heads and meeting minutes of the people that have been working on this.
Thanks! I am glad this thread has been useful so far. I will CC you on any documentation PRs. Your feedback has been extremely helpful and I hope you will have time to look at the docs patches too. |
We've released v1.14 with west, so I'm closing this. |
Important: The west multi-repo model is discussed and tracked in this document
This issue covers splitting the current zephyr Git repository into multiple ones, and having a tool to manage multiple repositories and contribute to them.
Note: We have edited this issue's description in order to reflect the outcome of all the discussions and work that has taken place since the issue was first raised.
Motivation
Zephyr should avoid mixing external code with original code for the following reasons:
We have focused on being able to retrieve a subset of repositories without having to modify the upstream tree, on the ability to maintain downstream forks that replace a subset of repositories and on full support for Linux, macOS and Windows. There is a reason we are doing this, and it is exclusively related to trying to adapt to how the embedded world deals with software today.
It is of critical importance that, in a project that intends to provide a one-stop-shop solution for embedded development, we make it easy for distributors, silicon vendors and product developers to easily replace bits and pieces with proprietary software or forks of open source projects where required.
Requirements
Conclusion
We will use west, a Zephyr meta-tool to manage multiple repositories, using a manifest to define the set of repositories, their revisions and other metadata.
FAQ
Why a single tool?
It has been argued that different functionality (repository management, flashing, debugging, etc) belongs in different tools instead of trying to come up with swiss-army knife that does it all.
While the argument has weight and value, after careful consideration we have decided to provide a single entry point to the west functionality in order to simplify the user experience. That does not mean that all of the code needs to be in a single place, and in fact west uses an extension mechanism that allows us to place the implementation of different west commands in separate repositories, including the
build
,flash
anddebug
commands in the zephyr repository where they live now (seescripts/west-commands.yml
).There are many examples of tools similar in scope to west:
go
command-line toolnewt
command-line toolmbed-cli
command-line toolWhy is it called
west
?See here.
Why Python?
Because it's cross-platform, many of our users already know it and most important of all, it is already a dependency for Zephyr.
Why not use Google's repo
Why not use Git submodules?
There would be two possible ways of using submodules with Zephyr:
Neither would really fully cover all of the requirements described in the Requirements section
Additionally, the conclusion to use a meta-tool for multiple uses makes submodules less of a good fit.
Finally, using a meta-tool should not preclude users from still using submodules if they prefer to do so.
Unresolved issues
Unresolved issues before we can split the main repository into multiple ones:
PRs across multiple repos: How to match and retrieve a PR that spans multiple repositories.
Possible solutions:
Upmerging forks (taking upstream into a fork): Forks will use a different manifest, with a different set of repositories. Some will be common, some not. Today one can do:
git fetch upstream
,git merge upstream/master
.Possible solutions:
west upmerge <repo list>
?The text was updated successfully, but these errors were encountered: