Skip to content

Commit

Permalink
Fix performance regression when calling opam install --deps-only on a…
Browse files Browse the repository at this point in the history
…n already installed package
  • Loading branch information
kit-ty-kate committed May 13, 2024
1 parent b3d2f5c commit d6a982d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ users)
## Actions

## Install
* Fix performance regression when calling opam install --deps-only on an already installed package [#5908 @kit-ty-kate - fix #5817]

## Remove

Expand Down
10 changes: 6 additions & 4 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1471,17 +1471,20 @@ let install_t t ?ask ?(ignore_conflicts=false) ?(depext_only=false)
nvs (t, deps_of_packages))
dname_map (t, OpamPackage.Set.empty)
in
let pkg_skip, pkg_new =
get_installed_atoms t atoms in
let atoms, deps_atoms =
if deps_only then
[],
List.map (fun (n, c) -> OpamPackage.Name.Map.find n dname_map, c) atoms
else
atoms, []
in
let pkg_skip, pkg_new =
get_installed_atoms t atoms in
let pkg_reinstall =
if assume_built then OpamPackage.Set.of_list pkg_skip
else if deps_only then OpamPackage.Set.empty
(* NOTE: As we only install dependency packages, there are no intersections
between t.reinstall and pkg_skip *)
else Lazy.force t.reinstall %% OpamPackage.Set.of_list pkg_skip
in
(* Add the packages to the list of package roots and display a
Expand Down Expand Up @@ -1544,8 +1547,7 @@ let install_t t ?ask ?(ignore_conflicts=false) ?(depext_only=false)
OpamSolution.check_availability t available_packages atoms;

if pkg_new = [] && OpamPackage.Set.is_empty pkg_reinstall &&
formula = OpamFormula.Empty &&
deps_atoms = []
formula = OpamFormula.Empty
then t else
let t, atoms =
if assume_built then
Expand Down

0 comments on commit d6a982d

Please sign in to comment.