Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg: the solver prefers unreleased version of ocaml-variants over ocaml-base-compiler #10592

Open
gridbugs opened this issue May 28, 2024 · 0 comments · May be fixed by #10668
Open

pkg: the solver prefers unreleased version of ocaml-variants over ocaml-base-compiler #10592

gridbugs opened this issue May 28, 2024 · 0 comments · May be fixed by #10668

Comments

@gridbugs
Copy link
Collaborator

gridbugs commented May 28, 2024

Sometimes versions of the compiler that are not officially released are released on opam. At the time of writing, the latest officially released version of ocaml is 5.2.0, however the opam package ocaml.5.3.0 exists. It depends on the disjunction of ocaml-base-compiler.5.3.0 (which does not exist), and ocaml-variants.5.3.0+trunk which does exist but is marked avoid-version (dune currently ignores this flag due to ocaml-opam/opam-0install-solver#23).

The consequence of this is that if a project depends on ocaml, dune will find a solution which includes ocaml-variants, as this is the only way that the latest version of the ocaml can also be chosen.

The output from the solver at the time of writing is:

$ dune pkg lock
Solving for Build PlanPackage "ocaml-variants" has source archive which lacks a checksum.
The source archive will be downloaded from:
https://github.com/ocaml/ocaml/archive/trunk.tar.gz
Dune will compute its own checksum for this source archive.
Solution for dune.lock:
- ocaml.5.3.0
- ocaml-config.3
- ocaml-variants.5.3.0+trunk

Repro: #10595

gridbugs added a commit to gridbugs/dune that referenced this issue Jun 24, 2024
Fixes ocaml#10592.

Solves an issue where the solver would choose unstable releases of the
compiler. When the latest version of the "ocaml" package can only be
satisfied by unstable versions of "ocaml-variants", dune would still
include this unstable compiler in package solutions. This leads to
users being given unstable versions of the compiler by default. This
is only a problem because dune doesn't yet fully implement the
avoid-version flag, and compiler packages are released under the
assumption that the solver respects this flag.

The workaround introduced in this change is to determine the latest
stable version of "ocaml-base-compiler" (the latest version lacking
the avoid-version flag), and have the solver prefer versions of the
"ocaml" package that are no later than this version.

Signed-off-by: Stephen Sherratt <[email protected]>
gridbugs added a commit to gridbugs/dune that referenced this issue Jun 25, 2024
Fixes ocaml#10592.

Solves an issue where the solver would choose unstable releases of the
compiler. When the latest version of the "ocaml" package can only be
satisfied by unstable versions of "ocaml-variants", dune would still
include this unstable compiler in package solutions. This leads to
users being given unstable versions of the compiler by default. This
is only a problem because dune doesn't yet fully implement the
avoid-version flag, and compiler packages are released under the
assumption that the solver respects this flag.

The workaround introduced in this change is to determine the latest
stable version of "ocaml-base-compiler" (the latest version lacking
the avoid-version flag), and have the solver prefer versions of the
"ocaml" package that are no later than this version.

Signed-off-by: Stephen Sherratt <[email protected]>
@gridbugs gridbugs linked a pull request Jun 25, 2024 that will close this issue
gridbugs added a commit to gridbugs/dune that referenced this issue Jun 25, 2024
Fixes ocaml#10592.

Solves an issue where the solver would choose unstable releases of the
compiler. When the latest version of the "ocaml" package can only be
satisfied by unstable versions of "ocaml-variants", dune would still
include this unstable compiler in package solutions. This leads to
users being given unstable versions of the compiler by default. This
is only a problem because dune doesn't yet fully implement the
avoid-version flag, and compiler packages are released under the
assumption that the solver respects this flag.

The workaround introduced in this change is to determine the latest
stable version of "ocaml-base-compiler" (the latest version lacking
the avoid-version flag), and have the solver prefer versions of the
"ocaml" package that are no later than this version.

Signed-off-by: Stephen Sherratt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant