OpamStateConfigConfiguration options for the state lib (record, global reference, setter, initialisation)
module E : sig ... endtype t = private {root_dir : OpamFilename.Dir.t;original_root_dir : OpamFilename.Dir.t;root_from : OpamStateTypes.provenance;current_switch : OpamSwitch.t option;switch_from : OpamStateTypes.provenance;jobs : int Stdlib.Lazy.t;dl_jobs : int;build_test : bool;build_doc : bool;dev_setup : bool;dryrun : bool;makecmd : string Stdlib.Lazy.t;ignore_constraints_on : OpamTypes.name_set;unlock_base : bool;no_env_notice : bool;locked : string option;no_depexts : bool;}type 'a options_fun =
?root_dir:OpamFilename.Dir.t ->
?original_root_dir:OpamFilename.Dir.t ->
?root_from:OpamStateTypes.provenance ->
?current_switch:OpamSwitch.t ->
?switch_from:OpamStateTypes.provenance ->
?jobs:int Stdlib.Lazy.t ->
?dl_jobs:int ->
?build_test:bool ->
?build_doc:bool ->
?dev_setup:bool ->
?dryrun:bool ->
?makecmd:string Stdlib.Lazy.t ->
?ignore_constraints_on:OpamTypes.name_set ->
?unlock_base:bool ->
?no_env_notice:bool ->
?locked:string option ->
?no_depexts:bool ->
'ainclude OpamStd.Config.Sig
with type t := t
and type 'a options_fun := 'a options_funval set : t -> (unit -> t) options_funUse to update any option in a t, using the optional arguments of options_fun. E.g. set opts ?option1:1 ?option4:"x" ()
val setk : (t -> 'a) -> t -> 'a options_funSame as set, but passes the result to a continuation, allowing argument stacking
val r : t Stdlib.refThe global reference containing the currently set library options. Access using OpamXxxConfig.(!r.field).
val update : ?noop:_ -> (unit -> unit) options_funUpdates the currently set options in r according to the optional arguments
val init : ?noop:_ -> (unit -> unit) options_funSets the options, reading the environment to get default values when unspecified
val initk : 'a -> 'a options_funSets the options like init, but returns the given value (for arguments stacking)
val default : tDefault state values
val opamroot_with_provenance :
?root_dir:OpamTypes.dirname ->
unit ->
OpamStateTypes.provenance * OpamTypes.dirnameGet the initial opam root value (from default, env or optional argument). This allows one to get it before doing the init, which is useful to get the configuration file used to fill some options to init()
val opamroot : ?root_dir:OpamTypes.dirname -> unit -> OpamTypes.dirnameopamroot ?root_dir () = snd (opamroot_with_provenance ?root_dir ()
val load :
lock_kind:'a OpamStateTypes.lock ->
OpamTypes.dirname ->
OpamFile.Config.t optionLoads the global configuration file, protecting against concurrent writes
val safe_load :
lock_kind:'a OpamStateTypes.lock ->
OpamTypes.dirname ->
OpamFile.Config.tval load_defaults :
lock_kind:'a OpamStateTypes.lock ->
OpamFilename.Dir.t ->
OpamFile.Config.t optionLoads the config file from the OPAM root and updates default values for all related OpamXxxConfig modules. Doesn't read the env yet, the init functions should still be called afterwards. OpamFormatConfig should be initialised beforehand, as it may impact the config file loading.
Returns the config file that was found, if any
val get_switch : unit -> OpamTypes.switchReturns the current switch, failing with an error message is none is set.
val get_switch_opt : unit -> OpamTypes.switch optionReturns the current switch, if any is set.
val get_current_switch_from_cwd : OpamFilename.Dir.t -> OpamTypes.switch optionThe function used to locate an external switch from parents of the current directory. Takes the opam root as parameter, and rejects any external switch configured with a different root
val local_switch_exists : OpamFilename.Dir.t -> OpamTypes.switch -> boolChecks if a local switch exists and is configurade for the given root
val resolve_local_switch :
OpamFilename.Dir.t ->
OpamTypes.switch ->
OpamTypes.switchResolves the switch if it is a link to a global switch in the given root (return unchanged otherwise)
val is_newer_than_self :
lock_kind:'a OpamStateTypes.lock ->
'b OpamStateTypes.global_state ->
boolGiven the required lock, returns true if the opam root is newer than the binary, so that it can only be loaded read-only by the current binary.
val is_newer : OpamFile.Config.t -> boolCheck config root version regarding self-defined one
val load_config_root :
lock_kind:'a OpamStateTypes.lock ->
((OpamFile.Config.t OpamFile.t -> 'b) * (OpamFile.Config.t OpamFile.t -> 'b)) ->
OpamTypes.dirname ->
'bmodule Switch : sig ... endmodule Repos : sig ... endval downgrade_2_1_switch :
OpamFile.Switch_config.t OpamFile.t ->
OpamFile.Switch_config.t option