-
Notifications
You must be signed in to change notification settings - Fork 841
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
Custom snapshots #111
Comments
Definitely in favor. For the download repository, see #29. This is already somewhat supported by the (undocumented) URL overriding feature, something like: urls:
package-index-http-url: "some-url" For custom snapshots, there are two approaches we can take:
|
@feuerbach Did you have any thoughts on which direction you think this should take? |
I'd certainly like to add a new resolver type. Although I understand the need for immutability, I'm a bit confused about "the naming". Do you mean naming the snapshot itself (which is presumably done by the user), or naming the internal package database, or something else? I don't like relying on a dumb hash; e.g. adding packages shouldn't be a problem, only changing the existing versions is. Right? Although a dumb hash could serve as a fast check. Do I understand correctly that a resolver in general doesn't assume one version per package (e.g. the ghc resolver doesn't have this property), but a "snapshot resolver" does? Should we also try to check that a custom package store doesn't replace foo-1.0 with a different foo-1.0? I don't think this will lead to any breakage; in the worst case the change will simply be ignored (if foo-1.0 is already installed). |
The naming situation I'm worried about is for the internal directory names. Imagine if you name your custom snapshot "roche1". Then stack installs packages in ~/.stack/snapshots/roche1/pkgdb (or something like that). If you then tweak the version of some package, stack would have to know to unregister that package and anything that depends on it, which it doesn't know about now (since it works under the assumption that snapshots are immutable). That's not a big deal of course, we can add that logic. The difficult thing is: what if a different project you're working on also uses roche1, but has a slightly different definition? Then you end up in the cabal-ish situation where each build will break your other project. The answer to all of this may be: caveat emptor, custom snapshots are an advanced feature, and users need to think about these things when using them. I'm OK with that being the answer, I just want to make sure we make such a decision consciously instead of accidentally. |
FYI, I'm studying stack's codebase to implement this feature, but it isn't going fast, so in case anyone wants to do this, go ahead and don't be blocked on me. But if not, I'm still determined to get this done eventually. |
I'm deep inside the multiple package indices right now, which is a prereq for this. I'd be happy to help you get through this at the same time (it would be good to have more people familiar with the codebase). Let me know if there's any assistance I can give you. If you're still stuck on it when I get my other high priority tasks for this milestone complete, let's touch base again. |
If we could get on a call (say, later today?) and walk around the codebase together, that'd be super helpful, actually. |
Cool let's do it. I'm free most of the morning and early afternoon, just On Mon, Jun 1, 2015, 9:05 AM Roman Cheplyaka [email protected]
|
Here's my design so far (there's also some code, but it's not finished yet). The packages: >
base-1.0
foo-bar-2.1.3
flags:
unification-fd:
base4: true (the In The name of the package db contains the host, the path, and a short hash of the full URL of the snapshot, so it is both human readable and is uniquely determined by the URL. The same name is used for the local copy of |
Sounds like a good approach to me. |
How's this coming? |
Very slowly -- I haven't had time to work on this during the past few weeks, unfortunately. |
If I have an opportunity to do so, you OK if I tackle this? On Wed, Jul 15, 2015, 12:09 AM Roman Cheplyaka [email protected]
|
That'd be great. |
I've done an initial implementation, available on the 111-custom-snapshot branch. Can you guys have a look and try this out? The syntax ended up slightly different than mentioned above. |
This looks amazing! I won't be able to test thoroughly until tomorrow. I can't wait to try it out. I didn't realize how strongly this correlates to supporting GHC variants. Since GHC variants will often have their own version of |
Could the snapshot file specify URLs for GHC bindists on each platform? |
That's an interesting idea, we could consider it. I haven't thought it On Wed, Jul 15, 2015, 4:02 PM Elliot Cameron [email protected]
|
What do you mean by "invariants around unique names." I suppose to truly "normalize" the union of snapshots and compilers, you might prefer some sort of "linking table" that connects GHCs to their bindists. Then the question becomes, is commercial Haskell's "linking table" extensible/configurable like its snapshots are? |
What I mean is this: the benefit we're trying to get from custom snapshots (vs just large extra-deps lists) is reusable builds. (There's also a bit of convenience in an external format, but that's much more easily achieved.) In order to make that work well, we need to have a stable mapping from custom snapshot identifier to set of packages/flags. |
This is a huge step forward. Thank you. I'll open another issue to document the enhancement we've been discussing. |
Thanks a lot, Michael! |
Custom snapshots are essential for me and generally important for user freedom.
By 'custom' I mean the ability to specify both custom constraints and a custom download repository.
I am happy to try to work on this myself, but wanted to find out your thoughts first.
The text was updated successfully, but these errors were encountered: