package opam-core
Install
Dune 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=da12c9c417d078535f66758a36941e3f
sha512=6ad6d0b67c8252444872bb652d85f2d5a35e63df1b25f1d11c23aa39b2ae9e6d075cfa55ece2a4c8875afcc0df94691d05cd058f61744fd9b7c468afa192de09
doc/opam-core/OpamFilename/index.html
Module OpamFilename
Source
Higher level file and directory name manipulation AND file operations, wrappers on OpamSystem using the filename type
Directory names
Cleans the contents of a directory, but keeps the directory in place. Noop if directory doesn't exists.
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).
Turns an assoc list into an array suitable to be provided as environment
val exec :
Dir.t ->
?env:(string * string) list ->
?name:string ->
?metadata:(string * string) list ->
?keep_going:bool ->
string list list ->
unit
Execute a list of commands in a given directory
Copy directory src
to dst
, that is, recursively copy the contents of src
into dst
, overwriting any existing files.
Provide an automatically cleaned up temp directory to a job
Raw function to create a temporary directory. No automatic cleanup
Create a file from a basename and the current working directory as dirname
Prettify a filename:
- replace /path/to/opam/foo by <opam>/foo
- replace /path/to/home/foo by ~/foo
Open a channel from a given file.
with_open_out_bin filename f
opens f
and passes the out_channel to f
. If f
raises an exception, then filename
is deleted and then exception is propagated. The out_channel does not have to be closed by f
.
As with_open_out_bin
except that the file is written atomically. If f
raises an exception, then filename
will be unaltered.
Removes everything in filename
if existed, then write contents
instead.
Returns true if the file exists and is a regular file or a symlink to one
Returns the argument as option if it exists and is either a regular file or a symlink to one
Returns alll the files, including dangling symlinks (which means that not all entries will satisfy exists
).
Copy a file in a directory. If root
is set, copy also the sub-directories. For instance, copy_in ~root:"/foo" "/foo/bar/gni" "/toto"
creates "/toto/bar/gni"
.
val install :
?warning:OpamSystem.install_warning_fn ->
?exec:bool ->
src:t ->
dst:t ->
unit ->
unit
Installs a file to a destination. Optionally set if the destination should be set executable
Symlink a file. If symlink is not possible on the system, use copy instead. With relative
, creates a relative link through the closest common ancestor directory if possible. Otherwise, the symlink is absolute.
Extract an archive in a given directory (it rewrites the root to match Dir.t
dir if needed)
Same as extract
, as an OpamProcess.job
Extract a generic file
dir starts_with pfx dir
Check whether dir
starts with pfx
Apply a patch in a directory. If preprocess
is set to false, there is no CRLF translation. Returns None
on success, the process error otherwise
Returns the closest parent of a directory (including itself) for which the predicate holds, if any
Locking
See OpamSystem.flock
. Prefer the higher level with_flock
functions when possible
val with_flock :
[< OpamSystem.lock_flag ] ->
?dontblock:bool ->
t ->
(Unix.file_descr -> 'a) ->
'a
Calls f
while holding a lock file. Ensures the lock is properly released on f
exit. Raises OpamSystem.Locked
if dontblock
is set and the lock can't be acquired. f
is passed the file_descr of the lock.
val with_flock_upgrade :
[< OpamSystem.actual_lock_flag ] ->
?dontblock:bool ->
OpamSystem.lock ->
(Unix.file_descr -> 'a) ->
'a
Calls f
with the file lock upgraded to at least flag
, then restores the previous lock level. Upgrade to `Lock_write
should never be used in blocking mode as it would deadlock. Raises OpamSystem.Locked
(but keeps the lock as is) if dontblock
is set and the lock can't be upgraded.
val with_flock_write_then_read :
?dontblock:bool ->
t ->
(Unix.file_descr -> 'a) ->
('a -> 'b) ->
'b
Runs first function with a write lock on the given file, then releases it to a read lock and runs the second function.
Convert a filename to an attribute, relatively to a root