-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add 'extends' feature to overlay repos files when importing #148
base: master
Are you sure you want to change the base?
Add 'extends' feature to overlay repos files when importing #148
Conversation
6d6f04c
to
ac25dc0
Compare
Also, this could eventually fit nicely with #89, e.g. the extension |
ac25dc0
to
20d2f2a
Compare
Thank you for working on this. I can see how this feature would be valuable. Before going into the details of the PR I have a few high level thoughts:
|
Thanks @christophebedard and @dirk-thomas for the PR. Let me add my use case here: I maintain the gazebodistro set of files. There are many packages that use as dependency a subset of the other packages available in the same repository (i.e: ign-mathX uses ign-cmakeY, ign-transportZ uses ign-mathX and ign-cmakeY). There is a lot of configurations duplicated to reflect the dependency chain on every of the major versions released. As you can imaging maintaining that amount of duplicate configurations among multiple files is quite a nightmare. If I understand the PR correctly, with this approach I could do: # ign-transportZ
repositories:
a/ign-cmakeY:
type: git
url: https://github.com/ign/ign-cmake.git
version: Y
a/ign-mathX:
type: git
url: https://github.com/ign/ign-math.git
version: X
a/ign-transportZ:
type: git
url: https://github.com/ign/ign-transport.git
version: Z And will save me to list again that configurations if I use: # foo software using only ign-transportZ
extends: ign-transportZ.repos
repositories:
a/ign-foo:
type: git
url: https://github.com/ign/ign-foo.git
version: lala |
First of all, it of course allows the user to only run one command instead of My goal was to give the extension a meaning, if that makes sense. If you were to provide a list of Also, in my use case above, and I guess in a lot of similar use cases, the relationship between the extension file and the extended file isn't going to change, so why not shorten the command? And this also allows you to still easily provide the
I think so.
Absolutely, with some changes to the parsing/validation logic.
I can see that being useful, yes, e.g. if you only need to aggregate (and maybe add more repos on top) instead of needing to override versions. So the difference is aggregation (of repos) vs overriding (of versions), even if they are combined most of the time. |
Yep! And, to reference my reply above, if the extension file has a meaning by itself, since you're only combining repos here and not overriding versions, you could instead use one |
I would assume the following semantic:
(I know this isn't covered by the PR atm but I am trying to clarify where we want to go.) |
Indeed. In this case, the file listed first (top to bottom) could have priority.
Exactly, with the order being from leaf (extended file) to root (extension file), like in the tests I've written. Also, this starts getting more and more complex, but should "deletions" be allowed, i.e. removing a repo that is in the leaf/extended file using a special key/value in the extension file?
I should've opened an issue before the PR 😛 |
@dirk-thomas friendly ping. What's the next step? |
Here is a thought on the approach for aggregation. Would it be easier to add a vcs client for type: vcs? |
While probably not impossible, I'm not sure that this fits |
Sorry if I was not clear. I was suggesting a way to do recursive aggregation where a VCS input file can include children VCS input files. So a repo dependent upon a base repo or set of repos can include the dependency VCS input yaml files(). To take @j-rivero's example above:
|
Sorry, I'm a bit confused, because that's kind of what this PR does. I'm just not sure if you're only talking about how we declare these dependencies in a We could just pre-process like I did for this PR and replace an entry of extends: ign-transportZ.repos
repositories:
... vs repositories:
ign-transportZ.repos:
type: vcs
url: ign-transportZ.repos
... However, if you're talking about using an actual # base.repos
repositories:
a/repo:
type: git
url: https://github.com/a/repo.git
version: master
another/repo:
type: git
url: https://github.com/another/repo.git
version: 1.2.3 # extension.repos
repositories:
base.repos:
type: vcs
url: base.repos
a/repo:
type: git
url: https://github.com/a/repo.git
version: my-branch which is just the example I added to the README, but using Here, given vcstool/vcstool/commands/import_.py Line 180 in 2e90383
But then how does the Like I said, it might be doable given some work (e.g. by allowing clients to modify the jobs list), or maybe I'm just missing something. But to me it just seems simpler to not use an actual |
This is less readable because you have to check whether the When the extends: base.repos
... gives you the exact meaning that the |
This adds a new
extends:
root-level key for.repos
files, e.g.The
base.repos
file could look like:Running
vcs import --input extension.repos
would checkouta/repo
@my-branch
(instead ofmaster
) as well asanother/repo
@1.2.3
.This is motivated by ROS 2 development. As a concrete example, the
master
ros2.repos
file tracks a specificros2_tracing
tag. As a developer of that repository, I'd like to maintain a workspace based on thatmaster
ros2.repos
file (which, for practical reasons, I don't want to modify locally), but using themaster
branch ofros2_tracing
. This is why this solution uses an extension/overlay approach. Otherwise, when a new repo is added toros2.repos
, I update my localros2.repos
file (e.g. withgit pull
), runvcs import ...
to update my workspace, and end up checking out the specific tag instead of staying onmaster
.Although I haven't tested it, this should allow mixing
.repos
and.rosinstall
files. Note that this means thatvcstool
extends therosinstall
format (with root-levelextends:
).Currently, an extension repos file still has to be valid by itself. Eventually, I'd like to change the import logic to only validate the result of the merge between the extension file and the base file so that the extension file doesn't need to re-define all required attributes (especially
type
). However, this is for another PR.