glide icon indicating copy to clipboard operation
glide copied to clipboard

why fetching updates on a get?

Open tcurdt opened this issue 8 years ago • 13 comments

I am doing glide get <foo> which takes forever - not because it's downloading <foo> but because it tries to fetch updates to all other dependencies. Why?

tcurdt avatar Mar 10 '16 04:03 tcurdt

A couple things....

Glide resolves the complete version hierarchy. When a new package is retrieved it reworks the right version to use for everything. That way if a new package you retrieved relies on a specific version or version range the entire tree is resolved to try and make that work.

To make sure it has all the possible versions to resolves it gets an update. This causes changes if you're following the tip of a branch (such as the tip of the default branch) but doesn't if you're using versions.

Somewhere in the backlog is a request to resolve the tree on Get without updating the info we have.

mattfarina avatar Mar 10 '16 14:03 mattfarina

just ran into this myself, seems extremely odd behaviour by default. kind of defeats the purpose of the lock to the version you originally fetched.

james-lawrence avatar Mar 12 '16 19:03 james-lawrence

@james-lawrence if you fetch a new dependency how do you know the locked versions are still the right ones? For example, say you have dependency A with a dependency on B at a version of >= 1, < 2. You project resolved dependency B to version 1.4.6 and locks it. Then, you glide get dependency C and it has a dependency on B but to a version >= 1, < 1.3. The locked version of B is no invalid. You need to re-resolve the complete tree.

This example doesn't deal with the reason for an update but rather why the need to re-resolve. An optimization would be to look at the imported dependency, it's tree, and see if anything else needs to be updated. That's an optimization we've not gotten around to.

What if dependency C needed ^1.5 of B? That would also not resolve in the above example. And there are numerous cases where you would need to fetch updates to get newer versions.

Does that help explain why? There certainly are optimizations that could speed things up and pull requests are welcome.

mattfarina avatar Mar 14 '16 14:03 mattfarina

@mattfarina the reason why a re-resolve might(!) be needed is clear. It's just very very unfortunate to make it all automatically on a get.

tcurdt avatar Mar 14 '16 14:03 tcurdt

@tcurdt can you make a case for not re-resolving on get? Glide needs to resolve packages and versions for things like dependencies of dependencies of dependencies.

mattfarina avatar Mar 15 '16 13:03 mattfarina

This is certainly an area we might be able to do better in post-1.0. We might be able to trail the dependencies during resolution and figure out which ones might need an update.

technosophos avatar Mar 16 '16 02:03 technosophos

@mattfarina I understand why it does it, I disagree that it does it well enough to be worth doing automatically. since most of the time it seems to do the wrong thing.

edit: especially with no option to disable it.

james-lawrence avatar Mar 23 '16 12:03 james-lawrence

fwiw, when we get to integrating the solver engine, i've taken special care to ensure that we hit the network only when the solver actually needs it in order to proceed - and even then, as little as possible.

sdboyer avatar Apr 03 '16 23:04 sdboyer

I also think that glide get should at least should add an option to disable automatic updates. The procedure I'm currently doing is that after glide get I revert all the changes to the lock file besides the newly added packaged and also revert the updated dependencies in the vendor folder.

yoshaul avatar Aug 30 '16 13:08 yoshaul

@yoshaul yeah, there's really not any disagreement THAT it's a good idea to allow granular control over updating. The problem is that it's difficult to do in glide's current design - but it's a solved problem in gps (#384). So, we're pushing to try to get gps in, ideally in 0.13.

sdboyer avatar Aug 30 '16 14:08 sdboyer

Recently I tried to add 2 more packages to my vendor folder. If I will just copy paste them into the vendor's folder, everything looks ok. But if I try to do this with glide get pgk, glide is destroying everything, since its trying to fetch the changes, with the result that all the other packages are failing to compile.

So my question is: How I can tell glide to just clone the package I want, into the vendor's directory, and update the .yaml and .lock file?

droslean avatar Aug 23 '18 09:08 droslean

+1

LeoLiuYan avatar Apr 09 '19 03:04 LeoLiuYan

I also think that glide get should at least should add an option to disable automatic updates. The procedure I'm currently doing is that after glide get I revert all the changes to the lock file besides the newly added packaged and also revert the updated dependencies in the vendor folder.

Looks like there's now a --no-recursive flag you can use for glide get.

supersonicclay avatar Apr 19 '19 20:04 supersonicclay