Discussion:
[ocaml-platform] Caching the opam repository
Yann Salmon
2016-07-05 18:49:46 UTC
Permalink
Bonjour,

we are going to install opam and OCaml on many computers and I would
like to do so with as few internet downloads as possible as our
connection is rather slow.

We would also like to avoid building a whole mirror of the opam
repository, or even mirroring a predefined subset of it.

Has somebody managed to set up a solution similar to apt-cache and co ?
That is : the mirror expands and updates itself when a package is
requested from it but it cannot provide it directly.
--
Cordialement,
Yann Salmon

Informatique
MPSI, PCSI, MP*, PC*
Descartes - Tours

<http://pro.yannsalmon.fr/>
Louis Gesbert
2016-07-06 08:04:27 UTC
Permalink
There is no built-in way to do this, but setting an http proxy and the proper curl/wget configuration to go through it in opam shouldn't be too difficult. Has anyone successfully set something similar up already ? If so, directions or a tutorial could be added to (or linked from) our doc pages.

Passing the option to e.g. curl could be done by setting the proper command (with the `--proxy` option) in ~/.opam/config, field `download-command:`. This would allow to have the set up proxy be used only by opam, without exporting `http_proxy`.

Then it boils down to setting a caching proxy to keep the archives. One limitation of this approach is that it won't reuse the file digests that opam already has ; while archives very rarely change, it has happened (and required an update to the hash stored in the opam repository)
- Yann Salmon, 05/07/2016 20:49 -
Bonjour,
we are going to install opam and OCaml on many computers and I would
like to do so with as few internet downloads as possible as our
connection is rather slow.
We would also like to avoid building a whole mirror of the opam
repository, or even mirroring a predefined subset of it.
Has somebody managed to set up a solution similar to apt-cache and co ?
That is : the mirror expands and updates itself when a package is
requested from it but it cannot provide it directly.
Daniel Bünzli
2016-07-06 08:28:27 UTC
Permalink
Post by Louis Gesbert
Then it boils down to setting a caching proxy to keep the archives. One limitation of this approach is that it won't reuse the file digests that opam already has ; while archives very rarely change, it has happened (and required an update to the hash stored in the opam repository)
Assuming nfs, what about symlink tricks with $(opam config var root) ?

Daniel

Loading...