`opam install --deps-only .` still doesn't work

I have a dune-project with multiple package stanzas (not sure if this matters, but I’m mentioning it in case it does); the dune-project manages the .opam files automatically. When I build using:

opam install --deps-only .

the specified package dependencies are not installed. Likewise, when I call

opam pin add -y .

the specified package dependenceis are not installed.

I have been having this problem on and off for three or four years, and I’m really at a loss as to what I need to do to get a reproducible one-command build with OCaml — without just calling opam install . a bunch of times, manually reading the error message, and then installing something by hand. Does anyone know how to fix this?

Thanks!

Just a quick guess: are you running dune build ${package}.opam to let dune re-generate the opam files from dune-project? If your opam files aren’t up to date, opam itself will not call dune to update them.

1 Like

@rizo That’s a great guess (and I am indeed relying on dune build to regenerate the opam file)… I had thought the file was up to date (because I had already run dune build), but now it is hard for me to check or try to reproduce as there are so many stateful factors that could have caused this to be triggered. Given that there remains a known issue in OCaml (opam install . --deps-only --working-dir incorrectly reports "Nothing to do" · Issue #5567 · ocaml/opam · GitHub) it is a little hard to tell if I am triggering that somehow, or if I just had a stale opam file through my own mistake.