Skip to content

Commit

Permalink
Merge pull request #40 from talex5/unused
Browse files Browse the repository at this point in the history
Remove unused function
  • Loading branch information
talex5 authored Oct 30, 2020
2 parents 924fb77 + f8938f2 commit 254935e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module Make (Raw_store : S.STORE) (Sandbox : S.SANDBOX) = struct
log `Heading (Fmt.strf "FROM %s" base);
let id = Sha256.to_hex (Sha256.string base) in
Store.build t.store ~id ~log (fun ~cancelled:_ ~log:_ tmp ->
Fmt.pr "Base image not present; importing %S...@." base;
Log.info (fun f -> f "Base image not present; importing %S...@." base);
let rootfs = tmp / "rootfs" in
Os.sudo ["mkdir"; "--mode=755"; "--"; rootfs] >>= fun () ->
(* Lwt_process.exec ("", [| "docker"; "pull"; "--"; base |]) >>= fun _ -> *)
Expand Down
6 changes: 0 additions & 6 deletions lib/os.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ let sudo_result ?cwd ?stdin ?stdout ?stderr ~pp args =
let args = if running_as_root then args else "sudo" :: args in
exec_result ?cwd ?stdin ?stdout ?stderr ~pp args

let with_open_out path fn =
Lwt_unix.openfile path Unix.[O_RDWR; O_CREAT; O_EXCL] 0o666 >>= fun fd ->
Lwt.finalize
(fun () -> fn fd)
(fun () -> Lwt_unix.close fd)

let rec write_all fd buf ofs len =
assert (len >= 0);
if len = 0 then Lwt.return_unit
Expand Down
6 changes: 5 additions & 1 deletion lib/tar_transfer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let copy_symlink ~src ~target ~dst ~to_untar ~user =
Tar_lwt_unix.write_block hdr (fun _ -> Lwt.return_unit) to_untar

let rec copy_dir ~src_dir ~src ~dst ~(items:(Manifest.t list)) ~to_untar ~user =
Fmt.pr "Copy dir %S -> %S@." src dst;
Log.debug(fun f -> f "Copy dir %S -> %S@." src dst);
Lwt_unix.LargeFile.lstat (src_dir / src) >>= fun stat ->
begin
let hdr = Tar.Header.make
Expand All @@ -106,7 +106,10 @@ let rec copy_dir ~src_dir ~src ~dst ~(items:(Manifest.t list)) ~to_untar ~user =
copy_dir ~src_dir ~src ~dst ~items ~to_untar ~user
)

let remove_leading_slashes = Astring.String.drop ~sat:((=) '/')

let send_files ~src_dir ~src_manifest ~dst_dir ~user ~to_untar =
let dst_dir = remove_leading_slashes dst_dir in
src_manifest |> Lwt_list.iter_s (function
| `File (path, _) ->
let src = src_dir / path in
Expand All @@ -124,6 +127,7 @@ let send_files ~src_dir ~src_manifest ~dst_dir ~user ~to_untar =
Tar_lwt_unix.write_end to_untar

let send_file ~src_dir ~src_manifest ~dst ~user ~to_untar =
let dst = remove_leading_slashes dst in
begin
match src_manifest with
| `File (path, _) ->
Expand Down

0 comments on commit 254935e

Please sign in to comment.