-
Notifications
You must be signed in to change notification settings - Fork 411
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
feature(pkg): Automatic fetching of opam-repository #8105
Conversation
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.
Awesome! It will be nice to get rid of the opam switch logic. That will really simplify the solver. You're welcome to remove the opam switch stuff from src/dune_pkg/opam_solver.ml or one of us can do that in a later change.
For opam-repository, why do we download the git repo rather than the raw tarball? I understand using git repos for actual package sources, but here it seems like we'll always be downloading much more than we'll ever need. |
I don't have any strong opinion on it but my idea of downloading the git repo is because that makes it easier to update e.g. the next time |
That's probably worth having experimenting, but I'm not entirely sure if this is optimal for opam-repository. The issue is that we're going to fetch a bunch of intermediate git objects that will be of little use. I would imagine something rsync like on top of the http protocol would end up being much faster. |
Is there ever a reason why we would want historical versions of an opam repository? If not, then it doesn't make much sense to use git IMO. |
There's a bit more discussion to be had here, but it's quite possible that we'll have the equivalent of |
There's the question whether the lockfile should e.g. retain information about the repos and their versions and whether reproducability of lockfiles is a goal but for now I would say one global copy of opam-repository with a single version is probably going to suffice and does not prevent us from implementing a more elaborate solution later on if there is demand. I'll talk to OPAM folks about downloading the tarball vs git. The latter has the advantage of being on Github thus profiting from their CDN, will ask what the state of the tarball is (it's hopefully also CDN'ed). |
Just a reminder not to skip over other opam repositories like https://github.com/coq/opam-coq-archive and the OCaml beta one. |
If someone really wants reproducible lockdirs they could always clone the opam repo themselves and checkout a particular revision and then point dune at that. There are other factors that influence the resluting lockdir including flags/variables set in the build context or passed on the command line so I guess there's a question of whether to store all this information inside the lock.dune file in the lockdir so that lockdirs are reproducable. Kind of a lockfile for your lockfile. I'm not sure if it's something we want to fully support though as code changes in dune will also affect lockdir generation. |
@Alizter I think just the default opam-repository is a decent starting point, but you're right, it should be customizable. In the near-future we might want to extend the dune-project file with some stanza to specify the repos to use for locking, as I could see this to be a useful addition (we added this as an extra OPAM field in opam-monorepo and it has been extremely useful). Wrt to reproducibility, I think it is an excellent idea. The issue here is that it this information is unfortunately optional. The opam-repository tarball has a field |
fdc592a
to
c4e937a
Compare
Ok, freshly rebased and now featuring tests that show that it does download the file and store it in the dune cache. It uses some somewhat exotic commands in the test like |
e804099
to
9a0bc99
Compare
9a0bc99
to
7c71397
Compare
#8105 (7c71397) changes the metrics as follows in comparison to Benchmark: defaultTest: dune monorepo benchmarks
|
7c71397
to
9fcb056
Compare
#8105 (9fcb056) changes the metrics as follows in comparison to Benchmark: defaultTest: dune monorepo benchmarks
|
9fcb056
to
5762fab
Compare
Signed-off-by: Marek Kubica <marek@tarides.com>
5762fab
to
b29bcad
Compare
This PR is an exploration on downloading a copy of opam-repository for locking. It is surprisingly easy to implement and it works rather fast. Currently the Git repo that it downloads is 142M but an initial lock of dune takes 11s and a consecutive lock with the repo downloaded takes about 3s.
I'm honestly rather pleasantly surprised how nicely this works.