[ocaml-platform] Caching the opam repository

Louis Gesbert louis.gesbert at ocamlpro.com
Wed Jul 6 09:04:27 BST 2016


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.
> 
> 


More information about the Platform mailing list