-
-
Notifications
You must be signed in to change notification settings - Fork 268
cross repository dependency management #159
Conversation
See OCA/vertical-ngo#107 for a test of this implementation. |
d3e7219
to
39d89b9
Compare
checkout_dir = git_checkout(home, depname, url, branch) | ||
new_dep_filename = osp.join(checkout_dir, 'oca_dependencies.txt') | ||
if new_dep_filename not in dependencies: | ||
dependencies.append(new_dep_filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like to modify a list when we are iterating through it with a for
loop.
I prefer to use something like:
while dependencies:
depfilename = dependencies.pop()
...
if new_dep_filename not in dependencies:
dependencies.append(new_dep_filename)
(not exactly the same result as dependencies.pop()
will process the dependencies from last to first but I don't think it is an issue here)
Maybe just appending to a list in the for
is ok (remove is surely not), but still a bit troubling IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appending to a list in a for
loop is ok. Removing is ok too, as long as you remove after the current iteration element (which is also why appending to a list is perfectly safe: in this case I'm using the list as a queue of elements to be processed). It is even a very nice way to refactor a recursion to an interation 😸
There are checks in the code to avoid looping, which are not convenient to write if I pop()
the elements from the queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should add dependencies recursively for each dependency, because main project can depend on a module of a repository that has dependencies because of another modules, but not the one we need.
Making this, we can increase a lot the build time (specially with those branches that has a lot of commits or branches - this will get worse with each Odoo version).
Each repository maintainer should resolve manually the dependency chain and add it to main project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am with @pedrobaeza here. Repos are loose groups of modules, and I am not very keen to work too much on repo dependencies (a concept I'd like to get rid of eventually). We already have the proprietary odoo dependency resolution, and we're adding even another one.
Still, I understand how that makes life a bit easier, and I am not blocking it. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree.
This will reduce breakage when other repositories' external dependencies change. And I personnally hate having to manually track these when a computer can perfectly do the job in my stead (and should do so).
@pedrobaeza Built time increase argument is void. The resulting clones are currently exactly the same as the one we are manually configuring, and the checkout time of OCA repositories is negligible compared to creating the base database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gurneyalex, no if added dependencies (for new modules) are not used by our repository. For example, spanish localization uses base_location of partner-contact repository. Only that module. But module partner_relations needs web repository because it uses web_m2x_options and web_tree_many2one_clickable, and thus this dependency is added at partner-contact level.
The way you make it, it will download also project web, and the corresponding dependencies for it, and so on recursively, needing to download practically all OCA repos for each Travis test, when I only need for spanish localization to download partner-contact repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also agree with Pedro. I would rather see "nested" dependencies be explicitly declared. I also hope this gives incentive keep dependencies to a minimum and try to stay away from a "monolith".
e95a4a9
to
4d3cef2
Compare
👍 |
url = parts[1] | ||
else: | ||
url = 'https://github.com/OCA/%s' % repo | ||
deps.append((repo, url, branch)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a matter of taste but I prefer named tuple for this kind of usage
@gurneyalex in case of LINT check only do we want to clone deps ? Could we have a way of avoiding this unnecessary step ? |
@yvaucher this is already taken care of in |
@gurneyalex oh right thanks Then 👍 |
👍 |
install: | ||
- git clone https://github.com/OCA/a_project_x ${HOME}/a_project_x -b ${VERSION} | ||
- git clone https://github.com/OCA/a_project_y ${HOME}/a_project_y -b ${VERSION} | ||
project_name optional_repository_url optional_branch_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should put OCA_project_name
and put the other two parameters enclosed by brackets, that it's the common terminology for regular expressions with optional parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's the common way for USAGE strings output when --help
is passed as a command line option... In the context of an example configuration I tend to find my version clearer.
Waiting for more feedback on this.
@dreispt @pedrobaeza can we merge this one ? |
My concern about dependency resolution hasn't been addressed as far as I can see. |
def git_checkout(home, reponame, url, branch): | ||
checkout_dir = osp.join(home, reponame) | ||
if not osp.isdir(checkout_dir): | ||
command = ['git', 'clone', '-q', url, '-b', branch, checkout_dir] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use depth=1
to clone faster.
Is it only a matter of build time? I'm not sure that it is really a concern...
takes 2 seconds on my computer |
--depth=1 solution seems good to me |
Ok I had a look at our repo and their dependencies, and I changed my mind. I don't think there is a case we would download a monolithic source base. This for few reasons:
Thus for the few case we would pull extra repo, it's not worth the time to have to write down everywhere the exact list needed. We can later improve this automatically searching deps in In 9.0 we won't have this issue anymore if 1 repo = 1 module |
@yvaucher that is a big if, isn't it? |
@StefanRijnhart For 9.0 more I think about it and more I'm convinced it would be the best way to go to manage dependencies. |
Saying that a repo depends on another is a misleading way to put it. We can have a module in repo A depend on a module in repo B, and another module in repo B depend on a module in repo C. Repos are organized around common functional areas. I believe that having a border module in A depends on a border module of B that needs a module in C should be a rare situation. So I don't sympathize with the auto discovery of dependencies. |
@dreispt, I think similar to you, but this can be minimized if the auto-discovery doesn't penalize performance. |
So a few of us, me included, are a bit skeptical of bringing the idea of repo dependencies too far. Recently, I have been working on modules like It is indeed useful to group modules for human reasons (determining the maintainer, listing them clearly), but technically, I'd love to get rid of module dependencies one day (with one-module repos, probably). TL;DR here what @gurneyalex proposes addresses a problem we have today, and he did the work already, so I am 👍 for merging anyway! Is anyone against? |
needs a rebase |
use repo/oca_dependencies.txt rather than an explicit list of checkouts in .travis.yml
silence pip error messages especially the ones caused by the installation of Pylint. silence rm if no file to remove, quiet wget and apt-get
4d3cef2
to
52804e6
Compare
👍 I am for as well It can help greatly for external tools such as travis, but also runbot, documentation, translation and all sorts of other test/utility servers. |
@gurneyalex I think you have 4 thumbs up. |
👍 |
cross repository dependency management
use repo/oca_dependencies.txt rather than an explicit list of checkouts in
.travis.yml
closes #105