package opam-core
Install
dune-project
Dependency
Authors
-
David Allsopp
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRaja Boujbel <raja.boujbel@ocamlpro.com>
-
KKate Deplaix <kit-ty-kate@outlook.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=f509aa3ca69423d6f4fc8c703f78a566
sha512=4a52fa74e2a3b975623f6eac169042d1ca9e18ec77693a8f24d0eb59c97737b3bb8e659d609e283c293ce6eef4395a9eda20b317d30a88dfa8b88171694b1660
doc/opam-core/OpamSystem/index.html
Module OpamSystemSource
Bindings of lots of filesystem and system operations
Exception raised when subprocess fails
Raise exception Process_error with the given result
Raise exception Process_error with the given result if the process didn't return 0
Exception raised when a computation in the current process fails.
Raise exception Internal_error with the given string format
with_tmp_dir fn executes fn creates a temporary directory and passes its name to fn. The directory is always removed on completion.
in_tmp_dir fn executes fn in a temporary directory.
Runs a job with a temp dir that is cleaned up afterwards
with_tmp_file fn creates a file name in temporary directory and passes it to fn. The file is always removed on completion.
Runs a job with a file in temporary directory that is cleaned up afterwards
Returns true if the default verbose level for base commands (cp, mv, etc.) is reached
Filesystem management
Returns a directory name, in the temporary directory, composed by opam (if prefix is not set), pid, and random number.
Returns a directory name, in the ~dir, composed by opam (if prefix is not set), and a random number.
copy_file src dst copies src to dst. Remove dst before the copy if it is a link.
copy_dir src dst copies the contents of directory src into directory dst, creating it if necessary, merging directory contents and ovewriting files otherwise
Same as copy_dir except it avoids copying VCS directories (.git, .hg, _darcs)
type install_warning = [ | `Add_exe| `Install_dll| `Install_script| `Install_unknown| `Cygwin| `Msys2| `Tainted of [ `Msys2 | `Cygwin ]| `Cygwin_libraries
]Warnings which come from install
The default warning function - displays a message on OpamConsole
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.
Return the contents of a channel.
Raised when a file or directory can't be accessed (doesn't exist, bad permissions, etc.)
read filename returns the contents of filename (while taking an advisory read lock to prevent concurrent writes)
write filename contents write contents to filename (while taking an advisory write lock to prevent concurrent reads or writes)
get_files dir returns the list of files (without prefix) inside the directory dir.
Same as get_files except it avoids copying VCS directories (.git, .hg, _darcs)
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).
Removes an empty directory, as well as any empty leading path components. Must be called only on a directory that is known to not have empty parents, only internal opam directory (and not tmp dir).
Change the current working directory
in_dir dir fn evaluates fn in the directory dir
Returns the list of files and directories in the given directory (full names)
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.
Return the list of files in the current directory.
Return the list of files in the current directory, inclduing any dangling symlinks.
rec_dirs dir return the list list of all directories recursively (going through symbolink links).
Return the list of directories in the current directory.
Returns whether a directory is empty. Returns None if the directory could not be found.
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 ->
?stdout:string ->
?dir:string ->
?resolve_path:bool ->
string ->
string list ->
OpamProcess.commandMake 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.
OLD COMMAND API, DEPRECATED
a command is a list of words
As OpamStd.Sys.resolve_command, except the default for ~env is OpamProcess.default_env.
Returns a function which should be applied to arguments for a given command by determining if the command is the Cygwin variant of the command. Returns the identity function otherwise.
Returns a function which should be applied to a path (or a path list), if in a functioning Cygwin or MSYS2 environment, translating the Windows or a Unix path into a Unix path, by calling `cygpath`. Returns the identity function otherwise. pathlist argument permit to specify if it is applied to a path or a path list, by giving the `--path` argument in the last case.
apply_cygpath path applies the `cygpath` command to name using `cygpath -- name`.
val command :
?verbose:bool ->
?env:string array ->
?name:string ->
?metadata:(string * string) list ->
?allow_stdin:bool ->
command ->
unitcommand 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 ->
unitcommands 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 ->
?ignore_stderr:bool ->
command ->
string listread_command_output cmd executes the command cmd in the correct OPAM environment and return the lines from output 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. It returns stdout and stder combiend, unless ignore_stderr is st to true.
END
Test whether the file is an archive, by looking at its magic number if the file exists, otherwise by looking as its extension
Test whether the given path is an archive, only by looking at its extension
extract ~dir:dirname filename extracts the archive filename into dirname. dirname should not exists and filename should contain only one top-level directory.
Same as extract, but as an OpamProcess.job
extract_in ~dir:dirname filename extracts the archive filename into dirname.
extract_in_job is similar to extract_in, but as a job
Create a directory. Do not fail if the directory already exist.
Get the number of active processors on the system
File locking function
Unix file locks (mutable structure, to follow actual semantics)
The different kinds of unix advisory locks available (`Lock_none doesn't actually lock anything, or even create the lock file)
Raised when locks can't be acquired and dontblock was specified)
Force releases all open locks in the process. Required for Windows if an exception has been raised, since Windows doesn't permit unlinking while handles are open.
Acquires a lock on the given file.
Updates an existing lock to the given level. Raises the same exceptions as flock.
Returns the highest of the two lock flags (with the order no lock < read lock < write lock)
Returns true if the lock already has the lock_flag rights or more
Returns the underlying fd for the lock
Misc
Apply a patch file in the current directory. If preprocess is set to false, there is no CRLF translation. Returns the error if the patch didn't apply.
Returns the end-of-line encoding style for the given file. None means that either the encoding of line endings is mixed, or the file contains no line endings at all (an empty file, or a file with one line and no EOL at EOF). Otherwise it returns Some true if all endings are encoded CRLF.
translate_patch ~dir input_patch output_patch writes a copy of input_patch to output_patch as though input_patch had been applied in dir. The patch is rewritten such that if text files have different line endings then the patch is transformed to patch using the encoding on disk. In particular, this means that patches generated against Unix checkouts of Git sources will correctly apply to Windows checkouts of the same sources.
Create a temporary file in ~/.opam/logs/<name>XXX, if dir is not set. ?auto_clean controls whether the file is automatically deleted when opam terminates (default: true).
Registers an exception printer that adds some OPAM version info, and details on process and Unix errors
Initialises signal handlers, catch_break and some exception printers. The lib may not perform properly without this if Sys.catch_break isn't set and SIGPIPE isn't handled (with a no-op)
On Unix, a no-op. On Windows, convert / to \
On Unix, a no-op. On Windows, convert \ to /
val classify_executable :
string ->
[ `Exe of [ `i386 | `x86 | `x86_64 ]
| `Dll of [ `x86 | `x86_64 ]
| `Script
| `Unknown ]Identifies kinds of executable files. At present, only useful on Windows. Executable or DLLs are recognised based on their content, not on their filename. Any file beginning "#!" is assumed to be a shell script and all files are classified `Unknown.