From d600db2158c0bc3c654dac8ca598be92beee1856 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 23 May 2018 23:47:56 +0700 Subject: [PATCH] Change Build_job to be set The elements are unique and the order isn't well defined anyway Signed-off-by: Rudi Grinberg --- bin/main.ml | 3 ++- src/action.ml | 1 - src/process.ml | 3 ++- src/process.mli | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index e9d20176..60a0a046 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1044,12 +1044,13 @@ let install_uninstall ~what = in Fiber.parallel_iter install_files_by_context ~f:(fun (context, install_files) -> + let install_files_set = Path.Set.of_list install_files in get_prefix context ~from_command_line:prefix_from_command_line >>= fun prefix -> get_libdir context ~libdir_from_command_line >>= fun libdir -> Fiber.parallel_iter install_files ~f:(fun path -> - let purpose = Process.Build_job install_files in + let purpose = Process.Build_job install_files_set in Process.run ~purpose ~env:setup.env Strict opam_installer ([ sprintf "-%c" what.[0] ; Path.to_string path diff --git a/src/action.ml b/src/action.ml index dd0b02ef..88d993c1 100644 --- a/src/action.ml +++ b/src/action.ml @@ -929,7 +929,6 @@ let exec ~targets ~context t = | None -> Env.initial | Some c -> c.env in - let targets = Path.Set.to_list targets in let purpose = Process.Build_job targets in let ectx = { purpose; context } in exec t ~ectx ~dir:Path.root ~env ~stdout_to:None ~stderr_to:None diff --git a/src/process.ml b/src/process.ml index 000d8364..6c59b2aa 100644 --- a/src/process.ml +++ b/src/process.ml @@ -46,7 +46,7 @@ and opened_file_desc = type purpose = | Internal_job - | Build_job of Path.t list + | Build_job of Path.Set.t module Temp = struct let tmp_files = ref Path.Set.empty @@ -157,6 +157,7 @@ module Fancy = struct split_paths (("alias " ^ Path.to_string name) :: targets_acc) (add_ctx ctx ctxs_acc) rest in + let targets = Path.Set.to_list targets in let target_names, contexts = split_paths [] [] targets in let target_names_grouped_by_prefix = List.map target_names ~f:Filename.split_extension_after_dot diff --git a/src/process.mli b/src/process.mli index 9b16d3f0..2e6a2007 100644 --- a/src/process.mli +++ b/src/process.mli @@ -34,7 +34,7 @@ and opened_file_desc = (** Why a Fiber.t was run *) type purpose = | Internal_job - | Build_job of Path.t list + | Build_job of Path.Set.t (** [run ?dir ?stdout_to prog args] spawns a sub-process and wait for its termination *) val run