Skip to content

Commit

Permalink
install: check if with-test & with-doc depends are installed to laiun…
Browse files Browse the repository at this point in the history
…ch a reinstall
  • Loading branch information
rjbou committed Oct 16, 2024
1 parent d5d6ddd commit b6c01f0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2212,6 +2212,29 @@ let install_t t ?ask ?(ignore_conflicts=false) ?(depext_only=false)
between t.reinstall and pkg_skip *)
else Lazy.force t.reinstall %% OpamPackage.Set.of_list pkg_skip
in
let pkg_skip, pkg_reinstall =
if OpamStateConfig.(!r.build_test || !r.build_doc) then
let to_reinstall =
List.fold_left (fun reinstall nv ->
let deps_installed =
OpamSwitchState.opam t nv
|> OpamFile.OPAM.depends
|> OpamPackageVar.filter_depends_formula ~build:false ~post:false
~test:OpamStateConfig.(!r.build_test)
~doc:OpamStateConfig.(!r.build_doc)
~dev:false
~env:(OpamPackageVar.resolve_switch ~package:nv t)
|> OpamFormula.satisfies_depends t.installed
in
if deps_installed then reinstall else
OpamPackage.Set.add nv reinstall)
OpamPackage.Set.empty pkg_skip
in
List.filter (fun p -> OpamPackage.Set.mem p to_reinstall) pkg_skip,
pkg_reinstall ++ to_reinstall
else
pkg_skip, pkg_reinstall
in
(* Add the packages to the list of package roots and display a
warning for already installed package roots. *)
let current_roots = t.installed_roots in
Expand Down

0 comments on commit b6c01f0

Please sign in to comment.