package opam-format

  1. Overview
  2. Docs

Definitions of many types used throughout

type 'a success = [
  1. | `Successful of 'a
]

Error and continuation handling

type 'a error = [
  1. | `Error of 'a
  2. | `Exception of exn
]
type ('a, 'b) status = [
  1. | 'a success
  2. | 'b error
]
type ('a, 'b) either = ('a, 'b) OpamCompat.Either.t =
  1. | Left of 'a
  2. | Right of 'b

Filenames

type basename = OpamFilename.Base.t

Basenames

type dirname = OpamFilename.Dir.t

Directory names (translated to absolute)

type filename = OpamFilename.t

Filenames

type subpath = OpamFilename.SubPath.t
type filename_set = OpamFilename.Set.t

Set of files

type 'a filename_map = 'a OpamFilename.Map.t

Map of files

type std_path =
  1. | Prefix
  2. | Lib
  3. | Bin
  4. | Sbin
  5. | Share
  6. | Doc
  7. | Etc
  8. | Man
  9. | Toplevel
  10. | Stublibs

Predefined installation directories within a switch

type 'a download =
  1. | Up_to_date of 'a
  2. | Not_available of string option * string
    (*

    Arguments are respectively the short and long version of an error message. The usage is: the first argument is displayed on normal mode (nothing if None), and the second one on verbose mode.

    *)
  3. | Result of 'a

Download result

Packages

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

Packages are (name * version) tuple

type package_set = OpamPackage.Set.t

Set of packages

type 'a package_map = 'a OpamPackage.Map.t

Map of packages

type name = OpamPackage.Name.t

Package names

type name_set = OpamPackage.Name.Set.t

Set of package names

type 'a name_map = 'a OpamPackage.Name.Map.t

Map of package names

type version = OpamPackage.Version.t

Package versions

type version_set = OpamPackage.Version.Set.t

Set of package versions

type opam_version = OpamVersion.t

OPAM versions

Variables

type variable = OpamVariable.t

Variables

type full_variable = OpamVariable.Full.t

Fully qualified variables (ie. with the name of sections/sub-sections they appear in)

type variable_contents = OpamVariable.variable_contents =
  1. | B of bool
  2. | S of string
  3. | L of string list

Content of user-defined variables

A map from variables to their contents (i.e an environment)

type package_flag =
  1. | Pkgflag_LightUninstall
    (*

    The package doesn't require downloading to uninstall

    *)
  2. | Pkgflag_Verbose
    (*

    The package's scripts output is to be displayed to the user

    *)
  3. | Pkgflag_Plugin
    (*

    The package is an opam plugin that will install a opam-<name> exec, and may be auto-installed when doing opam <name>

    *)
  4. | Pkgflag_Compiler
    (*

    Package may be used for 'opam switch'

    *)
  5. | Pkgflag_Conf
    (*

    Virtual package: no source, no install or remove instructions, .install, but likely has depexts

    *)
  6. | Pkgflag_AvoidVersion
    (*

    This version of the package will only be installed if strictly required

    *)
  7. | Pkgflag_Deprecated
    (*

    This version of the package will only be installed if strictly required and will print a deprecation warning

    *)
  8. | Pkgflag_Unknown of string
    (*

    Used for error reporting, otherwise ignored

    *)

Opam package flags

module type GenericPackage = sig ... end

At some point we want to abstract so that the same functions can be used over CUDF and OPAM packages

Formulas

type 'a generic_formula = 'a OpamFormula.formula =
  1. | Empty
  2. | Atom of 'a
  3. | Block of 'a generic_formula
  4. | And of 'a generic_formula * 'a generic_formula
  5. | Or of 'a generic_formula * 'a generic_formula

A generic formula

type atom = OpamFormula.atom

Formula atoms

type formula = OpamFormula.t

Formula over versionned packages

type 'a conjunction = 'a OpamFormula.conjunction

AND formulat

type 'a disjunction = 'a OpamFormula.disjunction

OR formulat

Repositories

type repository_name = OpamRepositoryName.t

Repository names

type 'a repository_name_map = 'a OpamRepositoryName.Map.t

Maps of repository names

type url = OpamUrl.t
type trust_anchors = {
  1. quorum : int;
  2. fingerprints : string list;
}
type repository = {
  1. repo_name : repository_name;
  2. repo_url : url;
  3. repo_trust : trust_anchors option;
}

Repositories

Variable-based filters

type relop = OpamParserTypes.FullPos.relop_kind
type filter =
  1. | FBool of bool
  2. | FString of string
  3. | FIdent of name option list * variable * (string * string) option
    (*

    packages (or None for self-ref through "_"), variable name, string converter (val_if_true, val_if_false_or_undef)

    *)
  4. | FOp of filter * relop * filter
  5. | FAnd of filter * filter
  6. | FOr of filter * filter
  7. | FNot of filter
  8. | FDefined of filter
  9. | FUndef of filter
    (*

    Returned by reduce functions when the filter could not be resolved to an atom (due to undefined variables or string expansions). The argument contains the partially reduced filter, where strings may still contain expansions (and are otherwise escaped). Used both for partial evaluation, and error messaging. Not allowed as an argument to other filters

    *)

Filtered formulas (to express conditional dependencies)

These are first reduced to only the dependency-flag variables build, doc, dev, test defined in Opam formulas

type 'a filter_or_constraint =
  1. | Filter of filter
  2. | Constraint of relop * 'a
type filtered_formula = (name * condition) OpamFormula.formula

Solver

type 'a atomic_action = [
  1. | `Remove of 'a
  2. | `Install of 'a
]

Used internally when computing sequences of actions

type 'a highlevel_action = [
  1. | 'a atomic_action
  2. | `Change of [ `Up | `Down ] * 'a * 'a
  3. | `Reinstall of 'a
]

Used to compact the atomic actions and display to the user in a more meaningful way

type 'a inst_action = [
  1. | `Install of 'a
  2. | `Change of [ `Up | `Down ] * 'a * 'a
]

Sub-type of highlevel_action corresponding to an installed package that changed state or version

type 'a concrete_action = [
  1. | 'a atomic_action
  2. | `Build of 'a
  3. | `Fetch of 'a list
]

Used when applying solutions, separates build from install

type 'a action = [
  1. | 'a atomic_action
  2. | 'a highlevel_action
  3. | 'a concrete_action
]
type 'a cause =
  1. | Use of 'a list
  2. | Required_by of 'a list
  3. | Conflicts_with of 'a list
  4. | Upstream_changes
  5. | Requested
  6. | Unavailable
  7. | Unknown

The possible causes of an action.

type actions_result = {
  1. actions_successes : package action list;
  2. actions_errors : (package action * exn) list;
  3. actions_aborted : package action list;
}

Solver result

type solution_result =
  1. | Nothing_to_do
  2. | OK of package action list
    (*

    List of successful actions

    *)
  3. | Aborted
  4. | Partial_error of actions_result
type ('a, 'b) result =
  1. | Success of 'a
  2. | Conflicts of 'b

Solver result

type solver_criteria = [
  1. | `Default
  2. | `Upgrade
  3. | `Fixup
]
type 'a request = {
  1. criteria : solver_criteria;
  2. wish_install : 'a OpamFormula.formula;
  3. wish_remove : 'a conjunction;
  4. wish_upgrade : 'a conjunction;
  5. wish_all : 'a conjunction;
  6. extra_attributes : string list;
}

