package opam-format

  1. Overview
  2. Docs

The package type, and package name type (name+version, values often called "nv" in the code)

Package name and versions

module Version : sig ... end

Versions

module Name : sig ... end

Names

type t = private {
  1. name : Name.t;
  2. version : Version.t;
}

Package (name x version) pairs

include OpamStd.ABSTRACT with type t := t
val of_string : string -> t
val to_string : t -> string
val to_json : t -> OpamJson.t
module Set : OpamStd.SET with type elt = t
module Map : OpamStd.MAP with type key = t
val name : t -> Name.t

Return the package name

val of_string_opt : string -> t option

Return None if nv is not a valid package name

val version : t -> Version.t

Return the version name

val create : Name.t -> Version.t -> t

Create a new pair (name x version)

val name_to_string : t -> string

To fit in the GenericPackage type, for generic display functions

val version_to_string : t -> string
val of_filename : OpamFilename.t -> t option

Guess the package name from a filename. This function extracts name and version from /path/to/$name.$version/opam, or /path/to/$name.$version.opam

val of_dirname : OpamFilename.Dir.t -> t option

Guess the package name from a directory name. This function extracts $name and $version from /path/to/$name.$version/

val of_archive : OpamFilename.t -> t option

Guess the package name from an archive file. This function extract $name and $version from /path/to/$name.$version+opam.tar.gz

Convert a set of pairs to a map name -> versions

val keys : 'a Map.t -> Set.t

Returns the keys in a package map as a package set

val versions_of_packages : Set.t -> Version.Set.t

Extract the versions from a collection of packages

val versions_of_name : Set.t -> Name.t -> Version.Set.t

Return the list of versions for a given package

val names_of_packages : Set.t -> Name.Set.t

Extract the naes from a collection of packages

val has_name : Set.t -> Name.t -> bool

Returns true if the set contains a package with the given name

val packages_of_name : Set.t -> Name.t -> Set.t

Return all the packages with the given name

val package_of_name : Set.t -> Name.t -> t

Return a package with the given name

val package_of_name_opt : Set.t -> Name.t -> t option

Return a package with the given name, if any

val packages_of_names : Set.t -> Name.Set.t -> Set.t

Return all the packages with one of the given names

val filter_name_out : Set.t -> Name.t -> Set.t

Removes all packages with the given name from a set of packages

val max_version : Set.t -> Name.t -> t

Return the maximal available version of a package name from a set. Raises Not_found if no such package available.

val compare : t -> t -> int

Compare two packages

val equal : t -> t -> bool

Are two packages equal ?

val hash : t -> int

Hash a package

Return all the package descriptions in a given directory

val prefixes : OpamFilename.Dir.t -> string option Map.t

Return all the package descriptions in the current directory (and their eventual prefixes).

Errors

val unknown : Name.t -> Version.t option -> 'a

Unknown package: either the name is unknown, or the version does not exist.

module Graph : OpamParallel.GRAPH with type V.t = t

Parallel executions.

OCaml

Innovation. Community. Security.