[ocaml-platform] opam without internet access

Louis Gesbert louis.gesbert at ocamlpro.com
Thu Mar 24 02:27:11 GMT 2016

> However, when I do opam switch for installing a different
> compiler, opam wants to download the OCaml sources from the inria
> website.
> Is there a way to instruct opam-admin to download and cache the
> compiler sources too? I am using now the following workaround: I
> modify the URL in the src field of the .comp file of the few
> compiler versions that I am interested in and copy the source
> file manually into the right location.

I don't think there is in the latest stable. The upcoming release removes this 
annoying duality between compiler and package definitions (defining everything 
as packages), so that will solve this problem. (on the other hand, it allows 
packages to define extra-sources, e.g. for compiler patches, and that will need 
separate caching)

> I now have 2 questions for opam-admin make. Firstly, is there a
> way to restrict to restrict the download of the sources to the
> latest two stable versions? I mean, it is great that I can
> install every version of utop from 1.2.1 to 1.18.2, but I don't
> really need that flexibility.

You may see the option `--resolve`. It's a bit clunky but may serve your need.

> Secondly, the archives subdir is present already on
> http://opam.ocaml.org/ . Is there a way to instruct opam-admin to
> download package sources from there without rebuilding them
> locally?

Not at the moment. `opam update --sync-archives` kind of does that (towards 
the opam cache in ~/.opam), but it was only intended for debug, and you can't 
filter the packages you want to download.

Hope this helps. Generating a self-contained local repo is indeed quite 
useful. There may be some other tools to help do that around.

Louis Gesbert - OCamlPro

More information about the Platform mailing list