Module OpamRepository
val of_string : string -> OpamTypes.repository
Create an abstract value from a string
module Set : sig
type elt = OpamTypes.repository
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 map : elt -> elt -> t -> t
auto-map
val choose_one : t -> elt
Return one element. Fail if the set is not a singleton.
val of_list : elt list -> t
Make a set from a list
val to_string : t -> string
Pretty-print a set
val find : elt -> bool -> t -> elt
Find an element in the list
module Op : sig
val (++) : t -> t -> t
Infix set union
val (--) : t -> t -> t
Infix set difference
val (%%) : t -> t -> t
Infix set intersection
end
end
module Map : sig
type key = OpamTypes.repository
type 'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : key -> 'a option -> 'b option -> 'c option -> 'a t -> 'b t -> 'c t
val compare : 'a -> 'a -> int -> 'a t -> 'a t -> int
val equal : 'a -> 'a -> bool -> 'a t -> 'a t -> bool
val iter : key -> 'a -> unit -> 'a t -> unit
val fold : key -> 'a -> 'b -> 'b -> 'a t -> 'b -> 'b
val for_all : key -> 'a -> bool -> 'a t -> bool
val exists : key -> 'a -> bool -> 'a t -> bool
val filter : key -> 'a -> bool -> 'a t -> 'a t
val partition : key -> 'a -> bool -> 'a t -> ('a t * 'a t)
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> (key * 'a)
val max_binding : 'a t -> (key * 'a)
val choose : 'a t -> (key * 'a)
val split : key -> 'a t -> ('a t * 'a option * 'a t)
val find : key -> 'a t -> 'a
val map : 'a -> 'b -> 'a t -> 'b t
val mapi : key -> 'a -> 'b -> 'a t -> 'b t
val to_string : 'a -> string -> 'a t -> string
Pretty-printing
val values : 'a t -> 'a list
Return the values in the map.
val keys : 'a t -> key list
Return the keys in the map.
val union : 'a -> 'a -> 'a -> 'a t -> 'a t -> 'a t
A key will be in the union of
m1
and m2
if it is appears
either m1
or m2
, with the corresponding value. If a key
appears in both m1
and m2
, then the resulting value is built
using the function given as argument.
val of_list : (key * 'a) list -> 'a t
Convert an assoc list to a map
end
exception Unknown_backend
val default_address : OpamTypes.address
Default repository address
val to_string : OpamTypes.repository -> string
Pretty-print
val compare : OpamTypes.repository -> OpamTypes.repository -> int
Compare repositories
val default : unit -> OpamTypes.repository
Default repository
val local : OpamTypes.dirname -> OpamTypes.repository
Create a local repository on a given path
val packages : OpamTypes.repository -> OpamTypes.package_set
Get the list of packages
val packages_with_prefixes : OpamTypes.repository -> string option OpamTypes.package_map
Get the list of packages (and their eventual prefixes)
val compilers : OpamTypes.repository -> OpamTypes.compiler_set
Get the list of all compiler
val compilers_with_prefixes : OpamTypes.repository -> string option OpamTypes.compiler_map
Get the list of compilers (and their eventual prefixes)
val sort : OpamTypes.repository OpamTypes.repository_name_map -> OpamTypes.repository list
Sort a collection of repositories by priority
val package_index : OpamTypes.repository OpamTypes.repository_name_map -> (OpamTypes.repository_name * string option) OpamTypes.package_map
Generate a package index from a collection of repositories
val compiler_index : OpamTypes.repository OpamTypes.repository_name_map -> (OpamTypes.repository_name * string option) OpamTypes.compiler_map
Generate a compiler index from a collection of repositories
val url_checksum : OpamFilename.t -> OpamTypes.checksums
Get the meaningful checksum off an url file
val package_files : OpamTypes.repository -> string option -> OpamTypes.package -> archive:bool -> OpamTypes.filename list
Get all the package files
val package_state : OpamTypes.repository -> string option -> OpamTypes.package -> TODO: a -> OpamTypes.checksums
Compute a package state (ie. a list of checksums).
val compiler_files : OpamTypes.repository -> string option -> OpamTypes.compiler -> OpamTypes.filename list
Get all the compiler files
val compiler_state : OpamTypes.repository -> string option -> OpamTypes.compiler -> OpamTypes.checksums
Compute a compiler state (ie. a list of checksums).
val init : OpamTypes.repository -> unit
Initialize $opam/repo/$repo
val update : OpamTypes.repository -> unit
Update $opam/repo/$repo.
module type BACKEND = sig
Backend signature
val pull_url : OpamTypes.package -> OpamTypes.dirname -> string option -> OpamTypes.address -> OpamTypes.generic_file OpamTypes.download
pull_url package local_dir checksum remote_url
pull the contents of
remote_url
into local_dir
. Can return either a file or a
directory. checksum
is the optional expected checksum.
val pull_repo : OpamTypes.repository -> unit
pull_repo
pull the contents of a repository.
val pull_archive : OpamTypes.repository -> OpamTypes.filename -> OpamTypes.filename OpamTypes.download
pull_archive repo archive
pull archive
in the given
repository.
val revision : OpamTypes.repository -> OpamTypes.version option
Return the (optional) revision of a given repository. Only useful
for VCS backends.
end
val pull_url : OpamTypes.repository_kind -> OpamTypes.package -> OpamTypes.dirname -> string option -> OpamTypes.address list -> OpamTypes.generic_file OpamTypes.download
Download an url. Several mirrors can be provided, in which case they will be
tried in order in case of an error.
val pull_url_and_fix_digest : OpamTypes.repository_kind -> OpamTypes.package -> OpamTypes.dirname -> string -> OpamTypes.filename -> OpamTypes.address list -> OpamTypes.generic_file OpamTypes.download
Pull and fix the resulting digest
val check_digest : OpamTypes.filename -> string option -> unit
check_digest file expected
check that the file
digest is the
one expected
.
val pull_archive : OpamTypes.repository -> OpamTypes.package -> OpamTypes.filename OpamTypes.download
Pull an archive in a repository
val revision : OpamTypes.repository -> OpamTypes.version option
Get the optional revision associated to a backend.
val make_archive : ?gener_digest:bool -> OpamTypes.repository -> string option -> OpamTypes.package -> unit
make_archive ?gener_digest repo prefix package
builds the
archive for the given package
. By default, the digest that
appears in $NAME.$VERSION/url is not modified, unless
gener_digest
is set.
val register_backend : OpamTypes.repository_kind -> TODO: a -> unit
Register a repository backend
val find_backend : OpamTypes.repository_kind -> TODO: a
Find a backend
module Parallel : sig
Parallel iterations
module G : sig
type t
Abstract type of graphs
module V : sig
Vertices have type
V.t
and are labeled with type V.label
(note that an implementation may identify the vertex with its
label)
type t = OpamTypes.repository
val compare : t -> t -> int
val hash : t -> int
val equal : t -> t -> bool
type label
val create : label -> t
val label : t -> label
end
type vertex = V.t
module E : sig
Edges have type
E.t
and are labeled with type E.label
.
src
(resp. dst
) returns the origin (resp. the destination) of a
given edge.
type t
val compare : t -> t -> int
type vertex = vertex
val src : t -> vertex
Edge origin.
val dst : t -> vertex
Edge destination.
type label
val create : vertex -> label -> vertex -> t
create v1 l v2
creates an edge from v1
to v2
with label l
val label : t -> label
Get the label of an edge.
end
type edge = E.t
val is_directed : bool
Is this an implementation of directed graphs?
val is_empty : t -> bool
val nb_vertex : t -> int
val nb_edges : t -> int
val out_degree : t -> vertex -> int
out_degree g v
returns the out-degree of v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val in_degree : t -> vertex -> int
in_degree g v
returns the in-degree of v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val mem_vertex : t -> vertex -> bool
val mem_edge : t -> vertex -> vertex -> bool
val mem_edge_e : t -> edge -> bool
val find_edge : t -> vertex -> vertex -> edge
find_edge g v1 v2
returns the edge from v1
to v2
if it exists.
Unspecified behaviour if g
has several edges from v1
to v2
.
Raises
Not_found
if no such edge exists.
val find_all_edges : t -> vertex -> vertex -> edge list
val succ : t -> vertex -> vertex list
succ g v
returns the successors of v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val pred : t -> vertex -> vertex list
pred g v
returns the predecessors of v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val succ_e : t -> vertex -> edge list
succ_e g v
returns the edges going from v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val pred_e : t -> vertex -> edge list
pred_e g v
returns the edges going to v
in g
.
Raises
Invalid_argument
if v
is not in g
.
val fold_vertex : vertex -> 'a -> 'a -> t -> 'a -> 'a
Fold on all vertices of a graph.
val iter_edges : vertex -> vertex -> unit -> t -> unit
Iter on all edges of a graph. Edge label is ignored.
val fold_edges : vertex -> vertex -> 'a -> 'a -> t -> 'a -> 'a
Fold on all edges of a graph. Edge label is ignored.
val iter_edges_e : edge -> unit -> t -> unit
Iter on all edges of a graph.
val fold_edges_e : edge -> 'a -> 'a -> t -> 'a -> 'a
Fold on all edges of a graph.
val map_vertex : vertex -> vertex -> t -> t
Map on all vertices of a graph.
val iter_pred : vertex -> unit -> t -> vertex -> unit
val fold_succ : vertex -> 'a -> 'a -> t -> vertex -> 'a -> 'a
val fold_pred : vertex -> 'a -> 'a -> t -> vertex -> 'a -> 'a
val iter_succ_e : edge -> unit -> t -> vertex -> unit
val fold_succ_e : edge -> 'a -> 'a -> t -> vertex -> 'a -> 'a
val iter_pred_e : edge -> unit -> t -> vertex -> unit
val fold_pred_e : edge -> 'a -> 'a -> t -> vertex -> 'a -> 'a
val create : ?size:int -> unit -> t
create ()
returns an empty graph. Optionally, a size can be
given, which should be on the order of the expected number of
vertices that will be in the graph (for hash tables-based
implementations). The graph grows as needed, so size
is
just an initial guess.
val clear : t -> unit
val copy : t -> t
copy g
returns a copy of g
. Vertices and edges (and eventually
marks, see module Mark
) are duplicated.
val add_vertex : t -> vertex -> unit
add_vertex g v
adds the vertex v
to the graph g
.
Do nothing if v
is already in g
.
val remove_vertex : t -> vertex -> unit
Time complexity for ocamlgraph implementations: O(|V|*ln(D)) for unlabeled graphs and O(|V|*D) for labeled graphs. D is the maximal degree of the graph.
remove g v
removes the vertex v
from the graph g
(and all the edges going from v
in g
).
Do nothing if v
is not in g
.Time complexity for ocamlgraph implementations: O(|V|*ln(D)) for unlabeled graphs and O(|V|*D) for labeled graphs. D is the maximal degree of the graph.
val add_edge : t -> vertex -> vertex -> unit
add_edge g v1 v2
adds an edge from the vertex v1
to the vertex v2
in the graph g
.
Add also v1
(resp. v2
) in g
if v1
(resp. v2
) is not in g
.
Do nothing if this edge is already in g
.
val add_edge_e : t -> edge -> unit
add_edge_e g e
adds the edge e
in the graph g
.
Add also E.src e
(resp. E.dst e
) in g
if E.src e
(resp. E.dst
e
) is not in g
.
Do nothing if e
is already in g
.
val remove_edge : t -> vertex -> vertex -> unit
remove_edge g v1 v2
removes the edge going from v1
to v2
from the
graph g
. If the graph is labelled, all the edges going from v1
to
v2
are removed from g
.
Do nothing if this edge is not in g
.
Raises
Invalid_argument
if v1
or v2
are not in g
.
val remove_edge_e : t -> edge -> unit
remove_edge_e g e
removes the edge e
from the graph g
.
Do nothing if e
is not in g
.
Raises
Invalid_argument
if E.src e
or E.dst e
are not in g
.
val iter_vertex : V.t -> unit -> t -> unit
val iter_succ : V.t -> unit -> t -> V.t -> unit
val has_cycle : t -> bool
val scc_list : t -> V.t list list
val string_of_vertex : V.t -> string
end
val iter : int -> G.t -> pre:G.V.t -> unit -> child:G.V.t -> unit -> post:G.V.t -> unit -> unit
val iter_l : int -> G.vertex list -> pre:G.V.t -> unit -> child:G.V.t -> unit -> post:G.V.t -> unit -> unit
val map_reduce : int -> G.t -> map:G.V.t -> 'a -> merge:'a -> 'a -> 'a -> init:'a -> 'a
val map_reduce_l : int -> G.vertex list -> map:G.V.t -> 'a -> merge:'a -> 'a -> 'a -> init:'a -> 'a
val create : G.V.t list -> G.t
exception Cyclic of G.V.t list list
end