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.24k stars 356 forks source link

better error message for `pin-depends` #4025

Closed c-cube closed 4 years ago

c-cube commented 4 years ago

An opam file with a pin-depends field, as follows, fails to check with opam-pin:

pin-depends: [
   ["smtlib-utils" "https://github.com/c-cube/smtlib-utils"]
 ]

the error is:

 error  3: File format error in 'pin-depends' at line 25, column 16: while expecting package: OpamPackage.of_string
# opam config report
# opam-version      2.0.5 
# self-upgrade      no
# system            arch=x86_64 os=linux os-distribution=arch os-version=unknown
# solver            builtin-mccs+glpk
# install-criteria  -removed,-count[version-lag,request],-count[version-lag,changed],-changed
# upgrade-criteria  -removed,-count[version-lag,solution],-new
# jobs              3
# repositories      2 (http), 1 (local), 3 (version-controlled) (default repo at 871c2f16)
# pinned            39 (git)
# current-switch    4.06.1
hannesm commented 4 years ago

in my experience, adding a version to the package name helps, i.e. ["smtlib-utils.dev" "url"]

c-cube commented 4 years ago

Indeed, it works. But the error message could be somewhat improved ;-)

rjbou commented 4 years ago

Completely agree!

rjbou commented 4 years ago

In fact, it is already fixed, on master in #3762.