Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 147 lines (109 sloc) 5.562 kB
ba39c27 @samoht More WIP.
samoht authored
1 (***********************************************************************)
2 (* *)
3 (* Copyright 2012 OCamlPro *)
4 (* Copyright 2012 INRIA *)
5 (* *)
6 (* All rights reserved. This file is distributed under the terms of *)
7 (* the GNU Public License version 3.0. *)
8 (* *)
4ca3c23 @samoht Remove TypeRex from headers
samoht authored
9 (* OPAM is distributed in the hope that it will be useful, *)
ba39c27 @samoht More WIP.
samoht authored
10 (* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
11 (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
12 (* GNU General Public License for more details. *)
13 (* *)
14 (***********************************************************************)
15
e04535c @samoht Add API documentation
samoht authored
16 (** Low-level untyped system operations. *)
17
a30a0b9 @samoht Improve the reporting of errors
samoht authored
18 (** Exception raised when subprocess fails *)
aa67aa9 @samoht Big refactoring work.
samoht authored
19 exception Process_error of OpamProcess.result
a30a0b9 @samoht Improve the reporting of errors
samoht authored
20
21 (** raise [Process_error] *)
aa67aa9 @samoht Big refactoring work.
samoht authored
22 val process_error: OpamProcess.result -> 'a
a30a0b9 @samoht Improve the reporting of errors
samoht authored
23
24 (** Exception raised when a computation in the current process
25 fails. *)
26 exception Internal_error of string
27
28 (** Raise [Internal_error] *)
29 val internal_error: ('a, unit, string, 'b) format4 -> 'a
30
31
458ef71 @samoht Refactoring of the curl/rsync backend
samoht authored
32 (** [with_tmp_dir fn] executes [fn] in a tempory directory *)
33 val with_tmp_dir: (string -> 'a) -> 'a
b097165 @samoht [curl] Add a new repository backend, based on curl/wget, as rsync-ing…
samoht authored
34
197fa95 @tuong fix the copy of files to a location where there is a symbolic link
tuong authored
35 (** [copy src dst] copies [src] to [dst]. Remove [dst] before the copy if it is a link. *)
ba39c27 @samoht More WIP.
samoht authored
36 val copy: string -> string -> unit
37
197fa95 @tuong fix the copy of files to a location where there is a symbolic link
tuong authored
38 (** [link src dst] links [src] to [dst]. Remove [dst] if it is a file, not a directory. *)
ba39c27 @samoht More WIP.
samoht authored
39 val link: string -> string -> unit
40
41 (** [real_path p] returns the real path associated to [p]: [..] are
42 expanded and relative paths become absolute. *)
43 val real_path: string -> string
44
45 (** [read filename] returns the contents of [filename] *)
46 val read: string -> string
47
48 (** [write filename contents] write [contents] to [filename] *)
49 val write: string -> string -> unit
50
51 (** [remove filename] removes [filename]. Works whether [filename] is
52 a file or a directory *)
53 val remove: string -> unit
54
55 (** [remove_file filename] removes [filename]. Works only for normal
0b7a2c8 @tuong [run.ml/remove_dir] fix the failure of [remove_dir] when some symboli…
tuong authored
56 files (or also at least for symlinks) *)
ba39c27 @samoht More WIP.
samoht authored
57 val remove_file: string -> unit
58
59 (** [remove_dir filename] removes [filename]. Works only for
0b7a2c8 @tuong [run.ml/remove_dir] fix the failure of [remove_dir] when some symboli…
tuong authored
60 directory (not for symlinks or other files). *)
ba39c27 @samoht More WIP.
samoht authored
61 val remove_dir: string -> unit
62
bd3a033 @samoht [repo-server] read/write OPAM server can now be used as a repository …
samoht authored
63 (** Change the current working directory *)
64 val chdir: string -> unit
65
ba39c27 @samoht More WIP.
samoht authored
66 (** [in_dir dir fn] evaluates [fn] in the directory [dir] *)
67 val in_dir: string -> (unit -> 'a) -> 'a
68
0b7a2c8 @tuong [run.ml/remove_dir] fix the failure of [remove_dir] when some symboli…
tuong authored
69 (** [files_with_links dir] returns the files in the directory [dir].
70 Links simulating directory are ignored, others links are returned. *)
71 val files_with_links: string -> string list
ba39c27 @samoht More WIP.
samoht authored
72
c58504d @samoht remove spaces (cont)
samoht authored
73 (** [rec_files dir] returns the list of all files in [dir],
0b7a2c8 @tuong [run.ml/remove_dir] fix the failure of [remove_dir] when some symboli…
tuong authored
74 recursively.
75 Links behaving like directory are crossed. *)
b097165 @samoht [curl] Add a new repository backend, based on curl/wget, as rsync-ing…
samoht authored
76 val rec_files: string -> string list
77
0492aae @samoht [switch] More improvments
samoht authored
78 (** Return the version of the current OCaml compiler. If no OCaml
79 compiler is present in the path, then it returns [None]. *)
80 val ocaml_version: unit -> string option
81
d6703be @samoht [switch] Fix the handling of CAML_LD_LIBRARY_PATH when switching betw…
samoht authored
82 (** Return the path where the system ocamlc library is installed *)
83 val system_ocamlc_where: unit -> string option
1a8edd1 @samoht Support for local env variables when building a package
samoht authored
84
0b7a2c8 @tuong [run.ml/remove_dir] fix the failure of [remove_dir] when some symboli…
tuong authored
85 (** [directories_with_links dir] returns the directories in the directory [dir].
86 Links pointing to directory are also returned. *)
87 val directories_with_links: string -> string list
bc5a548 @samoht [git] Add git repository pluggins
samoht authored
88
54edd49 @samoht Import from typerex a module to handle correctly synchronous command …
samoht authored
89 (** a command is a list of words *)
90 type command = string list
91
92 (** [command cmd] executes the command [cmd]. Return the exit code. *)
2f59c67 @samoht [switch] Improve 'opam switch' to be able to install the psellos iPho…
samoht authored
93 val command:
b4aa5b1 @samoht [curl/wget] test whether curl/wget are installed on the system instea…
samoht authored
94 ?verbose:bool ->
2f59c67 @samoht [switch] Improve 'opam switch' to be able to install the psellos iPho…
samoht authored
95 ?add_to_env:(string*string) list ->
a30a0b9 @samoht Improve the reporting of errors
samoht authored
96 ?add_to_path:string list -> command -> unit
ba39c27 @samoht More WIP.
samoht authored
97
c58504d @samoht remove spaces (cont)
samoht authored
98 (** [commands ~add_to_path cmds] executes the commands [cmds]
99 in a context where $PATH contains [add_to_path] at the beginning.
c5366ab @tuong [OCaml version] At installation time, the $PATH is automatically adap…
tuong authored
100 It stops whenever one command fails. *)
2f59c67 @samoht [switch] Improve 'opam switch' to be able to install the psellos iPho…
samoht authored
101 val commands:
b4aa5b1 @samoht [curl/wget] test whether curl/wget are installed on the system instea…
samoht authored
102 ?verbose:bool ->
2f59c67 @samoht [switch] Improve 'opam switch' to be able to install the psellos iPho…
samoht authored
103 ?add_to_env:(string*string) list ->
a30a0b9 @samoht Improve the reporting of errors
samoht authored
104 ?add_to_path:string list -> command list -> unit
ba39c27 @samoht More WIP.
samoht authored
105
54edd49 @samoht Import from typerex a module to handle correctly synchronous command …
samoht authored
106 (** [read_command_output cmd] executes the command [cmd] and return
d72de1d @samoht More cleanups
samoht authored
107 the lines from stdout *)
d6703be @samoht [switch] Fix the handling of CAML_LD_LIBRARY_PATH when switching betw…
samoht authored
108 val read_command_output: ?path:string list -> command -> string list
d72de1d @samoht More cleanups
samoht authored
109
0c21f91 @samoht Simplification of backends code
samoht authored
110 (** Test whether the file is an archive, by looking as its extension *)
111 val is_tar_archive: string -> bool
112
458ef71 @samoht Refactoring of the curl/rsync backend
samoht authored
113 (** [extract filename dirname] extracts the archive [filename] into
114 [dirname]. [dirname] should not exists and [filename] should
115 contain only one top-level directory.*)
ba39c27 @samoht More WIP.
samoht authored
116 val extract: string -> string -> unit
d72de1d @samoht More cleanups
samoht authored
117
458ef71 @samoht Refactoring of the curl/rsync backend
samoht authored
118 (** [extract_in filename dirname] extracts the archive [filename] into
119 [dirname]. [dirname] should already exists. *)
120 val extract_in: string -> string -> unit
121
d72de1d @samoht More cleanups
samoht authored
122 (** Create a directory. Do not fail if the directory already
123 exist. *)
124 val mkdir: string -> unit
c1b55c6 @samoht Add a global lock file to avoid multiple clients running in parallel.
samoht authored
125
126 (** {2 File locking function} *)
127
128 (** [flock ()] takes the global file lock. If the lock is already
129 taken, sleep for 1s and then retry. Abort after 5 tentatives. *)
130 val flock: unit -> unit
131
132 (** [funlock ()] unlocks the global file lock. Work only if the
133 current processus is the same as the one who took the lock at the
134 first place. *)
135 val funlock: unit -> unit
136
137 (** Functional version of [flock / funlock] *)
591a37d @tuong Fix the locking of operations
tuong authored
138 val with_flock: (unit -> unit) -> unit
093774d @samoht [switch] Store .comp files in OPAM repositories as well
samoht authored
139
140 (** {2 Function used only by the switch commnand} *)
141
458ef71 @samoht Refactoring of the curl/rsync backend
samoht authored
142 (** download compiler sources *)
a30a0b9 @samoht Improve the reporting of errors
samoht authored
143 val download: filename:string -> dirname:string -> string
2f59c67 @samoht [switch] Improve 'opam switch' to be able to install the psellos iPho…
samoht authored
144
a30a0b9 @samoht Improve the reporting of errors
samoht authored
145 (** Apply a patch file in the current directory. *)
146 val patch: string -> unit
Something went wrong with that request. Please try again.