diff --git a/src/client/opamListCommand.ml b/src/client/opamListCommand.ml index ff3c78a01b8..aa992bdc7c4 100644 --- a/src/client/opamListCommand.ml +++ b/src/client/opamListCommand.ml @@ -248,9 +248,8 @@ let apply_selector ~base st = function (Lazy.force st.available_packages) | Coinstallable_with (tog, packages) -> let universe = get_universe st tog in - let universe = - { universe with u_base = OpamPackage.Set.of_list packages } - in + let set = OpamPackage.Set.of_list packages in + let universe = { universe with u_base = set; u_installed = set } in OpamSolver.installable universe | Solution (tog, atoms) -> let universe = get_universe st tog in diff --git a/src/client/opamMain.ml b/src/client/opamMain.ml index 141d2ecf566..b0b1d3e0dcd 100644 --- a/src/client/opamMain.ml +++ b/src/client/opamMain.ml @@ -2733,14 +2733,33 @@ let build = let virt_st = OpamSwitchState.load_virtual ?repos_list:repos gt rt in + let opams = + OpamPackage.Map.union (fun _ x -> x) virt_st.opams local_opams + in + let virt_st = + { virt_st with + opams; + packages = + OpamPackage.Set.union virt_st.packages local_packages; + available_packages = lazy ( + OpamPackage.Map.filter (fun package opam -> + OpamFilter.eval_to_bool ~default:false + (OpamPackageVar.resolve_switch_raw ~package gt + switch OpamFile.Switch_config.empty) + (OpamFile.OPAM.available opam)) + opams + |> OpamPackage.keys); + } + in let universe = OpamSwitchState.universe virt_st ~requested:(OpamPackage.names_of_packages local_packages) Depends in - let universe = { universe with u_base = local_packages } in - (* we could compute available packages (using global variables), but - choose not to *) + let universe = { + universe with u_base = local_packages; + u_installed = local_packages } + in OpamSolver.installable universe in let check_coinstallable_atoms atoms =