let git_installation
~(run_program : Machine.Make_fun.t)
~host ~install_path
~install_program ~witness
~repository ~recursive tool
=
let open KEDSL in
let recursive = if recursive then "--recursive" else "" in
let version =
(Option.value_exn
tool.Machine.Tool.Definition.version
~msg:"Git_installable tool must have a verison") in
let name = tool.Machine.Tool.Definition.name in
workflow_node
~name:(sprintf "Install %s %s" name version)
witness
~edges:[
on_failure_activate (rm_path ~host install_path);
]
~make:(
run_program
~requirements:[
`Internet_access;
`Self_identification ["git-instalation"; name];
]
Program.(
shf "mkdir -p %s" install_path
&& shf "cd %s" install_path
&& shf "git clone %s %s" recursive repository
&& shf "cd %s" name
&& shf "git checkout %s" version
&& install_program
&& sh "echo Done"
))