[opam-devel] depopt constraints not respected

Roberto Di Cosmo roberto at dicosmo.org
Sat Apr 5 15:04:10 BST 2014


This was raised in issue #1310, copying here my answer from
that thread.

The short answer is: when there is an incompatibility/conflict,
this must show up as a conflict in the metadata, to make sure
the solver will know.

The right solution is to fix the metadata for (all versions of)
lwt, that miss this single line

 conflicts: [ "react" { >= "1.0.0"} ]

More generally, one should look at all instances of this pattern
in the metadata, and fix them... just opened an issue on this
here

https://github.com/ocaml/opam-repository/issues/1864

--
Roberto

The metadata for lwt 2.4.4, which is the following

             package: lwt
             version: 2.4.4
          repository: default
        upstream-url: https://github.com/ocsigen/lwt/archive/2.4.4.tar.gz
       upstream-kind: http
   upstream-checksum: 7f3e8d63055763004bb49ff4e7db44ea
             depends: ocamlfind
             depopts: base-threads | base-unix | conf-libev | ssl | react < 1.0.0 | lablgtk | ocaml-text
  installed-versions: lwt.2.4.3 [4.01.0+fp], lwt.2.4.4 [eliom_vanilla 4.01.0 3.12.1]
  available-versions: 2.3.2, 2.4.0, 2.4.1, 2.4.2
         description: A cooperative threads library for OCaml

gets converted into the CUDF file as

package: lwt
version: 6
depends: base-threads , base-unix , ocamlfind
conflicts: lwt
opam-name: lwt
opam-version: 2.4.4

Indeed base-threads, base-unix and ocamlfind are the only packages already
installed (you are on a new switch, which has exactly those ones), and depopts
are converted into hard dependencies for installed packages.

So the solver, that only sees the CUDF file, has no knowledge that lwt 2.4.4 is
incompatible with react >= 1.0.0, and proposes a solution that installs
react=1.0.0 and you get an error.

One could wonder what the precise semantics of depopts is, but my position here
is that when a given package is incompatible with another one, this must be
translated into a conflict, and one should see a

  conflicts : react >= 1.0.0

in the lwt metadata.



On Sat, Apr 05, 2014 at 02:33:36PM +0100, Anil Madhavapeddy wrote:
> With the React 1.0 API incompatibility now in the repository, it highlights that depopt constraints in OPAM 1.1.x aren't always respected.
> 
> See:
> https://github.com/ocaml/opam-repository/pull/1863
> 
> which results in Lwt.2.4.4 and React.1.0.0 being selected despite Lwt.2.4.4 having a depopt of React<"1.0.0".
> 
> https://travis-ci.org/ocaml/opam-repository/jobs/22335518
> 
> # File "src/react/lwt_react.ml", line 384, characters 4-10:
> # Error: This function has type
> #          ?eq:('a -> 'a -> bool) ->
> #          'a React.signal React.signal -> 'a React.signal
> #        It is applied to too many arguments; maybe you forgot a `;'.
> # Command exited with code 2.
> 
> Right now the workaround has to be to put a hard "react<1.0.0" in every dependency. Is that the only way?
> 
> -anil
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel


More information about the opam-devel mailing list