Module Opam_0install.Switch_context

include S.CONTEXT
type t
type rejection

A reason why a package can't be used as input to the solver. e.g. it is for a different platform, or conflicts with a user-provided constraint.

val pp_rejection : rejection Fmt.t
val candidates : t -> OpamPackage.Name.t -> (OpamPackage.Version.t * (OpamFile.OPAM.t, rejection) Stdlib.result) list

candidates t name is the list of available versions of name, in order of decreasing preference. If the user or environment provides additional constraints that mean a version should be rejected, include that here too. Rejects are only used for generating diagnostics reports. Candidates whose "availablity" field isn't satisfied must be rejected here.

val user_restrictions : t -> OpamPackage.Name.t -> OpamFormula.version_constraint option

user_restrictions t pkg is the user's constraint on pkg, if any. This is just used for diagnostics; you still have to filter them out yourself in candidates.

val filter_deps : t -> OpamPackage.t -> OpamTypes.filtered_formula -> OpamTypes.formula

filter_deps t pkg f is used to pre-process depends and conflicts. pkg is the package which has the dependency f. For example, you can use this to filter out dependencies that are only needed on Windows if the platform is Linux.

val create : ?prefer_oldest:bool -> ?test:OpamPackage.Name.Set.t -> constraints:OpamFormula.version_constraint OpamTypes.name_map -> OpamStateTypes.unlocked OpamStateTypes.switch_state -> t

create ~constraints switch is a solver that gets candidates from switch, filtering them using constraints.

  • parameter test

    Packages for which we should include "with-test" dependencies.

  • parameter prefer_oldest

    if true the solver is set to return the least up-to-date version of each package, if a solution exists. This is false by default.

  • before 0.4

    the prefer_oldest parameter did not exist.