dune
dune copied to clipboard
dune install -p <pkg> requires every packages from the project to be installed, not just <pkg>
Expected Behavior
With 3 packages into one repository, 2 of the packages available globally, I would expect dune install -p pkg3
to succeed and to only install pkg3.
Actual Behavior
Fails with:
Error: The following <package>.install are missing:
- _build/default/current_ocluster.install
- _build/default/ocluster-api.install
Hint: try running: dune build @install
and if we do dune build @install
as hinted, all 3 packages are install/reinstalled (overriding globally installed packages, breaking the expectation of -p
)
Reproduction
FROM ocaml/opam:debian
RUN git clone git://github.com/ocurrent/ocluster.git
WORKDIR ocluster
RUN git submodule update --init
RUN sudo ln -f /usr/bin/opam-2.1 /usr/bin/opam
RUN opam pin add -n .
RUN opam update --depexts
RUN opam install dune.2.8.5
RUN opam install --deps-only ocluster
RUN opam exec -- dune build -p ocluster
RUN opam exec -- dune install -p ocluster
Specifications
- Version of
dune
(output ofdune --version
): 2.8.5
It is indeed not taken into account and it should if it is an available option. But I wonder if there is a meaningfull difference between dune install ocluster
and dune install --only-package ocluster
, and I don't see which effect --release
should have on the install command.
@kit-ty-kate Do you think it would be OK to remove -p
from the install command, or making dune install -p foo
an alias of dune install foo
.
Sure, an alias would be perfectly fine I think. However I think the hint given on errors should also change accordingly.
If dune install <pkg>
or dune install -p <pkg>
is given, the hint should be:
Hint: try running: dune build -p <pkg> @install
not
Hint: try running: dune build @install
I'm not sure for the hint. I agree the current is wrong in some case, but the proposed one is also wrong in others (when the other libraries are not installed).
So we can have dune install -p <pkg>
-> dune build -p <pkg> @install
and dune install <pkg>
-> dune build @install
. But since dune install -p <pkg>
and dune install <pkg>
should be equivalent, I would prefer to write Hint: try running: dune build [-p <pkg>] @install
, what do you think?
Hi, got hit by this today and it took my quite a while to understand what went wrong. I think it's worth implementing the hint of some sort to help people understand this issue.
Finally the alias proposition seems the most sensible. So MR would be accepted for dune install -p <pkg>
an alias for dune install <pkg>
.
Yes, the bug is that we're accepting -p
as an argument at all.
FTR, it's going to be more difficult than expected because dune sites uses that in their installation instructions: https://github.com/ocaml/dune/blob/3.13.0/src/dune_rules/opam_create.ml#L62