Module Topkg_care.Archive

Archive file creation.

Ustar archives

val tar : Fpath.t -> exclude_paths:Fpath.set -> root:Fpath.t -> mtime:int -> (string, Bos_setup.R.msg) Bos_setup.result

tar dir ~exclude_paths ~root ~mtime is a (us)tar archive that contains the file hierarchy dir except the relative hierarchies present in exclude_paths. 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.

Note. This is a pure OCaml implementation, no tar tool is needed.

Bzip2 compression and unarchiving

val ensure_bzip2 : unit -> (unit, Bos_setup.R.msg) Bos_setup.result

ensure_bzip2 () makes sure the bzip2 utility is available.

val bzip2 : string -> dst:Fpath.t -> (unit, Bos_setup.R.msg) Bos_setup.result

bzip2 s dst compresses s to dst using bzip2.

val ensure_tar : unit -> (unit, Bos_setup.R.msg) Bos_setup.result

ensure_tar () makes sure the tar utility is available.

val untbz : ?clean:bool -> Fpath.t -> (Fpath.t, Bos_setup.R.msg) Bos_setup.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.