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

Unable to pin or lock opam file with {= version} #4832

Open
bikallem opened this issue Sep 8, 2021 · 4 comments
Open

Unable to pin or lock opam file with {= version} #4832

bikallem opened this issue Sep 8, 2021 · 4 comments

Comments

@bikallem
Copy link

bikallem commented Sep 8, 2021

Hi,
Consider the following as part of an opam file (https://github.com/lemaetech/wtr/blob/main/wtr-ppx.opam):

depends: [
  "dune" {>= "2.8"}
  "ocaml" {>= "4.12.0"}
  "uri" {>= "4.2.0"}
  "wtr" {= "version"}
  "ppxlib" {>= "0.22.0"}
  "odoc" {with-doc}
]

When I issue the command opam pin . , I get the following error,

[ERROR] Package conflict!
  * Missing dependency:
    - wtr >= version
    no matching version

Due to this opam lock ./wtr-ppx.opam also fails with the following error:

[ERROR] Package conflict!
  * Missing dependency:
    - wtr >= version
    no matching version

It seems we can't pin or lock packages where the dependency constraint contains {= version}. I am using opam 2.1

kit-ty-kate added a commit to kit-ty-kate/wtr that referenced this issue Sep 8, 2021
@kit-ty-kate
Copy link
Member

{= "version"} and {= version} are different things.

The first one says the version number is version (as in wtr-ppx.version).
The second one says the version number is [replace this by the version number of the current package] (in this case wtr-ppx.3.0.0)

To fix this you need to change your dune-project file in this way: lemaetech/wtr#12
This should regenerate the opam file correctly.

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Sep 8, 2021

That said this a common mistake and we could have a warning to help users figure this out

bikallem pushed a commit to lemaetech/wtr that referenced this issue Sep 8, 2021
@AltGr
Copy link
Member

AltGr commented Dec 2, 2021

Indeed; maybe the warning should probably be in dune though ? in this case the mistake in opam syntax is much more obvious

@kit-ty-kate
Copy link
Member

A dedicated lint warning is probably the way to show this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants