opam-state

State library for opam 2.1

Initialises a new switch with the given name in the given opam root, registers it in the global config and returns the updated global state

val write_selections : OpamStateTypes.rw OpamStateTypes.switch_state -> unit

Writes the current state file to disk (installed, pinned, root packages etc.). Unless OpamStateConfig.(!r.dryrun)

Updates the global default switch to the one corresponding to the given state; fails and exits with a message if the switch is external

val gen_switch_config : OpamTypes.dirname -> ?synopsis:string -> ?repos:OpamTypes.repository_name list -> ?invariant:OpamTypes.formula -> OpamTypes.switch -> OpamFile.Switch_config.t

Create the default global_config structure for a switch, including default prefix

val install_switch_config : OpamTypes.dirname -> OpamTypes.switch -> OpamFile.Switch_config.t -> unit

(Re-)install the configuration for a given root and switch

Add the package metadata to the switch-local cache of installed packages

Remove the metadata of the package from the switch-local cache of installed packages

Update the on-disk set of packages marked to reinstall on the current switch (excepting compiler packages, and pinned packages if unpinned_only is set)

Updates the package selections and switch config to take into account the given newly installed package. The updated state is written to disk unless OpamStateConfig.(!r.dry_run) and returned.

Updates the package selections and switch config to take into account the removed package. The updated state is written to disk unless OpamStateConfig.(!r.dry_run), and returned. If keep_as_root, the package isn't removed from the switch state installed_roots set.

Update the switch selections with the supplied optional arguments. Changes are written to disk and returned