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.2.tbz
sha256=14820dabe460fda8272596d02c3de938ae584720285b7538fc7ee6f7d7a93432
sha512=e25ed90fcddd68b92e7ff6092a6a3f357840d53eadf133348977771cd9d457cc1994a46cec88c95e101cfef354694f6b454f73b5e684da45bafe50f25304797c

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: 08 Jul 2021

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
current_ocluster.opam  ocluster-api.opam  ocluster.opam

$ opam-dune-lint
current_ocluster.opam: changes needed:
  "ppx_deriving" {>= 5.1}                  [from (ppx), ocurrent-plugin]
ocluster-api.opam: changes needed:
  "ppx_deriving" {>= 5.1}                  [from (ppx), api]
ocluster.opam: changes needed:
  "capnp-rpc-lwt" {>= 0.8.0}               [from scheduler, worker]
  "capnp-rpc-net" {>= 0.8.0}               [from scheduler]
  "ppx_sexp_conv" {>= v0.14.1}             [from (ppx)]
  "prometheus" {>= 0.7}                    [from scheduler]
  "alcotest-lwt" {with-test}               [from test] (missing {with-test} annotation)
Note: version numbers are just suggestions based on the currently installed version.
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 (10)

  1. opam-format
  2. opam-state >= "2.1.0~~"
  3. fmt >= "0.8.9"
  4. bos >= "0.2.0"
  5. ocaml >= "4.10.0"
  6. dune-private-libs >= "2.8.0" & < "3.0.0"
  7. cmdliner >= "1.0.4"
  8. sexplib >= "v0.14.0"
  9. astring >= "0.8.5"
  10. dune >= "2.7" & < "3.0"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None