Library
Module
Module type
Parameter
Class
Class type
Definitions of many types used throughout
include module type of struct include OpamParserTypes end
Relational operators
type pos = file_name * int * int
Source file positions: (filename, line, column)
type env_update_op = OpamParserTypes.env_update_op =
Environment variable update operators
type value = OpamParserTypes.value =
| Bool of pos * bool
bool
atoms
| Int of pos * int
int
atoms
| String of pos * string
string
atoms
| Relop of pos * relop * value * value
Relational operators with two values (e.g. os != "win32"
)
| Prefix_relop of pos * relop * value
Relational operators in prefix position (e.g. < "4.07.0"
)
| Logop of pos * logop * value * value
Logical operators
*)| Pfxop of pos * pfxop * value
Prefix operators
*)| Ident of pos * string
Identifiers
*)| List of pos * value list
Lists of values ([x1 x2 ... x3]
)
| Group of pos * value list
Groups of values ((x1 x2 ... x3)
)
| Option of pos * value * value list
Value with optional list (x1 {x2 x3 x4}
)
| Env_binding of pos * value * env_update_op * value
Environment variable binding (FOO += "bar"
)
Base values
type opamfile_section = OpamParserTypes.opamfile_section = {
section_kind : string;
Section kind (e.g. extra-source
)
section_name : string option;
Section name (e.g. "myfork.patch"
)
section_items : opamfile_item list;
Content of the section
*)}
An opamfile section
and opamfile_item = OpamParserTypes.opamfile_item =
| Section of pos * opamfile_section
e.g. kind ["name"] { ... }
| Variable of pos * string * value
e.g. opam-version: "2.0"
An opamfile is composed of sections and variable definitions
type opamfile = OpamParserTypes.opamfile = {
file_contents : opamfile_item list;
Content of the file
*)file_name : file_name;
Name of the disk file this record was loaded from
*)}
A file is a list of items and the filename
type basename = OpamFilename.Base.t
Basenames
type dirname = OpamFilename.Dir.t
Directory names (translated to absolute)
type filename = OpamFilename.t
Filenames
type filename_set = OpamFilename.Set.t
Set of files
type 'a filename_map = 'a OpamFilename.Map.t
Map of files
Predefined installation directories within a switch
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
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)
Content of user-defined variables
type variable_map = OpamVariable.variable_contents OpamVariable.Map.t
A map from variables to their contents (i.e an environment)
type package_flag =
| Pkgflag_LightUninstall
The package doesn't require downloading to uninstall
*)| Pkgflag_Verbose
The package's scripts output is to be displayed to the user
*)| Pkgflag_Plugin
The package is an opam plugin that will install a opam-<name>
exec, and may be auto-installed when doing opam <name>
| Pkgflag_Compiler
Package may be used for 'opam switch'
*)| Pkgflag_Conf
Virtual package: no source, no install or remove instructions, .install, but likely has depexts
*)| 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
type 'a generic_formula = 'a OpamFormula.formula =
| Empty
| Atom of 'a
| Block of 'a generic_formula
| And of 'a generic_formula * 'a generic_formula
| 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
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 repository = {
repo_name : repository_name;
repo_root : dirname;
The root of opam's local mirror for this repo
*)repo_url : url;
repo_trust : trust_anchors option;
}
Repositories
type filter =
| FBool of bool
| FString of string
| 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)
*)| FOp of filter * relop * filter
| FAnd of filter * filter
| FOr of filter * filter
| FNot of filter
| 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
*)These are first reduced to only the dependency-flag variables build, doc, dev, test defined in Opam formulas
type filtered_formula =
(name * filter filter_or_constraint OpamFormula.formula) OpamFormula.formula
Used internally when computing sequences of actions
type 'a highlevel_action = [
| 'a atomic_action
| `Change of [ `Up | `Down ] * 'a * 'a
| `Reinstall of 'a
]
Used to compact the atomic actions and display to the user in a more meaningful way
Sub-type of highlevel_action
corresponding to an installed package that changed state or version
Used when applying solutions, separates build from install
type 'a request = {
criteria : solver_criteria;
wish_install : 'a conjunction;
wish_remove : 'a conjunction;
wish_upgrade : 'a conjunction;
extra_attributes : string list;
}
Solver request
type user_action =
| Install of name_set
Just install the requested packages. Add name_set
as roots.
| Upgrade of package_set * name_set
Upgrade the requested packages, and reinstall package_set
. Also add name_set
as roots.
| Reinstall of package_set
Just reinstall package_set
| Depends
Just querying dependencies, no action will be taken
*)| Remove
Just remove the requested packages
*)| Switch of name_set
Switch init request, add name_set
as roots
| Import of name_set
Switch import request, add name_set
as roots
user request action
type universe = {
u_packages : package_set;
u_installed : package_set;
u_available : package_set;
u_depends : filtered_formula package_map;
u_depopts : filtered_formula package_map;
u_conflicts : formula package_map;
u_action : user_action;
u_installed_roots : package_set;
u_pinned : package_set;
u_dev : package_set;
packages with a version-controlled upstream
*)u_base : package_set;
u_attrs : (string * package_set) list;
u_test : package_set;
Test dependencies should be honored
*)u_doc : package_set;
Doc dependencies should be honored
*)}
Solver universe
Pin kind
type arg = simple_arg * filter option
Command argument
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 = {
sel_installed : package_set;
sel_roots : package_set;
sel_compiler : package_set;
sel_pinned : package_set;
}
type lock =
| Read_lock of unit -> unit
The function does not modify anything, but it needs the state not to change while it is running.
*)| Global_lock of unit -> unit
Take the global lock, all subsequent calls to OPAM are blocked.
*)| 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.
*)| 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
Optional contents
Upgrade statistics
Environement variables: var name, value, optional comment
type env_update = string * env_update_op * string * string option
Environment updates
var, update_op, value, comment
type tags = OpamStd.String.Set.t OpamStd.String.SetMap.t
Tags
type json = OpamJson.t
JSON