package opam-lib
Install
Dune Dependency
Authors
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
AAnil Madhavapeddy <anil@recoil.org>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
Maintainers
Sources
sha256=625767c3465219cc8799aad1449c74279b31686db0821300cfdb92fbff17e9fd
md5=e0688c0cf9a55f93ee93f62d07cf6b74
doc/opam-lib/OpamSystem/index.html
Module OpamSystem
Low-level untyped system operations
exception Process_error of OpamProcess.result
Exception raised when subprocess fails
val process_error : OpamProcess.result -> 'a
raise Process_error
val raise_on_process_error : OpamProcess.result -> unit
raise Process_error
if the process didn't return 0
val internal_error : ('a, unit, string, 'b) format4 -> 'a
Raise Internal_error
val with_tmp_dir_job : (string -> 'a OpamProcess.job) -> 'a OpamProcess.job
Runs a job with a temp dir that is cleaned up afterwards
Returns true if the default verbose level for base commands (cp, mv, etc.) is reached
copy src dst
copies src
to dst
. Remove dst
before the copy if it is a link.
install ?exec src dst
copies file src
as file dst
using install
. If exec
, make the resulting file executable (otherwise, look at the permissions of the original file to decide).
Checks if a file is an executable (regular file with execution permission)
link src dst
links src
to dst
. Remove dst
if it is a file, not a directory.
real_path p
returns the real path associated to p
: ..
are expanded and relative paths become absolute.
val string_of_channel : in_channel -> string
Return the contents of a channel.
Raised when a file or directory can't be accessed (doesn't exist, bad permissions, etc.)
remove filename
removes filename
. Works whether filename
is a file or a directory
remove_file filename
removes filename
. Works only for normal files (or also at least for symlinks)
remove_dir filename
removes filename
. Works only for directory (not for symlinks or other files).
files_with_links dir
returns the files in the directory dir
. Links simulating directory are ignored, others links are returned.
rec_files dir
returns the list of all files in dir
, recursively. Links behaving like directory are crossed.
rec_dirs dir
return the list list of all directories recursively (going through symbolink links).
directories_with_links dir
returns the directories in the directory dir
. Links pointing to directory are also returned.
val make_command :
?verbose:bool ->
?env:string array ->
?name:string ->
?text:string ->
?metadata:(string * string) list ->
?allow_stdin:bool ->
?dir:string ->
?check_existence:bool ->
string ->
string list ->
OpamProcess.command
Make a comman suitable for OpamProcess.Job. if verbose
, is set, command and output will be displayed (at command end for the latter, if concurrent commands are running). name
is used for naming log files. text
is what is displayed in the status line for this command. May raise Command_not_found, unless check_existence
is set to false (in which case you can end up with a process error instead)
OLD COMMAND API, DEPRECATED
Test whether a command exists in the environment.
val command :
?verbose:bool ->
?env:string array ->
?name:string ->
?metadata:(string * string) list ->
?allow_stdin:bool ->
command ->
unit
command cmd
executes the command cmd
in the correct OPAM environment.
val commands :
?verbose:bool ->
?env:string array ->
?name:string ->
?metadata:(string * string) list ->
?keep_going:bool ->
command list ->
unit
commands cmds
executes the commands cmds
in the correct OPAM environment. It stops whenever one command fails unless keep_going
is set to true
. In this case, the first error is re-raised at the end.
val read_command_output :
?verbose:bool ->
?env:string array ->
?metadata:(string * string) list ->
?allow_stdin:bool ->
command ->
string list
read_command_output cmd
executes the command cmd
in the correct OPAM environment and return the lines from stdout if the command exists normally. If the command does not exist or if the command exited with a non-empty exit-code, throw an error.
END
extract filename dirname
extracts the archive filename
into dirname
. dirname
should not exists and filename
should contain only one top-level directory.
extract_in filename dirname
extracts the archive filename
into dirname
. dirname
should already exists.
File locking function
val flock : ?read:bool -> string -> lock
Acquires a lock on the given file. Retries 5 times max. By default, this is a write lock.
val funlock : lock -> unit
Releases an acquired lock
Misc
Registers an exception printer that adds some OPAM version info, and details on process and Unix errors