tarides / opam-monorepo

Assemble dune workspaces to build your project and its dependencies as a whole

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

opam monorepo depext vs opam install --depext-only

hannesm opened this issue · comments

I am wondering whether there is a difference between executing (on any lockfile) opam install --depext-only <file> and opam monorepo depext -l <file>. If the answer is yes, I'd be keen to know what the difference is.

Thanks a lot.

There is indeed, even though a subtle one!

The main difference is that with opam install, you will have an extra, unecessary solver run as opam will try to resolve the dependencies to install all transitive depexts of the opam file, even though they were compiled in the depext field by opam-monorepo. Unfortunately there is no way at the moment to tell either opam install --depext-only or opam depext to only install the depexts defined in the file.

As a consequence, opam install could fail in some cases:

  1. If the upstream metadata have changed and the solution described by the lock file cannot be found by the solver anymore
  2. Because of the pin-depends field in lock files and potential differences between upstream metadata and archive/git repos opam files, the solver could fail to find a solution.

2 can be easily worked around using opam install --ignore-pin-depends --depext-only <file>.

opam monorepo depext will simply resolve the depexts formula based on the opam variables currently defined and install the resulting system packages.

Thanks for your quick and detailed explanation.