package opam-client

  1. Overview
  2. Docs

Functions handling the "opam switch" subcommand

Creates and configures a new switch. The given global_state is unlocked once done. update_config sets the switch as current globally, unless it is external.

post can be used to run guarded operations after the switch creation (cleanup will be proposed to the user if they fail). You probably want to call install_compiler there.

val install_compiler : ?additional_installs:OpamTypes.atom list -> ?deps_only:bool -> ?ask:bool -> OpamStateTypes.switch_state -> OpamStateTypes.switch_state

Used to initially install a compiler's base packages, according to its invariant. ask triggers prompting the user as for normal installs; defaults to false.

Import a file which contains the packages to install.

val export : 'a OpamStateTypes.repos_state -> ?freeze:bool -> ?full:bool -> ?switch:OpamTypes.switch -> OpamFile.SwitchExport.t OpamFile.t option -> unit

Export a file which contains the installed packages. If full is specified and true, export metadata of all installed packages (excluding overlay files) as part of the export. The export will be extended with a map of all extra-files. If freeze is specified and true, VCS urls will be frozen to the specific commit ID. If None is provided as file argument, the export is done to stdout.

Remove the given compiler switch, and returns the updated state (unchanged in case confirm is true and the user didn't confirm)

Changes the currently active switch

Updates the switch invariant and the associated config files, and writes the config file unless show or dry_run are activated globally. Low-level function, see set_invariant for the user-facing function.

Sets the packages configured as the current switch compiler base, after some checks and messages.

val show : unit -> unit

Display the current compiler switch.

val list : 'a OpamStateTypes.global_state -> print_short:bool -> unit

List all the available compiler switches.

val get_compiler_packages : ?repos:OpamTypes.repository_name list -> 'a OpamStateTypes.repos_state -> OpamTypes.package_set

Returns all available compiler packages from a repo state

val guess_compiler_invariant : ?repos:OpamTypes.repository_name list -> 'a OpamStateTypes.repos_state -> string list -> OpamFormula.t

Guess a real compiler spec from a list of strings, which may refer to packages with optional version constraints, or just versions. This uses some heuristics.