How to create a local cache of all opam installable packages?

Hello,

If I work on a computer with no, or very bad, or limited Internet connectivity,
how to create in advance a local cache of all the tarballs of installable
ocaml software in the opam-repository?

Or, workaround but more robust, because of the possible depexts:
how to list all the installable packages for my current switch and install them, including their depexts?

Thanks,
F.

2 Likes

I haven’t tested it, but something like

for x in $(opam list --installable)
  do
   opam source $x
  done

Might do the trick.

opam admin cache --help

3 Likes

“[…] Downloads the archives for all packages”.

I would prefer just the installable subset of packages.

No, in fact I want the largest coinstallable subset of packages.

opam admin filter allows you to modify a repo to only select some packages. If you want a more specific filter than what filter gives you you can generate it with opam list.

When the filter is done, you can opam admin cache and only download the packages you want.

2 Likes