package opam-state
Install
Dune Dependency
Authors
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRaja Boujbel <raja.boujbel@ocamlpro.com>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
AAnil Madhavapeddy <anil@recoil.org>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
RRalf Treinen <ralf.treinen@pps.jussieu.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
Maintainers
Sources
md5=c48e9f56ad418827e3af37d2415213a4
sha512=c0060e609c49a12dc8f64accef990aa593db818b72df3984fb9b4b22d8678b46c515916c84134a62dab614c716b61788eadc954d295f32c1f27d38aec22b3edf
doc/opam-state/OpamEnv/index.html
Module OpamEnv
Source
Process environment setup and handling, shell configuration
Environment handling
val get_full :
set_opamroot:bool ->
set_opamswitch:bool ->
force_path:bool ->
?updates:OpamTypes.env_update list ->
?scrub:string list ->
'a OpamStateTypes.switch_state ->
OpamTypes.env
Get the current environment with OPAM specific additions. If force_path
, the PATH is modified to ensure opam dirs are leading. set_opamroot
and set_opamswitch
can be additionally used to set the OPAMROOT
and OPAMSWITCH
variables. scrub
is a list of environment variables to remove from the environment.
val get_opam :
set_opamroot:bool ->
set_opamswitch:bool ->
force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env
Get only environment modified by OPAM. If force_path
, the PATH is modified to ensure opam dirs are leading. set_opamroot
and set_opamswitch
can be additionally used to set the OPAMROOT
and OPAMSWITCH
variables.
With base
, apply the modifications to the specified base environment
val get_opam_raw :
set_opamroot:bool ->
set_opamswitch:bool ->
?base:OpamTypes.env ->
force_path:bool ->
OpamTypes.dirname ->
OpamTypes.switch ->
OpamTypes.env
Like get_opam
, but reads the cache file from the given opam root and switch instead of computing the environment from a switch state.
With base
, apply the modifications to the specified base environment
Returns the running environment, with any opam modifications cleaned out, and optionally the given updates
Update an environment, including reverting opam changes that could have been previously applied (therefore, don't apply to an already updated env as returned by e.g. get_full
!)
val updates :
set_opamroot:bool ->
set_opamswitch:bool ->
?force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env_update list
Like get_opam
computes environment modification by OPAM , but returns these updates
instead of the new environment.
Check if the shell environment is in sync with the current OPAM switch, unless skip
is true (it's default value is OPAMNOENVNOTICE
Check if the shell environment is in sync with the given opam root and switch (or if OPAMNOENVNOTICE has been set, in which case we just assume it's up to date)
val compute_updates :
?force_path:bool ->
'a OpamStateTypes.switch_state ->
OpamTypes.env_update list
Returns the current environment updates to configure the current switch with its set of installed packages
Returns shell-appropriate statement to evaluate cmd
.
val opam_env_invocation :
?root:string ->
?switch:string ->
?set_opamswitch:bool ->
unit ->
string
Returns "opam env" invocation string together with optional root and switch overrides
val eval_string :
'a OpamStateTypes.global_state ->
?set_opamswitch:bool ->
OpamTypes.switch option ->
string
The shell command to run by the user to set his OPAM environment, adapted to the current shell (as returned by eval `opam config env`
)
Returns the updated contents of the PATH variable for the given opam root and switch (set force_path
to ensure the opam path is leading)
val full_with_path :
force_path:bool ->
?updates:OpamTypes.env_update list ->
OpamTypes.dirname ->
OpamTypes.switch ->
OpamTypes.env
Returns the full environment with only the PATH variable updated, as per path
Shell and initialisation support
val setup :
OpamTypes.dirname ->
interactive:bool ->
?dot_profile:OpamTypes.filename ->
?update_config:bool ->
?env_hook:bool ->
?completion:bool ->
?inplace:bool ->
OpamTypes.shell ->
unit
Sets the opam configuration in the user shell, after detailing the process and asking the user if either update_config
or shell_hook
are unset
val update_user_setup :
OpamTypes.dirname ->
?dot_profile:OpamTypes.filename ->
OpamTypes.shell ->
unit
Update the user configuration in $HOME for good opam integration.
val write_static_init_scripts :
OpamTypes.dirname ->
?completion:bool ->
?env_hook:bool ->
?inplace:bool ->
unit ->
unit
Write the generic scripts in ~/.opam/opam-init needed to import state for various shells. If specified, completion and env_hook files can also be written or removed (the default is to keep them as they are). If inplace
is true, they are updated if they exist.
Write into OpamPath.hooks_dir
the given custom scripts (listed as (filename, content)), normally provided by opamrc (OpamFile.InitConfig
)
Update the shell scripts containing the current switch configuration in ~/.opam/opam-init ; prints a warning and skips if a write lock on the global state can't be acquired (note: it would be better to acquire a write lock beforehand, but only when working on the switch selected in ~/.opam/config)
Removes the dynamic init scripts setting the variables for any given switch.
Print a warning if the environment is not set-up properly. (General message)
Hook directory environment