package oasis

  1. Overview
  2. Docs

Version comparisons

This module handles versions and version comparators. A version is a string of the form "1.0.0". We compare integer and non-integer parts between to version to order them. Version comparators defined relations to a set of version. E.g. ">= 1.0.0" is a version comparator and defines all version above "1.0.0", including "1.0.0".

The version comparison is done using Debian policy for version.

  • author Sylvain Le Gall

Version

type s = string
type t
val version_compare : t -> t -> int

Compare versions.

val version_compare_string : string -> string -> int

Convert and compare version strings.

val version_of_string : string -> t

Convert a string to version.

val string_of_version : t -> string

Convert a version to string.

val value : t OASISValues.t

Version number value. Not exported.

val odn_of_t : t -> ODN.t

Dump ODN.t. Not exported.

val chop : t -> t

Remove the last part of a version, after the last '.'. I.e. 0.2.0~alpha1 -> 0.2.

Version comparator

type comparator =
  1. | VGreater of t
  2. | VGreaterEqual of t
  3. | VEqual of t
  4. | VLesser of t
  5. | VLesserEqual of t
  6. | VOr of comparator * comparator
  7. | VAnd of comparator * comparator
val comparator_apply : t -> comparator -> bool

Apply version comparator expression.

val string_of_comparator : comparator -> string

Convert a comparator to string. Example of output ">= 3.12.1".

val varname_of_comparator : comparator -> string

Convert a comparator to variable name.

val comparator_ge : t -> comparator -> bool

comparator_ge version comparator Check if comparator is compatible with all versions >= than version

val comparator_of_string : string -> comparator

Convert a string to comparator. Not exported.

val comparator_reduce : comparator -> comparator

Simplify comparator, if possible. Not exported.

val comparator_value : comparator OASISValues.t

Check that we have a version constraint. Not exported.

val odn_of_comparator : comparator -> ODN.t

Dump ODN.t. Not exported.