• en

Module Common

module Util : sig
val uuid : unit -> string
val list_unique : 'a list -> 'a list
return a list of unique elements. This algorithm runs in O(n) but is not stable . elements are returned in reverse order
val memo : 'a -> 'b -> 'a -> 'b
A generic memoization function. To use with care as it allocates an hashtbl storing all results that will be released only on exit
val timestamp : unit -> string
type label = string
module type Messages = sig
type t
create a new message handle with label t . Printing is disabled per default
val create : ?enabled:bool -> label -> t
val eprintf : ?raw:bool -> t -> ('a, unit, string, unit) Pervasives.format4 -> 'a
Print the message on stderr if the Util module has been set to verbose using the function make_verbose and either the handle t is enable or all handles were enabled with the function all_enabled
val enable : label -> unit
enable l the handle with label l
val disable : label -> unit
disable l the handle with label l
val all_disabled : unit -> unit
disable all handles in the module
val all_enabled : unit -> unit
enable all handles in the module
val avalaible : unit -> label list
return the list of all labels known to the module
val is_enabled : label -> bool
end
module Debug : Messages
Debug, Info and Warning messages are printed immediately on stderr. Info messages are enabled per default. Debug and Warning messages must be enabled explicitely
module Warning : Messages
module Info : Messages
module Notice : Messages
TODO: functor:dose.3.2.2+opam/dose3/Common.Util.Logging
module Progress : sig
ProgressBars are printed immediately on stderr. To be used, the **must** be created outside the functions where they are used. They can enabled or disabled (default)
type t
val create : ?enabled:bool -> ?total:int -> ?unbounded:bool -> label -> t
create "barname" : create new a progress bar labelled "barname". The progress bar is disabled by default
val enable : label -> unit
enable "barname" : enable the progress bar with label "barname"
val disable : label -> unit
disable "barname" : disable the progress bar with label "barname"
val set_total : t -> int -> unit
set_total bar 10 : set the max width of the progress bar to 10 units
val progress : ?i:int -> t -> unit
increment the progress bar of i units
val reset : t -> unit
reset the progress bar
val available : unit -> label list
return the labels of all available progress bar
end
module Timer : sig
Timers are printed all at once by the dump function on stderr. They can enabled or disabled (default)
type t
val create : ?enabled:bool -> string -> t
create s create and register a new logger named s
val enable : label -> unit
enable "barname" : enable the progress bar with label "barname"
val pp_timer : Format.formatter -> t -> unit
val dump : Format.formatter -> unit -> unit
print all timers that are enabled
val start : t -> unit
val stop : t -> 'a -> 'a
val available : unit -> label list
return the labels of all available progress bar
end
module IntHashtbl : sig
type key = int
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
end
module IntPairHashtbl : sig
type key = (int * int)
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
end
module StringHashtbl : sig
type key = string
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
end
module StringPairHashtbl : sig
type key = (string * string)
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
end
val range : int -> int -> int list
val string_of_list : 'a -> string -> string -> 'a list -> string
end
module EdosSolver : sig
module type S = sig
generic failure reason
type reason
end
module type T = sig
Sat solver functor type
module X : S
generic failure reason
type state
state of the solver
type var = int
variables are integers numbered from 0 to (size - 1)
type value =
| True
| False
| Unknown
The value of a literal
type lit
A literal. Literals can be positive or negative
val lit_of_var : var -> bool -> lit
lit_of_var given a variable create a positive or a negative literal. By default the assigment of all variables (that is its value) is Unknown.
val initialize_problem : ?pbo:int array -> ?print_var:Format.formatter -> int -> unit -> ?buffer:bool -> int -> state
initialize the solver initialize_problem n
print_var a function to print a variable
buffer decide weather or not to store a human readable representaion of the sat problem.
n the size of the sat problem. that is the max number of variables to consider
val copy : state -> state
provide a deep copy of the current state of the solver
val propagate : state -> unit
val protect : state -> unit
val reset : state -> unit
reset reset the state of the solver to a state that would be obtained by re initializing the solver with an identical constraints set
val assignment : state -> value array
assignment st return the array of values associated to every variable.
val assignment_true : state -> var list
assignment_true st return the list of variables that are true
val add_rule : state -> lit array -> X.reason list -> unit
add_rule st l add a disjuction to the solver of type TARGET NONE: \Bigvee l
val associate_vars : state -> lit -> var list -> unit
associate_vars st lit vl associate a variable to a list of variables. The solver will use this information to guide the search heuristic
val solve_all : state -> unit -> state -> var -> bool
val solve_pbo : (int array * state) -> unit -> state -> var -> bool
solve st v finds a variable assignment that makes v True
val solve : state -> var -> bool
val solve_lst : state -> var list -> bool
solve st l finds a variable assignment that makes True all variables in l
val collect_reasons : state -> var -> X.reason list
in case of failure return the list of associated reasons
val collect_reasons_lst : state -> var list -> X.reason list
in case of failure return the list of associated reasons
val dump : state -> (int * bool) list list
if the solver was initialized with buffer = true, dump the state of the solver. Return an empty list otherwise
val debug : bool -> unit
enable debug messages
val stats : state -> unit
val pboidx : state -> int -> int -> int
end
TODO: functor:dose.3.2.2+opam/dose3/Common.EdosSolver.M
end
module CudfSolver : sig
module Pcre = Re_pcre
val it : Util.Info.t
val info : ('a, unit, string, unit) Pervasives.format4 -> 'a
val nt : Util.Notice.t
val notice : ('a, unit, string, unit) Pervasives.format4 -> 'a
val wt : Util.Warning.t
val warning : ('a, unit, string, unit) Pervasives.format4 -> 'a
val dt : Util.Debug.t
val debug : ('a, unit, string, unit) Pervasives.format4 -> 'a
val check_fail : string -> bool
val mktmpdir : string -> string
val rmtmpdir : string -> unit
val input_all_lines : string list -> Pervasives.in_channel -> string list
val quote : string -> string
val sanitize : string -> string
val interpolate_solver_pat : string -> string -> string -> string -> string
exception Error of string
exception Unsat
val fatal : ('a, unit, string, 'b) Pervasives.format4 -> 'a
val check_exit_status : string -> Unix.process_status -> unit
val timer3 : Util.Timer.t
val timer4 : Util.Timer.t
val execsolver : string -> string -> Cudf.cudf -> (Cudf.preamble option * Cudf.universe)
end
module Url : sig
type debtypes = TODO: a
type rpmtypes = TODO: a
type osgitypes = TODO: a
type othertypes = TODO: a
type filetypes = TODO: a
val supported_input_types : filetypes list
type url = {
scheme : filetypes;
path : string; (* db name or filename *)
}
val of_string : string -> url
exception Invalid_url of string
val to_string : url -> string
val scheme_to_string : filetypes -> string
val scheme_of_string : string -> filetypes
end
module Input : sig
val std_open_file : string -> IO.input
load a non compressed file
Returns ExtLib.IO.input channel
val open_file : string -> IO.input
load a file either in gzip, bzip or not compressed format
Returns ExtLib.IO.input channel
val open_ch : Pervasives.in_channel -> IO.input
val close_ch : IO.input -> unit
val parse_uri : string -> (Url.filetypes * (string option * string option * string option * string option * string) * string option)
parse a uri. i.e. : deb://path/to/file rpm://path/to/file cudf://path/to/file
Returns a tuple representing the uri
val guess_format : string list list -> Url.filetypes
guess the input format from a list of list of uris and check if the list is omogenueous w.r.t the guessed format. Fails otherwise
end
module CudfAdd : sig
val equal : Cudf.package -> Cudf.package -> bool
Equality test: two CUDF packages are equal if their names and versions are equal.
val compare : Cudf.package -> Cudf.package -> int
Compare function: compares two CUDF packages using standard CUDF comparison operator (i.e. comparing by their name and version).
val hash : Cudf.package -> int
A hash function for CUDF packages, using only their name and version.
val sort : Cudf.package list -> Cudf.package list
Sort function: sorts a CUDF packages list using the standard CUDF comparison operator in ascending order
module Cudf_hashtbl : sig
Specialized hashtable for CUDF packages.
type key = Cudf.package
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
end
module Cudf_set : sig
Specialized set data structure for CUDF packages.
type elt = Cudf.package
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : elt -> unit -> t -> unit
val fold : elt -> 'a -> 'a -> t -> 'a -> 'a
val for_all : elt -> bool -> t -> bool
val exists : elt -> bool -> t -> bool
val filter : elt -> bool -> t -> t
val partition : elt -> bool -> t -> (t * t)
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val max_elt : t -> elt
val choose : t -> elt
val split : elt -> t -> (t * bool * t)
val find : elt -> t -> elt
val of_list : elt list -> t
end
val to_set : Cudf_set.elt list -> Cudf_set.t
Convert a list of CUDF packages to a set of CUDF packages.
val who_provides : Cudf.universe -> Cudf_types.vpkg -> Cudf.package list
Return the list of packages that that respect the given constraint
val resolve_deps : Cudf.universe -> Cudf_types.vpkglist -> Cudf.package list
Return the list of packages satisfying the vpkg list
val who_depends : Cudf.universe -> Cudf.package -> Cudf.package list list
Returns the list of packages that are dependencies of the given package
type ctable = (int, int list Pervasives.ref) ExtLib.Hashtbl.t
A table to associate to each id the list of packages id that are in conflict with it. Reflexive conflicts are made explicit.
val init_conflicts : Cudf.universe -> ctable
Create a ctable from a package universe
val who_conflicts : ctable -> Cudf.universe -> Cudf.package -> Cudf.package list
Return the list of packages in conflict with the given package
val resolve_vpkg_int : Cudf.universe -> Cudf_types.vpkg -> int list
Like who_provides but returns a list of cudf ids
val resolve_vpkgs_int : Cudf.universe -> Cudf_types.vpkglist -> int list
Like resolve_deps but returns a list of cudf ids
val encode : string -> string
Encode a string.
Replaces all the "not allowed" characters with their ASCII code (in hexadecimal format), prefixed with a '%' sign.
Only "allowed" characters are letters, numbers and these: @/+().-, all the others are replaced.
Examples:
  • encode "ab" = "ab"
  • encode "|" = "%7c"
  • encode "a|b" = "a%7cb"
val decode : string -> string
Decode a string. Opposite of the encode function.
Replaces all the encoded "not allowed" characters in the string by their original (i.e. not encoded) versions.
Examples:
  • decode "ab" = "ab"
  • decode "%7c" = "|"
  • decode "a%7cb" = "a|b"
val string_of : Format.formatter -> 'a -> 'b -> 'a -> string
val pp_version : Format.formatter -> Cudf.package -> unit
val pp_package : Format.formatter -> Cudf.package -> unit
val string_of_version : Cudf.package -> string
return a string containg either the value of the optional field "number" or the cudf version
val string_of_package : Cudf.package -> string
return a string of the form "name ( = version)"
val latest : Cudf.package list -> Cudf.package list
Returns a list of packages containing for each package only the latest version
module StringSet : sig
Set of strings
type elt = ExtLib.String.t
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : elt -> unit -> t -> unit
val fold : elt -> 'a -> 'a -> t -> 'a -> 'a
val for_all : elt -> bool -> t -> bool
val exists : elt -> bool -> t -> bool
val filter : elt -> bool -> t -> t
val partition : elt -> bool -> t -> (t * t)
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val max_elt : t -> elt
val choose : t -> elt
val split : elt -> t -> (t * bool * t)
val find : elt -> t -> elt
val of_list : elt list -> t
end
val pkgnames : Cudf.universe -> StringSet.t
Returns the set of all names in the given universe
val add_properties : Cudf.preamble -> Cudf_types.typedecl -> Cudf.preamble
Add a new property to the given cudf preamble
val get_property : string -> Cudf.package -> string
return the value of the requested property. emit a warning and raise Not_found if the property does not exists
val is_essential : Cudf.package -> bool
Returns true if the package is essential, that is the cudf package has a extra property named "essential" and its value is "yes"
val realversionmap : Cudf.package list -> ((Cudf_types.pkgname * string), Cudf.package) ExtLib.Hashtbl.t
build a hash table that associates (package name, String version) to CUDF packages
val vartoint : Cudf.universe -> Cudf.package -> int
Return the unique cudf id of a package in a universe
val inttovar : Cudf.universe -> int -> Cudf.package
Given a universe and a cudf id returns the corresponding package. Raise Not_found if the id does not correspond to a package.
val cudfop : (string * string) option -> (TODO: a * string) option
val pp : (Cudf_types.pkgname * Cudf_types.version) -> ('a * Cudf_types.pkgname) -> ?decode:Cudf_types.pkgname -> string -> Cudf.package -> (string * string * (string * string) list)
pp ?decode from_cudf pkg package pretty printer. from_cudf a function that gets a (name,cudfversion) pair and returns a (name,realversion). ?decode a function that decode the package name and version
returns : a pair (name,versiom,property list)
note that if the package has version less then 0, then the version is printed as "nan"
val compute_pool : Cudf.universe -> (int list list array * int list array)
val add_to_package_list : ('a, 'b list Pervasives.ref) ExtLib.Hashtbl.t -> 'a -> 'b -> unit
val get_package_list : ('a, 'b list Pervasives.ref) ExtLib.Hashtbl.t -> 'a -> 'b list
val normalize_set : int list -> int list
normalize_set l returns the list l without any duplicate element.
end
module CudfDiff : sig
module Cudf_set = CudfAdd.Cudf_set
module StringSet = CudfAdd.StringSet
type solution = {
installed : Cudf_set.t;
removed : Cudf_set.t;
}
val to_set : Cudf.universe -> Cudf.package list -> Cudf_set.t
val diff : Cudf.universe -> Cudf.universe -> (StringSet.elt, solution) ExtLib.Hashtbl.t
type summary_t = {
i : Cudf.package list;
r : Cudf.package list;
u : (Cudf.package * Cudf.package) option;
d : (Cudf.package * Cudf.package) option;
nu : Cudf.package list;
}
all : all versions of a package in the universe . s : the set of version for version of a package in a solution returns a list that contains for each version its status : installed, removed, upgraded, etc
val default_summary : unit -> summary_t
val uniqueversion : Cudf_set.t -> solution -> summary_t
val summary : Cudf.universe -> (StringSet.elt, solution) ExtLib.Hashtbl.t -> (Cudf.package list * (Cudf.package * Cudf.package) list * (Cudf.package * Cudf.package) list * Cudf.package list)
end
module VersionInfo : sig
val svn_rev : string
val svn_lastchangedate : string
val ocaml_version : string
val build_timestamp : string
val build_host : string
val build_os : string
val version : string
end