ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.25k stars 359 forks source link

pin seems to create an unexpected constraint #3764

Open bluddy opened 5 years ago

bluddy commented 5 years ago

Currently on a 4.07.0 switch and opam 2, if I do opam install disml, I can install fully. However, if I pin to --dev-repo, I get

[disml.0.2.5] synchronised from git+https://gitlab.com/Mishio595/disml
disml is now pinned to git+https://gitlab.com/Mishio595/disml (version 0.2.5)

The following dependencies couldn't be met:
  - disml → ppx_deriving_yojson >= 3.3 → yojson < 1.6.0 → ocaml < 4.06.0
      base of this switch (use `--unlock-base' to force)
  - disml → yojson >= 1.6.0
Your request can't be satisfied:
  - No available version of yojson satisfies the constraints

I can't understand where the < 4.06.0 constraint came from -- nothing seems to contain it.

rjbou commented 5 years ago

The conflict is not in the ocaml version, but yojson version: in case of conflict, opam retrieves unstatisfied dependencies from internal dose solver, and displays it in an human readable format.

AltGr commented 5 years ago

When pinning to the dev version, the opam file from the source is used, and in your case it has different dependencies, including yojson >= "1.6.0". So this explains you are getting different results.

This doesn't explain the extra → ocaml < 4.06.0, which seems indeed spurious, though. I can't explain it at the moment as it comes from the internals of the Cudf solver provided by the Dose library... Interestingly it disappears if you just add --unlock-base to the command-line, so I can maybe guess it is a misinterpretation of our base-compiler constraints by the Dose conflict extraction function.

copy commented 5 years ago

I have a probably related solver weirdness:

opam install base=v0.12.0 reports:

The following actions will be performed:
  ⊘ remove    dns                     1.1.0              [conflicts with uri]

But in reality, dns depends on cstruct, which is being removed due to a conflict with sexplib v0.12.0 which in turn is required by base v0.12.0. There is no conflict between dns and uri.

If one runs opam install sexplib=v0.12.0 it's reported correctly:

The following actions will be performed:
  ⊘ remove    dns                     1.1.0              [uses cstruct]