Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(description
"OBuilder takes a build script (similar to a Dockerfile) and performs the steps in it in a sandboxed environment.")
(depends
(lwt (>= 5.5.0))
(lwt (>= 5.6.1))
astring
(fmt (>= 0.8.9))
logs
Expand Down
4 changes: 2 additions & 2 deletions example.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
; The result can then be found in /tank/HASH/rootfs/ (where HASH is displayed at the end of the build).

((build dev
((from ocaml/opam@sha256:080c55f617d4cdb8e75b9d7b2d4f2ab2faa11af9125f8bcc4fed99b4a1f5a01f)
((from ocaml/opam@sha256:5b9de826b22c77a0654519d0959536f93a6ffd7020712a8b1c3437445e031e04)
(workdir /src)
(user (uid 1000) (gid 1000)) ; Build as the "opam" user
(run (shell "sudo chown opam /src"))
(env OPAM_HASH "e637ce47cd89e52fce3a0928ddbe3439c6616479") ; Fix the version of opam-repository we want
(env OPAM_HASH "97da9a1b68b824a65a09e5f7d071fcf2da35bd1b") ; Fix the version of opam-repository we want
(run
(network host)
(shell "sudo apt-get --allow-releaseinfo-change update"))
Expand Down
6 changes: 3 additions & 3 deletions lib/build_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ type t = {
}

let with_dup fd fn =
let fd = Lwt_unix.dup fd in
Lwt_unix.set_close_on_exec fd;
let fd = Lwt_unix.dup ~cloexec:true fd in
Lwt.finalize
(fun () -> fn fd)
(fun () -> Lwt_unix.close fd)
Expand All @@ -30,7 +29,8 @@ let tail ?switch t dst =
match t.state with
| `Finished -> invalid_arg "tail: log is finished!"
| `Readonly path ->
Lwt_io.(with_file ~mode:input) path @@ fun ch ->
let flags = [Unix.O_RDONLY; Unix.O_NONBLOCK; Unix.O_CLOEXEC] in
Lwt_io.(with_file ~mode:input ~flags) path @@ fun ch ->
let buf = Bytes.create max_chunk_size in
let rec aux () =
Lwt_io.read_into ch buf 0 max_chunk_size >>= function
Expand Down
3 changes: 2 additions & 1 deletion lib/os.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ let rec write_all fd buf ofs len =
)

let write_file ~path contents =
Lwt_io.(with_file ~mode:output) path @@ fun ch ->
let flags = [Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; Unix.O_NONBLOCK; Unix.O_CLOEXEC] in
Lwt_io.(with_file ~mode:output ~flags) path @@ fun ch ->
Lwt_io.write ch contents

let with_pipe_from_child fn =
Expand Down
3 changes: 2 additions & 1 deletion lib/tar_transfer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ let copy_file ~src ~dst ~to_untar ~user =
dst stat.Lwt_unix.LargeFile.st_size
in
Tar_lwt_unix.write_block ~level hdr (fun ofd ->
Lwt_io.(with_file ~mode:input) src (copy_to ~dst:ofd)
let flags = [Unix.O_RDONLY; Unix.O_NONBLOCK; Unix.O_CLOEXEC] in
Lwt_io.(with_file ~mode:input ~flags) src (copy_to ~dst:ofd)
) to_untar

let copy_symlink ~src ~target ~dst ~to_untar ~user =
Expand Down
2 changes: 1 addition & 1 deletion obuilder.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ doc: "https://ocurrent.github.io/obuilder/"
bug-reports: "https://github.com/ocurrent/obuilder/issues"
depends: [
"dune" {>= "2.7"}
"lwt" {>= "5.5.0"}
"lwt" {>= "5.6.1"}
"astring"
"fmt" {>= "0.8.9"}
"logs"
Expand Down