Fix installion when there are multiple contexts
This commit is contained in:
parent
a326842161
commit
af82f587e4
25
bin/main.ml
25
bin/main.ml
|
@ -248,27 +248,32 @@ let install_uninstall ~what =
|
||||||
| l -> l
|
| l -> l
|
||||||
in
|
in
|
||||||
let install_files, missing_install_files =
|
let install_files, missing_install_files =
|
||||||
List.partition_map pkgs ~f:(fun pkg ->
|
List.concat_map pkgs ~f:(fun pkg ->
|
||||||
let fn = resolve_package_install setup pkg in
|
let fn = resolve_package_install setup pkg in
|
||||||
if Path.exists fn then
|
List.map setup.contexts ~f:(fun ctx ->
|
||||||
Inl fn
|
let fn = Path.append ctx.Context.build_dir fn in
|
||||||
else
|
if Path.exists fn then
|
||||||
Inr pkg)
|
Inl (ctx, fn)
|
||||||
|
else
|
||||||
|
Inr fn))
|
||||||
|
|> List.partition_map ~f:(fun x -> x)
|
||||||
in
|
in
|
||||||
if missing_install_files <> [] then begin
|
if missing_install_files <> [] then begin
|
||||||
die "The <package>.install files for these packages are missing:\n\
|
die "The following <package>.install are missing:\n\
|
||||||
%s\n\
|
%s\n\
|
||||||
You need to run: jbuilder build %s"
|
You need to run: jbuilder build @install"
|
||||||
(String.concat ~sep:"\n"
|
(String.concat ~sep:"\n"
|
||||||
(List.map missing_install_files ~f:(sprintf "- %s")))
|
(List.map missing_install_files
|
||||||
(String.concat ~sep:" " (List.map pkgs ~f:(sprintf "%s.install")))
|
~f:(fun p -> sprintf "- %s" (Path.to_string p))))
|
||||||
end;
|
end;
|
||||||
(match setup.contexts, prefix with
|
(match setup.contexts, prefix with
|
||||||
| _ :: _ :: _, Some _ ->
|
| _ :: _ :: _, Some _ ->
|
||||||
die "Cannot specify --prefix when installing into multiple contexts!"
|
die "Cannot specify --prefix when installing into multiple contexts!"
|
||||||
| _ -> ());
|
| _ -> ());
|
||||||
|
let module CMap = Map.Make(Context) in
|
||||||
|
let install_files_by_context = CMap.of_alist_multi install_files |> CMap.bindings in
|
||||||
Future.all_unit
|
Future.all_unit
|
||||||
(List.map setup.contexts ~f:(fun context ->
|
(List.map install_files_by_context ~f:(fun (context, install_files) ->
|
||||||
get_prefix context ~from_command_line:prefix >>= fun prefix ->
|
get_prefix context ~from_command_line:prefix >>= fun prefix ->
|
||||||
Future.all_unit
|
Future.all_unit
|
||||||
(List.map install_files ~f:(fun path ->
|
(List.map install_files ~f:(fun path ->
|
||||||
|
|
|
@ -56,6 +56,8 @@ type t =
|
||||||
; cmt_magic_number : string
|
; cmt_magic_number : string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let compare a b = compare a.name b.name
|
||||||
|
|
||||||
let all_known = ref String_map.empty
|
let all_known = ref String_map.empty
|
||||||
let all () = !all_known
|
let all () = !all_known
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,9 @@ type t =
|
||||||
; cmt_magic_number : string
|
; cmt_magic_number : string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(** Compare the context names *)
|
||||||
|
val compare : t -> t -> int
|
||||||
|
|
||||||
val create_for_opam
|
val create_for_opam
|
||||||
: ?root:string
|
: ?root:string
|
||||||
-> switch:string
|
-> switch:string
|
||||||
|
|
Loading…
Reference in New Issue