package opam-format
Install
Dune Dependency
Authors
-
David Allsopp
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRaja Boujbel <raja.boujbel@ocamlpro.com>
-
KKate Deplaix <kit.ty.kate@disroot.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
AAnil Madhavapeddy <anil@recoil.org>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
RRalf Treinen <ralf.treinen@pps.jussieu.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
Maintainers
Sources
md5=6a69d82228899f73c5e3c04a3fb590f3
sha512=b7899244ab620213f2997409c9d8ac63e1a7ba99ff36abdd0acf41ae545ca7e0534e5e2f6c01a9700c10abf2df4f07944cc64fb5dd315a566f6c5b6b19464729
doc/opam-format/OpamFormula/index.html
Module OpamFormula
Source
Formulas on packages, opt. with sub-formulas on versions, and conversion functions
binary operations (compatible with the Dose type for Cudf operators!)
Version constraints for OPAM
Formula atoms for OPAM
The compact atom format used in requests, "pkgOPvers", with '.' allowed instead of '='
Parses a package or atom, in a format similar to short_string_of_atom
.
Prints atoms as a conjunction ("&") using the short format
Checks if a package verifies an atom
Return all packages satisfying the given atoms from a set (i.e. name matching at least one of the atoms, version matching all atoms with the appropriate name). If disj
is true, returns packages that satisfy at least one of the constraint of a given name, otherwise that satisfy all constraints.
AND formulas
Pretty print AND formulas
OR formulas
Pretty print OR formulas
CNF formulas (Conjunctive Normal Form)
DNF formulas (Disjunctive Normal Form)
General formulas
Check a relational operator against an integer from compare
Evaluate a relational operator between versions
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
Maps top-down on a formula
Maps bottom-up on a formula (atoms first)
Negates a formula (given the function to negate atoms)
Fold function (bottom-up, left-to-right)
Fold function (bottom-up, right-to-left)
Sort formula, using compare
function. `Block` around `Or` and `And` \ are removed.
Expressions composed entirely of version constraints
Checks if a given version satisfies a formula
An atom is: name
* (relop
* version
) formula. Examples of valid formulae:
- "foo" {> "1" & (<"3" | ="5")}
- "foo" {= "1" | > "4"} | ("bar" "bouh")
Returns true
if package
verifies formula
(i.e. it is within at least one package set that is a solution of the formula, and is named in the formula)
Checks if a given set of (installed) packages satisfies a formula
Returns the subset of packages possibly matching the formula (i.e. including all disjunction cases)
val compare_nc :
(OpamPackage.Name.t * version_formula) ->
(OpamPackage.Name.t * version_formula) ->
int
Transform a formula where versions can be expressed using formulas to a flat atom formula
val simplify_ineq_formula :
('a -> 'a -> int) ->
(relop * 'a) formula ->
(relop * 'a) formula option
simplify_ineq_formula comp f
returns a canonical version of inequality formula f
, based on comparison function comp
, where each version appears at most once, and in increasing order. Returns Some Empty
if the formula is always true
, None
if it is always false
Like simplify_ineq_formula
, but specialised on version formulas
A more aggressive version of simplify_version_formula
that attempts to find a shorter formula describing the same subset of versions within a given set. The empty formula is returned for an empty set, and the original formula is otherwise returned as is if no versions match.
val formula_of_version_set :
OpamPackage.Version.Set.t ->
OpamPackage.Version.Set.t ->
version_formula
formula_of_version_set set subset
generates a formula that is enough to describe all packages of subset
and exclude packages otherwise in set
Atoms
Return a conjunction. If the initial formula is not a conjunction, then fail.
Return a formula from a conjunction of atoms
Return a disjunction of atoms from a package formula. It the initial formula is not a disjunction, then fail.
Like to_disjunction
, but accepts conjunctions within constraint formulas, resolving them using the provided package set. Conjunctions between packages still raise Failure
.
Return a formula from a disjunction of atoms