I’m working on setting up a continuous integration (CI) job to build an OCaml application, and as a first step, that job runs
opam init. This has turned out to be harder than I realized, because like many enterprise networks, mine blocks open-source download servers including npmjs and PyPI, and requires the use of an internal mirror.
As a temporary workaround while that mirror gets sorted out, I’ve downloaded all upstream dependencies’ tarballs specified in opam-repository, uncompressed them, and
opam pinned them, so that when I run
dune build on my code, opam builds all upstream dependencies from local sources, without needing to download anything. I’m planning on storing these dependencies’ sources in the local repository as vendored code since opam can’t yet download them itself.
So the only part of the process that I’m blocked on is the initial
opam init. I see that I cannot run
opam pin unless opam is initialized, which makes sense since the initialization step downloads opam-repository which lets opam know the dependency tree.
I’m hoping you can give me some advice on how to proceed.
I am guessing I can bundle a clone of the entire opam-repository repo with my source, and somehow recreate
~/.opam but that seems flaky (well, flakier than even the above contortions I’m attempting ). Maybe I can just replicate the
opam files for packages that I depend on? Is there some simplification of
opam init that I missed in reading the docs?
Thanks for your patience with my unusual use case!