tarides/opam-monorepo

--ocaml-version does not support pre-releases of the compiler

kit-ty-kate opened this issue · 5 comments

Does it work when the dependency is in the opam file?

I'm trying to find some reasonable repro case because with simple cases I can get it to lock to a 5.0.0~XXX version (we even have tests for beta versions of the compiler and I wrote another one and that passes as well), but I can't get e.g. https://github.com/bikallem/delve to lock (that's another example that's failing) because I'm missing its dependencies.

@kit-ty-kate What --ocaml-version does is to add a dependency on ocaml.<version> to the constraints. This currently doesn't work with OPAM, since there is no ocaml.5.0.0~rc1. There is however ocaml-base-compiler.5.0.0~rc1 and if I change the code to inject that the locking works (at least when I use it on opam-monorepo).

But before I do the change, I would like to understand why OPAM is set up this way, since I am not sure that depending on ocaml-base-compiler is the right thing to do, given it might make sense to pick a compatible ocaml-variants. Is there any info?

Alternatively, users that want a pre-release compiler can use --ocaml-version 5.0.0 at the moment.

Is there any info?

  • The ocaml is a meta package here to configure the compiler installation.
  • ocaml-base-compiler is just the vanilla ocaml experience
  • ocaml-variants stores all the more custom ocaml experience (configure options, forks, …)
  • ocaml-system is for using installed globally (as in outside of opam)

Why not create a meta package on the fly instead with

depends:
  "ocaml-base-compiler" {= "the requested version"} |
  "ocaml-variants" {= "the requested version"} |
  "ocaml-system" {= "the requested version"}

But why is there a 5.0.0 version of ocaml when no such release exists? I would've expected that something like ocaml.5.0.0~rc1 would exist that would depend on ocaml-base-compiler.5.0.0~rc1 (which does exist).

Yes, that could be an option worth exploring, but I would prefer to keep as little of the current setup of opam-repository duplicated in the code of opam-monorepo (e.g. ocaml-variants is reasonably new or fact that the compiler is actually in a package called ocaml-base-compiler is, for most package descriptions that depend on "ocaml", transparent).

Hope this will helps, with Ocaml 5.0.0 released I managed to get mirage-skeleton/tutorial/hello to compiles but I had to remove ocaml-variants from the dependencies of base-domains.opam:

$ cat base-domains.opam 
opam-version: "2.0"
maintainer: "https://github.com/ocaml-multicore/multicore-opam/issues"
description: """
Domains-based parallelism distributed with the Multicore OCaml compiler"
"""
depends: [
  "ocaml" {>= "5.0"}
]
$ opam pin base-domains . -y