Solver request

type user_action =
  1. | Query
  2. | Install
  3. | Upgrade
  4. | Reinstall
  5. | Remove
  6. | Switch
  7. | Import

user request action

type universe = {
  1. u_packages : package_set;
  2. u_installed : package_set;
  3. u_available : package_set;
  4. u_depends : filtered_formula package_map;
  5. u_depopts : filtered_formula package_map;
  6. u_conflicts : formula package_map;
  7. u_action : user_action;
  8. u_installed_roots : package_set;
  9. u_pinned : package_set;
  10. u_invariant : formula;
  11. u_reinstall : package_set;
  12. u_attrs : (string * package_set) list;
}

Solver universe

Command line arguments

type pin_kind = [
  1. | `version
  2. | OpamUrl.backend
]

Pin kind

type powershell_host = OpamStd.Sys.powershell_host =
  1. | Powershell_pwsh
  2. | Powershell

Shell compatibility modes

type shell = OpamStd.Sys.shell =
  1. | SH_sh
  2. | SH_bash
  3. | SH_zsh
  4. | SH_csh
  5. | SH_fish
  6. | SH_pwsh of powershell_host
  7. | SH_cmd

Generic command-line definitions with filters

type simple_arg =
  1. | CString of string
  2. | CIdent of string

A command argument

type arg = simple_arg * filter option

Command argument

type command = arg list * filter option

Command

Switches

type switch = OpamSwitch.t

Compiler switches

type switch_set = OpamSwitch.Set.t

Set of compiler switches

type 'a switch_map = 'a OpamSwitch.Map.t

Map of compile switches

type switch_selections = {
  1. sel_installed : package_set;
  2. sel_roots : package_set;
  3. sel_compiler : package_set;
  4. sel_pinned : package_set;
}

Misc

type lock =
  1. | Read_lock of unit -> unit
    (*

    The function does not modify anything, but it needs the state not to change while it is running.

    *)
  2. | Global_lock of unit -> unit
    (*

    Take the global lock, all subsequent calls to OPAM are blocked.

    *)
  3. | Switch_lock of unit -> switch * unit -> unit
    (*

    Take a global read lock and a switch lock. The first function is called with the read lock, then the second function is called with the returned switch write-locked.

    *)
  4. | Global_with_switch_cont_lock of unit -> switch * (unit -> unit)
    (*

    Call the function in a global lock, then relax to a switch lock and call the function it returned

    *)

The different kinds of locks

type file_attribute = OpamFilename.Attribute.t

A line in urls.tx

type file_attribute_set = OpamFilename.Attribute.Set.t

All the lines in urls.txt

type 'a optional = {
  1. c : 'a;
    (*

    Contents

    *)
  2. optional : bool;
    (*

    Is the contents optional

    *)
}

Optional contents

type stats = {
  1. s_install : int;
  2. s_reinstall : int;
  3. s_upgrade : int;
  4. s_downgrade : int;
  5. s_remove : int;
}

Upgrade statistics

type env = (OpamStd.Env.Name.t * string * string option) list

Environment variables: var name, value, optional comment

type path_format =
  1. | Host
    (*

    use host interpretation of path format

    *)
  2. | Host_quoted
    (*

    use host interpretation of path format and quote resulting path if it contains the separator character

    *)
  3. | Target
    (*

    use the target interpretation of path format (opam file one)

    *)
  4. | Target_quoted
    (*

    use the target interpretation of path format (opam file one) and quote path if it contains the separator character

    *)

Transformation format for environment variable containing paths

type separator =
  1. | SColon
    (*

    Colon separator, i.e. ':'

    *)
  2. | SSemiColon
    (*

    Semi-colon separator, i.e. ';'

    *)

Separator for environment variables containing several paths

type spf_resolved = [
  1. | `resolved
]
type spf_unresolved = [
  1. | `unresolved
]
type _ separator_path_format =
  1. | SPF_Resolved : (separator * path_format) option -> spf_resolved separator_path_format
  2. | SPF_Unresolved : (separator * filter) generic_formula * (path_format * filter) generic_formula -> spf_unresolved separator_path_format

Transformation for environment variables containing paths. They are either unresolved at the beginning SPF_Unresolved, then propagated as resolved SPF_Resolved.

type euok_writeable = [
  1. | `writeable
]
type euok_internal = [
  1. | `internal
  2. | `writeable
]
type ('a, 'b) env_update = {
  1. envu_var : string;
  2. envu_op : 'b env_update_op_kind;
  3. envu_value : string;
  4. envu_comment : string option;
  5. envu_rewrite : 'a separator_path_format option;
}

Environment updates

Repository and global states

type checksums = string list

Checksums

type json = OpamJson.t

JSON

type sys_package = OpamSysPkg.t
type sys_pkg_status = OpamSysPkg.status
OCaml

Innovation. Community. Security.