package opam-lib
Install
dune-project
Dependency
Authors
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
AAnil Madhavapeddy <anil@recoil.org>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
Maintainers
Sources
sha256=625767c3465219cc8799aad1449c74279b31686db0821300cfdb92fbff17e9fd
md5=e0688c0cf9a55f93ee93f62d07cf6b74
doc/opam-lib.format/OpamFormula/index.html
Module OpamFormula
Management of formulas
binary operations (compatible with the Dose type for Cudf operators !)
val string_of_relop : relop -> stringPretty-printing of relops
val relop_of_string : string -> relopParsing relops
type version_constraint = relop * OpamPackage.Version.tVersion constraints for OPAM
type atom = OpamPackage.Name.t * version_constraint optionFormula atoms for OPAM
val string_of_atom : atom -> stringPretty-printing of atoms
val short_string_of_atom : atom -> stringThe compact atom format used in requests, "pkgOPvers", with '.' allowed instead of '='
val string_of_atoms : atom list -> stringPrints atoms as a conjunction ("&") using the short format
val check : atom -> OpamPackage.t -> boolChecks if a package verifies an atom
val string_of_conjunction : ('a -> string) -> 'a conjunction -> stringPretty print AND formulas
val string_of_disjunction : ('a -> string) -> 'a disjunction -> stringPretty print OR formulas
type 'a cnf = 'a disjunction conjunctionCNF formulas (Conjunctive Normal Form)
type 'a dnf = 'a conjunction disjunctionDNF formulas (Disjunctive Normal Form)
val string_of_cnf : ('a -> string) -> 'a cnf -> stringPretty print CNF formulas
val string_of_dnf : ('a -> string) -> 'a dnf -> stringPretty print DNF formulas
val eval : ('a -> bool) -> 'a formula -> boolEval a formula
val check_relop : relop -> int -> boolCheck a relational operator against an integer from compare
val eval_relop :
relop ->
OpamPackage.Version.t ->
OpamPackage.Version.t ->
boolEvaluate a relational operator between versions
val string_of_formula : ('a -> string) -> 'a formula -> stringPretty print a formula
Convert a list of formulas to an AND-formula (Empty formulas are ignored)
Converts back an AND-formula to a list (flattens top-level ands)
Convert a list of formulas to an OR-formula (Empty formulas are ignored)
Converts back an OR-formula to a list (flattens top-level ors)
Map on atoms. Atoms for which the given function returns Empty will be simply removed
Negates a formula (given the function to negate atoms)
val iter : ('a -> unit) -> 'a formula -> unitIter function
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b formula -> 'aFold function
type version_formula = version_constraint formulaExpressions composed entirely of version constraints
type t = (OpamPackage.Name.t * version_formula) formulaAn atom is: name * (relop * version) formula. Examples of valid formulae:
- "foo" {> "1" & (<"3" | ="5")}
- "foo" {= "1" | > "4"} | ("bar" "bouh")
Transform a formula where versions can be expressed using formulas to a flat atom formula
val simplify_version_formula : version_formula -> version_formulaReduces the formula, finding a shorter description of the same version set. Keeps conflicting formula, for documentation, when the set is empty.
Atoms
val to_string : t -> stringPretty print the formula
val to_conjunction : t -> atom conjunctionReturn a conjunction. If the initial formula is not a conjunction, then fail.
val of_conjunction : atom conjunction -> tReturn a formula from a conjunction of atoms
val to_disjunction : t -> atom disjunctionReturn a disjunction. It the initial formula is not a disjunction, then fail.
val of_disjunction : atom disjunction -> tReturn a formula from a disjunction of atoms
type 'a ext_package_formula =
(OpamPackage.Name.t * ('a * version_formula)) formulaFormula over versionned packages with additional flags (used to handle eg. build-deps)
val formula_of_extended : filter:('a -> bool) -> 'a ext_package_formula -> tTurns an extended package formula to a normal formula, by filtering out the packages on the flags of which filter returns false.