[opam-devel] OPAM Dockerfiles set OPAMSWITCH

Anil Madhavapeddy anil at recoil.org
Tue Feb 23 15:15:14 GMT 2016

On 23 Feb 2016, at 15:00, David Sheets <sheets at alum.mit.edu> wrote:
> On Tue, Feb 23, 2016 at 12:33 PM, Anil Madhavapeddy <anil at recoil.org> wrote:
>> On 23 Feb 2016, at 12:28, David Sheets <sheets at alum.mit.edu> wrote:
>>> The Docker containers described by
>>> https://github.com/ocaml/opam-dockerfiles somehow set the OPAMSWITCH
>>> environment variable. I haven't been able to find where or why this
>>> variable has been set and it causes many opam commands to be more
>>> heavyweight than necessary which makes interactive use annoying. For
>>> instance, after switching compilers, you must run something like
>>> ```
>>> eval `opam config env --switch=system`
>>> ```
>>> if OPAMSWITCH is set. When is OPAMSWITCH necessary? Why? What sets it?
>> One possibility is that the entrypoint to the container passes the
>> command through "opam config exec --", which ensures that the local
>> OPAM context is available when you run the command.
> Ah, yes, that does look like the culprit. I've submitted
> <https://github.com/ocaml/opam/pull/2444> to change this behavior.

If you can submit the patch against the ocaml/opam:1.2 branch and
Louis merges it, it will show up magically in the next container
rebuild.  OPAM is built from source against 1.2-dev there.

>> This isn't really designed to support compiler switching, now that
>> I think about it :-)  Perhaps we should rejig the container layout
>> to have precisely one switch per container?  Do you just want to use
>> the system switch in your usecase?
> No, I would really like to be able to switch to, e.g.,
> 4.02.3+bytecode-only which
> Jeremy added recently at Daniel's request. I don't think it makes sense to have
> tags for all compiler switches in the universe but I agree that in
> automation use
> cases there should generally be a single switch in each container.

Sounds good.  I've got adding a bytecode-only switch TODO item to
the matrix, so that OPAM repository can be tested in this way.


More information about the opam-devel mailing list