let cat_folder ~host
~(run_program : Machine.Make_fun.t)
?(depends_on=[]) ~files_gzipped ~folder ~destination =
let deps = depends_on in
let open KEDSL in
let name = "cat-folder-" ^ Filename.quote folder in
let edges =
on_failure_activate (Remove.path_on_host ~host destination)
:: List.map ~f:depends_on deps in
if files_gzipped then (
workflow_node (single_file destination ~host)
~edges ~name
~make:(
run_program ~name
Program.(
shf "gunzip -c %s/* > %s" (Filename.quote folder)
(Filename.quote destination)))
) else (
workflow_node
(single_file destination ~host)
~edges ~name
~make:(
run_program ~name
Program.(
shf "cat %s/* > %s" (Filename.quote folder) (Filename.quote destination)))
)