-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy patharchive.mli
More file actions
60 lines (47 loc) · 2.7 KB
/
archive.mli
File metadata and controls
60 lines (47 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(*---------------------------------------------------------------------------
Copyright (c) 2016 Daniel C. Bünzli. All rights reserved.
Distributed under the ISC license, see terms at the end of the file.
%%NAME%% %%VERSION%%
---------------------------------------------------------------------------*)
(** Archive creation. *)
open Bos_setup
(** {1 Ustar archives} *)
val tar :
Fpath.t ->
exclude_paths:Fpath.set ->
export_ignore:Gitattributes.pattern list ->
root:Fpath.t ->
mtime:int64 ->
(string, R.msg) result
(** [tar dir ~exclude_paths ~export_ignore ~root ~mtime] is a (us)tar archive
that contains the file hierarchy [dir] except:
- relative hierarchies present in [exclude_paths] (basename matching)
- files matching patterns in [export_ignore] (from [.gitattributes])
In the archive, members of [dir] are rerooted at [root] and sorted according
to {!Fpath.compare}. They have their modification time set to [mtime] and
their file permissions are [0o775] for directories and files executable by
the user and [0o664] for other files. No other file metadata is preserved.
{b Note.} This is a pure OCaml implementation, no [tar] tool is needed. *)
(** {1 Bzip2 compression and unarchiving} *)
val ensure_bzip2 : unit -> (unit, R.msg) result
(** [ensure_bzip2 ()] makes sure the [bzip2] utility is available. *)
val bzip2 :
dry_run:bool -> ?force:bool -> dst:Fpath.t -> string -> (unit, R.msg) result
(** [bzip2 dst s] compresses [s] to [dst] using bzip2. *)
val untbz : dry_run:bool -> ?clean:bool -> Fpath.t -> (Fpath.t, R.msg) result
(** [untbz ~clean ar] untars the tar bzip2 archive [ar] in the same directory as
[ar] and returns a base directory for [ar]. If [clean] is [true] (defaults
to [false]) first delete the base directory if it exists. *)
(*---------------------------------------------------------------------------
Copyright (c) 2016 Daniel C. Bünzli
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------*)