-
Notifications
You must be signed in to change notification settings - Fork 541
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
Planning for pinning #143
Comments
- Removed legacy guess command not that create does this. - Added GuardYaml command to guard against overwriting yaml file. - Works with -y global flag.
Regarding prune command: it would be great to have an option ( |
What's the use case for |
Well, if you want to store go libraries under version control, you find On Tue, Nov 24, 2015, 20:34 Matt Butcher [email protected] wrote:
|
@imikushin i think what you're looking for is unreachable/dead code elimination, yes? I'd say that's probably out of scope for a package manager (though I can understand why, if you were to need that, it would be convenient to attach it to the package manager). I'm not sure there's really anything in Go-dom that does that level of analysis outside of the compiler itself. The closest thing I can readily find is That's a harder and more expensive problem. You'd probably have to run some version of a connected components algorithm to figure out which identifiers actually can be safely eliminated (though, thinking through it right now, it seems like a tree/map could be sufficient...), then see if there are any files comprised entirely of unused identifiers. Worth doing in a compiler if you're already traversing all the code, but... End of the day, though, I'm inclined to think it's not something glide should do because it breaks the basic guarantee that glide leaves the disk state (aka TBH, I haven't experienced a case myself where this kind of thing would really add much value. Could you provide a link to Docker's "cryptic shell script"? |
@sdboyer Thanks for your reply. The proposed A must have though, is the The cryptic shell script I mentioned is this one: I failed to adapt it to my project and instead patched glide :) |
@imikushin what's the use case? Why prune all the packages that aren't specified at a more detailed level? "As a developer, ...."? |
e370601 has |
@imikushin ...tbh i'm still a bit confused about what you're asking for. You say:
I'm not sure that's what you actually want? To literally do what you're saying there, it means not removing non- However, from this:
And judging from what the docker script does, I think you're actually just asking for a tool that removes whole repositories that are present under |
Oh, I also meant to note in my original response - carving up stuff under |
Sorry for not expressing my use case clearly enough. Here it is, in full. Maybe I'm doing something you guys think is stupid. If that's the case, I want to know what it is. Here's the use case: As a maintainer of a project written in Go programming language, using quite a few of source code dependencies (one of which is docker and is pretty large), I need to manage these dependencies. The project has a policy (imposed by the project owner) to store all source level dependencies under version control. I don't need to store these dependencies entirely. Storing just the relevant parts is fine, as long as the tool ensures repeatability: given the same dependency specification, the tool should put the same content into the Now, minimizing dependencies' footprint is important because most of these files are just taking up space and bandwidth, slowing down the project checkouts and builds. So, I need a tool to retrieve the specified dependencies and strip the unneeded parts. I'm currently using my own glide fork to work on RancherOS:
This is good enough, but glide can do better:
By removing packages I mean removing all files from the corresponding directories (except LICENSEs and READMEs) and then remove empty dirs as well. Why not just remove the dirs with
In this particular case I'd like |
Anyone following along, now is a good time to test the |
This should remain open until |
tl;dr: this is how we think glide can ensure replicable builds and still be easy to use, for all use cases we've been able to think of.
To help ensure we do pinning properly, @mattfarina @technosophos and I spent a bit of time on videochat, and drew a purty thing. I'm putting it up here, along with my understanding of what we discussed, for reference:
The matrix describes the set of possible disk states glide might encounter, against the set of possible commands a user might run. Our goal was to articulate a basic class of behavior for each of those combinations.
For this diagram to make sense, it's important to understand the overall strategy glide is pursuing: glide ALWAYS tries to create the most reproducible build possible. This entails that, for each
main
package and its correspondingglide.yaml
, all dependencies (direct and transitive) should be pinned to specific, immutable versions. There's no wild-westing, no managing some packages but not others. Glide's sole behavior is to strive for completely deterministic builds; you don't get to turn it off.Other language package managers have historically been lax in this regard. We think that we can make glide's forced determinism easy and transparent enough that even those who "just want to run HEAD" won't be bothered by it, and will still get all the benefits of deterministic builds.
We think this approach is worthwhile because it makes glide's operation less complex, more predictable, and exposes the user to fewer possibly confusing results. It allows us say that, for every command that is run, we target exactly one class of output disk states (in the matrix, it's the state with an orange star):
glide.yaml
file, comprising (at least) all direct dependenciesglide.yaml
fileBecause there is only the one class of target output states, it removes ambiguity about how glide should deal with different types of user actions. This is not only because the end goal is clear, but also because it is impossible that glide would have itself intentionally left the disk in anything other than the correct output state - and therefore, any on-disk state glide finds represents user intent.
These rules amount to removing circular dependencies. M. C. Escher is great, but you don't want him in your package manager.
The disk states in the matrix aren't quite exhaustive, but it's pretty good. They are:
The other dimension is the user action (so, the command run by the user). These are pretty self-explanatory, I think?
We used three marks in the matrix. We weren't very rigorous about their definition, but it goes something like this:
glide get
with a yaml and no lock or vendor will effectively add your new dep to the glide.yaml, then run a fullglide install
in order to write out the entire lockfile and fully populate vendor/.The text was updated successfully, but these errors were encountered: