Module OpamState

module OpamState: sig .. end
OPAM client state

type state = {
   partial :bool;
   root :OpamPath.t;
   switch :OpamTypes.switch;
   compiler :OpamTypes.compiler;
   compiler_version :OpamTypes.compiler_version;
   opams :OpamFile.OPAM.t OpamTypes.package_map;
   descrs :OpamFile.Descr.t OpamTypes.package_map;
   repositories :OpamFile.Repo_config.t OpamTypes.repository_name_map;
   packages :OpamTypes.package_set;
   available_packages :OpamTypes.package_set Lazy.t;
   aliases :OpamFile.Aliases.t;
   pinned :OpamFile.Pinned.t;
   installed :OpamFile.Installed.t;
   installed_roots :OpamFile.Installed_roots.t;
   reinstall :OpamFile.Reinstall.t;
   config :OpamFile.Config.t;
   repo_index :OpamFile.Repo_index.t;
}
Client state
val load_state : ?save_cache:bool -> string -> state
Load the client state. The string argument is to identify to call site.
val rebuild_state_cache : unit -> unit
Rebuild the state cache.
val remove_state_cache : unit -> unit
Remove the state cache
val print_stats : unit -> unit
Display stats
val load_repository_state : string -> state
Load repository related states only. All the other fields are left empty.
val load_env_state : string -> state
Load state associated to env variables. All other fields are left empty.
val universe : state -> OpamTypes.user_action -> OpamTypes.universe
Create a universe from the current state

Environment


val get_full_env : state -> OpamTypes.env
Get the current environment.
val get_opam_env : state -> OpamTypes.env
Get only environment modified by OPAM.
val add_to_env : state ->
OpamTypes.env -> (string * string * string) list -> OpamTypes.env
Update an environment.
val print_env_warning : state -> OpamTypes.user_config option -> unit
Print a warning if the environment is not set-up properly.

Initialisation


val update_setup_interactive : state -> OpamTypes.shell -> OpamTypes.filename -> unit
Update the global and user configuration by asking some questions.
val display_setup : state -> OpamTypes.shell -> OpamTypes.filename -> unit
Display the global and user configuration for OPAM.
val update_setup : state ->
OpamTypes.user_config option -> OpamTypes.global_config option -> unit
Update the user configuration.
val update_env_variables : state -> unit
Update the global environment variables.

Substitutions


val contents_of_variable : state -> OpamTypes.full_variable -> OpamTypes.variable_contents
Compute the value of a variable
val substitute_string : state -> string -> string
Substitute a string
val substitute_file : state -> OpamTypes.basename -> unit
Substitute file

Filters


val eval_filter : state -> OpamTypes.filter option -> bool
Evaluate a filter
val filter_commands : state -> OpamTypes.command list -> string list list
Filter a list of commands by:

Repositories


val mem_repository : state -> OpamTypes.package -> bool
Check if a package belongs to a repository
val with_repository : state ->
OpamTypes.package ->
(OpamTypes.repository_root -> OpamTypes.repository -> 'a) -> 'a
Apply a function on the repository which contains a given package
val mem_repository_name : state -> OpamTypes.repository_name -> bool
Check whether a repository name is valid
val find_repository_name : state -> OpamTypes.repository_name -> OpamTypes.repository
Find a repository state, given its name
val string_of_repositories : OpamFile.Repo_config.t OpamTypes.repository_name_map -> string
Pretty print a map of repositories
val package_repository_map : state -> OpamTypes.repository OpamTypes.package_map
Build a map which says in which repository the latest metadata for a given package is. This function is *very* costly (need to scan all the files in the repositories, so don't abuse).
val compiler_repository_map : state ->
(OpamTypes.filename * OpamTypes.filename option) OpamTypes.compiler_map
Build a map which says in which repository the latest metadata for a given compiler is.
val sorted_repositories : state -> OpamTypes.repository list
Sort repositories by priority

Compilers


val compilers : root:OpamTypes.dirname -> OpamTypes.compiler_set
Return the list of available compilers
val install_compiler : state ->
quiet:bool -> OpamTypes.switch -> OpamTypes.compiler -> unit
Install the given compiler
val get_compiler_packages : state -> OpamTypes.compiler -> OpamTypes.atom list
Get the packages associated with the given compiler

Packages


val mem_installed_package_by_name : state -> OpamTypes.name -> bool
Check whether a package name is installed
val find_installed_package_by_name : state -> OpamTypes.name -> OpamTypes.package
Return the installed package with the right name
val mem_installed_package_by_name_aux : OpamTypes.package_set -> OpamTypes.name -> bool
Check whether a package name is installed, but this time using the collection of installed packages as argument
val find_installed_package_by_name_aux : OpamTypes.package_set -> OpamTypes.name -> OpamTypes.package
Return the installed package with the right name, but this time using the collection of installed packages as argument
val find_packages_by_name : state -> OpamTypes.name -> OpamTypes.package_set option
Return all the packages with the given name
val installed_map : state -> OpamTypes.version OpamTypes.name_map
Return a map from package names to package installed version
val base_packages : OpamTypes.name list
Return the base packages
val all_installed : state -> OpamTypes.package_set
Return all the collection of installed packages, for all the available packages

Configuration files


val dot_config : state -> OpamTypes.name -> OpamFile.Dot_config.t
Return the .config file for the given package
val opam : state -> OpamTypes.package -> OpamFile.OPAM.t
Return the OPAM file for the given package
val compiler : state -> OpamTypes.compiler -> OpamFile.Comp.t
Return the compiler descritpion file for the given compiler name

Locks


val check : OpamTypes.lock -> unit
Apply a function while taking the right locks

Pinned packages


val is_pinned : state -> OpamTypes.name -> bool
Is a package pinned ?
val pinned_package : state -> OpamTypes.name -> OpamTypes.package
Get the corresponding pinned package. If the package is pinned to a path (locally or via git/darcs), it returns the latest package as we assume that the most up-to-date build descriptions.
val pinned_path : state -> OpamTypes.name -> OpamTypes.dirname option
Get the path associated to the given pinned package. Return None if the package is not pinned or if it is pinned to a version number.
val update_pinned_package : state -> OpamTypes.name -> OpamTypes.dirname OpamTypes.download
Update pinned package
val add_to_reinstall : state -> all:bool -> OpamTypes.package_set -> unit
Add the given packages to the set of package to reinstall. If all is set, this is done for ALL the switches (useful when a package change upstream for instance). If not, only the reinstall state of the current switch is changed.

System compilers


val create_system_compiler_description : OpamTypes.dirname -> OpamTypes.compiler_version option -> unit
Create $opam/compilers/system.com. Take the global root and the new system compiler version as arguments.

Misc


val confirm : ('a, unit, string, bool) Pervasives.format4 -> 'a
Ask the user to press Y/y/N/n to continue
val check_base_packages : state -> unit
Consistency checks: do the base package for the current compiler are installed ?
module Types: sig .. end
To be able to open OpamState.Types

/ *
val update_hook : (save_cache:bool -> OpamTypes.repository_name list -> unit) Pervasives.ref
Update hook.
val switch_reinstall_hook : (OpamTypes.switch -> unit) Pervasives.ref
Switch reinstall hook.