Module Cudf


module Cudf: sig .. end
CUDF library


CUDF documents


type package = {
   package : Cudf_types.pkgname;
   version : Cudf_types.version;
   depends : Cudf_types.vpkgformula;
   conflicts : Cudf_types.vpkglist;
   provides : Cudf_types.veqpkglist;
   installed : bool;
   keep : Cudf_types.enum_keep option;
   extra : (string * string) list;
}
Representation of a parsed package description item.

With this representation, optional properties have already been expanded to their default values (if they have one). It is not possible to know whether they were present or not in the CUDF syntax.

val (=%) : package -> package -> bool
package equality up to <name, version> i.e. 2 packages are equal if they have the same name and version

type request = {
   problem_id : string;
   install : Cudf_types.vpkglist;
   remove : Cudf_types.vpkglist;
   upgrade : Cudf_types.vpkglist;
}
val default_package : package
implement package defaults
val default_request : request
implement request defaults

Syntactic CUDF representation

type cudf_doc = package list * request 
type cudf_item = [ `Package of package | `Request of request ] 

Semantic CUDF representation

exception Constraint_violation of string
violation of a constraint imposed by CUDF specification
type universe 
package universe (including package status, i.e., installed packages)
type cudf = universe * request 
type solution = universe 
XXX temporary encoding for CUDF solutions, as they are not yet defined by the CUDF spec

A universe encoding a solution matters only for its installed packages, which are considered to be the resulting package status

val load_universe : package list -> universe

CUDF manipulation

val lookup_package : universe -> Cudf_types.pkgname * Cudf_types.version -> package
lookup a specific package via a <name, version> key
Raises Not_found if the requested package cannot be found
val mem_installed : ?include_features:bool ->
?ignore:(package -> bool) -> universe -> Cudf_types.vpkg -> bool
check wheather a given package constraint is satisfied in a given package status (i.e., the universe subset of installed packages)
include_features : allow constraint to be satisfied by features (i.e., Provides). Default: true
ignore : make the lookup skip over all packages matching the given package predicate. Default: do not ignore any package
val who_provides : universe ->
Cudf_types.vpkg -> (package * Cudf_types.version option) list
Ask who provides a given feature (predicate). Note: only installed=true packages are considered by this function.
Returns a list of packages providing the requested feature. Each package is paired with an optional version; if it is None, the given package provides all possible version of the feature; it if is Some v, the given package only provides version v of the feature.
val lookup_packages : ?filter:Cudf_types.constr ->
universe -> Cudf_types.pkgname -> package list
lookup all available versions of a given package name
filter : filter the found packages according to the given version constraint. Default: None (i.e., no filtering)
val get_installed : universe -> Cudf_types.pkgname -> package list
lookup all installed versions of a given package name. Shorthand for lookup_packages composed with filtering on installed=true
val iter_packages : (package -> unit) -> universe -> unit
val fold_packages : ('a -> package -> 'a) -> 'a -> universe -> 'a
val get_packages : ?filter:(package -> bool) -> universe -> package list
conversion from universe to plain package list
filter : only return packages matching a given predicate. Default is to return all packages
val universe_size : universe -> int
total numer of available packages (no matter whether they are installed or not)
val installed_size : universe -> int
total number of installed packages occurring in the universe
val status : universe -> universe
project on packages having "installed: true". Inefficient (involves hashtbl cloning), use with care.

Low-level stanza manipulation

val lookup_package_property : package -> string -> string
low-level property lookup: given a package, lookup on it a property by name, returning its (pretty-printed, see Cudf_types) value as a string
Raises Not_found if the given property name is not associated to the given package (note that "being associated with" does not necessarily mean that the property appears in the stanza, due to default values)
val lookup_request_property : request -> string -> string
Same as Cudf.lookup_package_property, but acting on request information items.

To lookup the problem identifier as a string (which strictly speaking is not a property) you should lookup "Problem"

val version_matches : Cudf_types.version -> Cudf_types.constr -> bool
Check whether a version matches a version constraint, e.g. version_matches 1 (Some(`Eq, 2)) = false
val (|=) : Cudf_types.version -> Cudf_types.constr -> bool
Same as Cudf.version_matches