opam-solver

Solver library for opam 2.1
IN THIS PACKAGE
Module OpamCudf
module Package : sig ... end
module Set : OpamStd.SET with type elt = Package.t

Cudf sets

module Map : OpamStd.MAP with type key = Package.t

Cudf maps

module Graph : sig ... end

Cudf graph

Computation of differences between universe. Returns the sets of packages to install and remove respectively.

Cudf action graph

type conflict

Abstract type that may be returned in case of conflicts

val dependencies : Cudf.universe -> Set.t -> Set.t

Return the transitive closure of dependencies of set

val reverse_dependencies : Cudf.universe -> Set.t -> Set.t

Return the transitive closure of reverse dependencies of set

val dependency_sort : Cudf.universe -> Set.t -> Cudf.package list

Sorts the given packages topolgically (be careful if there are cycles, e.g. if the universe was loaded with post dependencies enabled)

val check_request : ?explain:bool -> version_map:int OpamPackage.Map.t -> Cudf.universe -> Cudf_types.vpkg OpamTypes.request -> ( Cudf.universe, conflict ) OpamTypes.result

Check if a request is satisfiable and return the reasons why not unless explain is set to false

Compute the final universe state using the external solver.

val actions_of_diff : (Set.t * Set.t) -> Cudf.package OpamTypes.atomic_action list

Compute the list of actions to match the difference between two universe. Remark: the result order is unspecified, ie. need to use atomic_actions to get a solution which respects the topological order induced by dependencies.

exception Cyclic_actions of Cudf.package OpamTypes.action list list
val atomic_actions : simple_universe:Cudf.universe -> complete_universe:Cudf.universe -> [< Cudf.package OpamTypes.highlevel_action ] list -> ActionGraph.t

Computes the actions to process from a solution, from the actions obtained by a simple universe diff. The 'simple' universe should not contain build dependencies and will be used for resolution ; complete_universe should include build-deps, it's used to get the dependency ordering of actions.

Returns a graph of atomic actions, i.e. only removals and installs. Use reduce_actions to reduce it to a graph including reinstall and up/down-grade actions.

May raise Cyclic_actions.

Heuristic to compute the likely cause of all actions in a graph from the set of packages passed in the original request. Assumes a reduced graph. Takes the set of requested package names, and the set of packages marked for reinstall.

exception Solver_failure of string

Resolve a CUDF request. The result is either a conflict holding an explanation of the error, or a resulting universe. ~extern specifies whether the external solver should be used

Computes a list of actions to proceed from the result of resolve. Note however than the action list is not yet complete: the transitive closure of reinstallations is not yet completed, as it requires to fold over the dependency graph in considering the optional dependencies. The first argument specifies a function that will be applied to the starting universe before computation: useful to re-add orphan packages.

remove universe name constr Remove all the packages called name satisfying the constraints constr in the universe universe.

val uninstall_all : Cudf.universe -> Cudf.universe

Uninstall all the package in the universe.

Install a package in the universe. We don't care about any invariant here (eg. the resulting universe can have multiple versions of the same package installed).

val remove_all_uninstalled_versions_but : Cudf.universe -> string -> Cudf_types.constr -> Cudf.universe

Remove all the versions of a given package, but the one given as argument.

Cudf labels for package fields in the cudf format (use for the field Cudf.pkg_extra and with Cudf.lookup_package_property)

val s_source : string

the original OPAM package name (as string)

val s_source_number : string

the original OPAM package version (as string)

val s_reinstall : string

a package to be reinstalled (a bool)

val s_installed_root : string

true if this package belongs to the roots ("installed manually") packages

val s_pinned : string

true if the package is pinned to this version

val s_version_lag : string

the number of versions of the package since this one, cubed

val opam_invariant_package_name : string

valid cudf name for the dummy package used for enforcing opam's switch invariants

val opam_invariant_package : string * int

valid cudf name and version for the dummy package used for enforcing opam's switch invariants

val is_opam_invariant : Cudf.package -> bool

Pretty-printing

val string_of_vpkgs : Cudf_types.vpkg list -> string

Convert a package constraint to something readable.

val make_conflicts : version_map:int OpamTypes.package_map -> Cudf.universe -> Algo.Diagnostic.diagnosis -> ( 'a, conflict ) OpamTypes.result
val cycle_conflict : version_map:int OpamTypes.package_map -> Cudf.universe -> string list list -> ( 'a, conflict ) OpamTypes.result
type explanation = [
| `Conflict of string option * string list * bool
| `Missing of string option * string * (OpamPackage.Name.t * OpamFormula.version_formula) OpamFormula.formula
]
val string_of_conflicts : OpamTypes.package_set -> ( (OpamTypes.name * OpamFormula.version_formula) -> string ) -> conflict -> string

Convert a conflict to something readable by the user. The second argument should return a string explaining the unavailability, or the empty string, when called on an unavailable package (the reason can't be known this deep in the solver)

val string_of_explanations : ( (OpamTypes.name * OpamFormula.version_formula) -> string ) -> (explanation list * string list list) -> string
val conflict_explanations : OpamTypes.package_set -> ( (OpamTypes.name * OpamFormula.version_formula) -> string ) -> conflict -> (string * string list * string list) list * string list

Returns two lists:

  • the reasons why the request can't be satisfied with conflict explanations
  • the cycles in the actions to process (exclusive with the first)
val string_of_explanation : ( (OpamTypes.name * OpamFormula.version_formula) -> string ) -> explanation -> string * string list * string list
val conflict_explanations_raw : OpamTypes.package_set -> conflict -> explanation list * string list list
val string_of_conflict : ?start_column:int -> (string * string list * string list) -> string

Properly concat a single conflict as returned by conflict_explanations for display

val dump_universe : out_channel -> Cudf.universe -> unit

Dumps the given cudf universe to the given channel

val string_of_atom : Cudf_types.vpkg -> string

Pretty-print atoms

val string_of_request : Cudf_types.vpkg OpamTypes.request -> string

Pretty-print requests

val string_of_universe : Cudf.universe -> string

Pretty-print the universe

val string_of_packages : Cudf.package list -> string

Pretty-print of packages

val cudf2opam : Cudf.package -> OpamTypes.package

Convert a cudf package back to an OPAM package

val packages : Cudf.universe -> Cudf.package list

Returns the list of packages in a Cudf universe

Converts an OPAM request to a Cudf request

module Json : sig ... end