[opam-devel] OPAM Dockerfiles set OPAMSWITCH

David Sheets sheets at alum.mit.edu
Tue Feb 23 15:00:32 GMT 2016


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.

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

David


More information about the opam-devel mailing list