diff --git a/src/0install-solver/src/solver/s.ml b/src/0install-solver/src/solver/s.ml index fd97512768b6..6f6f9ff9a9c0 100644 --- a/src/0install-solver/src/solver/s.ml +++ b/src/0install-solver/src/solver/s.ml @@ -58,9 +58,6 @@ module type CORE_MODEL = sig dep_importance : [ `Essential | `Recommended | `Restricts ] } - (* The top-level requirements from the user. *) - type requirements = { role : Role.t } - (** Get an implementation's dependencies. The dependencies should be ordered with the most important first. @@ -145,7 +142,7 @@ module type SELECTIONS = sig val to_map : t -> impl RoleMap.t val get_selected : Role.t -> t -> impl option - val requirements : t -> requirements + val requirements : t -> Role.t end module type SOLVER_RESULT = sig @@ -160,7 +157,6 @@ module type SOLVER_RESULT = sig with module Role = Input.Role and type dependency = Input.dependency and type dep_info = Input.dep_info - and type requirements = Input.requirements val unwrap : impl -> Input.impl diff --git a/src/0install-solver/src/solver/solver_core.ml b/src/0install-solver/src/solver/solver_core.ml index 2b23ce9cc4c0..ebe3bd5b6e6e 100644 --- a/src/0install-solver/src/solver/solver_core.ml +++ b/src/0install-solver/src/solver/solver_core.ml @@ -345,8 +345,7 @@ struct in let+ () = (* This recursively builds the whole problem up. *) - (let { Model.role } = root_req in - let+ impl = lookup_impl role in + (let+ impl = lookup_impl root_req in impl#get_vars) >>| S.at_least_one sat ~reason:"need root" (* Must get what we came for! *) in @@ -370,7 +369,7 @@ struct ; dep_importance : [ `Essential | `Recommended | `Restricts ] } - type requirements = Model.requirements = { role : Role.t } + type requirements = Role.t let dep_info = Model.dep_info let requires role impl = Model.requires role impl.impl @@ -412,7 +411,7 @@ struct let sat = S.create () in let dummy_impl = if closest_match then Some Model.dummy_impl else None in let+ impl_clauses = build_problem root_req sat ~dummy_impl in - let lookup { Model.role } = (ImplCache.get_exn role impl_clauses :> candidates) in + let lookup role = (ImplCache.get_exn role impl_clauses :> candidates) in (* Run the solve *) let decider () = (* Walk the current solution, depth-first, looking for the first undecided interface. @@ -438,7 +437,7 @@ struct we'll handle it when we get to them. If noone wants it, it will be set to unselected at the end. *) None - else find_undecided { Model.role = dep_role } + else find_undecided dep_role in List.find_map check_dep deps) in diff --git a/src/0install-solver/src/solver/zeroinstall_solver.mli b/src/0install-solver/src/solver/zeroinstall_solver.mli index 0a7a10bc0711..cd4a955dff2f 100644 --- a/src/0install-solver/src/solver/zeroinstall_solver.mli +++ b/src/0install-solver/src/solver/zeroinstall_solver.mli @@ -18,7 +18,7 @@ module Make every interface, so we can always select something. Useful for diagnostics. Note: always try without [closest_match] first, or it may miss a valid solution. @return None if the solve fails (only happens if [closest_match] is false). *) - val do_solve : closest_match:bool -> Input.requirements -> Output.t option Monad.t + val do_solve : closest_match:bool -> Input.Role.t -> Output.t option Monad.t end (** Explaining why a solve failed or gave an unexpected answer. *) diff --git a/src/opam-0install/lib/model.ml b/src/opam-0install/lib/model.ml index 95aef0ec7be0..b3a837844cf9 100644 --- a/src/opam-0install/lib/model.ml +++ b/src/opam-0install/lib/model.ml @@ -102,8 +102,6 @@ struct ; dep_importance : [ `Essential | `Recommended | `Restricts ] } - type requirements = { role : Role.t } - let dummy_impl = Dummy (* Turn an opam dependency formula into a 0install list of dependencies. *) diff --git a/src/opam-0install/lib/solver.ml b/src/opam-0install/lib/solver.ml index 3a4a3639878a..4aaf76d48567 100644 --- a/src/opam-0install/lib/solver.ml +++ b/src/opam-0install/lib/solver.ml @@ -18,7 +18,7 @@ struct let impl = Input.virtual_impl ~context ~depends:pkgs () in Input.virtual_role [ impl ] in - { Input.role } + role ;; module Solver = Zeroinstall_solver.Make (Monad) (Input) @@ -26,7 +26,7 @@ struct type t = Context.t type selections = Solver.Output.t - type diagnostics = Input.requirements (* So we can run another solve *) + type diagnostics = Input.Role.t (* So we can run another solve *) let solve context pkgs = let req = requirements ~context pkgs in