package opam-dune-lint

  1. Overview
  2. Docs
Ensure dune and opam dependencies are consistent

Install

Dune Dependency

Authors

Maintainers

Sources

opam-dune-lint-v0.1.tbz
sha256=a055f617443562660aaeee8808a60b290603cbc48d3d382df6f04d8bd222a152
sha512=8437ab9ad630cedc362964da05cf26897099a2f119fe8da4913d3b677da26a27de6e183766b1b6279bff189f7673d3349fd06e8c259d2c3f32ac2b8087f7248c

Description

opam-dune-lint checks that all ocamlfind libraries listed as dune dependencies have corresponding opam dependencies listed in the opam files. If not, it offers to add them (either to your opam files, or to your dune-project if you're generating your opam files from that).

Published: 23 Dec 2020

README

opam-dune-lint

opam-dune-lint checks that all ocamlfind libraries listed as dune dependencies have corresponding opam dependencies listed in the opam files. If not, it offers to add them (either to your opam files, or to your dune-project if you're generating your opam files from that).

Example:

$ ls *.opam
ocaml-ci-api.opam     ocaml-ci-service.opam  ocaml-ci-web.opam
ocaml-ci-client.opam  ocaml-ci-solver.opam

$ opam-dune-lint
ocaml-ci-api.opam: OK
ocaml-ci-client.opam: OK
ocaml-ci-service.opam: changes needed:
  "fmt" {>= 0.8.9}
  "alcotest-lwt" {with-test & >= 1.2.3}
ocaml-ci-solver.opam: OK
ocaml-ci-web.opam: OK
Write changes? [y] y
Wrote "dune-project"

It works as follows:

  1. Lists the *.opam files in your project's root (ensuring they're up-to-date, if generated).

  2. Runs dune external-lib-deps --only-packages $PKG --unstable-by-dir @install and ... @runtest to get each package's ocamlfind dependencies.

  3. Filters out local dependencies using dune describe (for now; would be good to lint these too in future, but needs a different code path).

  4. Filters out vendored dependencies (by ignoring dependencies from subdirectories with their own dune-project file).

  5. For each ocamlfind library, it finds the corresponding opam library by finding its directory and then finding the *.changes file saying which opam package added its META file.

  6. Checks that each required opam package is listed in the opam file.

  7. For any missing packages, it offers to add a suitable dependency, using the installed package's version as the default lower-bound.

opam-dune-lint can be run manually to update your project, or as part of CI to check for missing dependencies. It exits with a non-zero status if changes are needed, or if the opam files were not up-to-date with the dune-project file. When run interactively, it asks for confirmation before writing files. If stdin is not a tty, then it does not write changes unless run with -f.

Dependencies (12)

  1. opam-format
  2. opam-state >= "2.1.0~~" & opam-version >= "2.1"
  3. opam-state < "2.1.0~~" & opam-version < "2.1"
  4. fmt >= "0.8.7"
  5. bos
  6. ocamlfind
  7. ocaml >= "4.11.0"
  8. dune-private-libs >= "2.7.1" & < "2.8.0"
  9. cmdliner >= "1.0.4"
  10. sexplib >= "v0.14.0"
  11. astring >= "0.8.5"
  12. dune >= "2.7" & < "3.0"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None