[ANN] opam-dune-lint - keep opam and dune dependencies in sync

We’re pleased to announce the first release of opam-dune-lint. This little tool checks that every ocamlfind dependency listed in your dune files has the corresponding opam package listed as a dependency in your *.opam file(s).

e.g.

$ cd charrua
$ opam dune-lint
charrua-client.opam: changes needed:
  "tcpip" {with-test & >= 6.0.0}           [from test/client, test/client/lwt]
charrua-server.opam: changes needed:
  "ppx_cstruct" {with-test & >= 6.0.0}     [from (ppx), test]
  "tcpip" {with-test & >= 6.0.0}           [from test]
charrua-unix.opam: changes needed:
  "cstruct-lwt" {>= 6.0.0}                 [from unix]
  "ipaddr" {>= 5.0.1}                      [from unix]
  "tcpip" {>= 6.0.0}                       [from unix]
charrua.opam: OK
Note: version numbers are just suggestions based on the currently installed version.
Write changes? [y] y
Wrote "./charrua-client.opam"
Wrote "./charrua-server.opam"
Wrote "./charrua-unix.opam"

If your project generates the opam files from dune-project, then it will update your dune-project instead.

It can also be useful to run this in CI. It will exit with a non-zero exit status if anything needs to be changed. ocaml-ci runs this automatically as part of the “lint-opam” check.

16 Likes