Skip to content

Commit

Permalink
mirage: unify ignore_dirs for configure and build, support -t ukvm ag…
Browse files Browse the repository at this point in the history
…ain (#937)

* mirage: unify ignore_dirs

* mirage_key: warn on ukvm

* fix wording, as suggested by @mor1
hannesm authored and mato committed Nov 6, 2018
1 parent e045721 commit ee6b6d9
Showing 2 changed files with 41 additions and 17 deletions.
19 changes: 11 additions & 8 deletions lib/mirage.ml
Original file line number Diff line number Diff line change
@@ -592,7 +592,7 @@ let terminal () =
in
not dumb && isatty

let compile libs warn_error target =
let compile ignore_dirs libs warn_error target =
let tags =
[ Fmt.strf "predicate(%s)" (backend_predicate target);
"warn(A-4-41-42-44)";
@@ -618,17 +618,18 @@ let compile libs warn_error target =
"-g" :: List.flatten dont
in
let concat = String.concat ~sep:"," in
let ignore_dirs = match ignore_dirs with
| [] -> Bos.Cmd.empty
| dirs -> Bos.Cmd.(v "-Xs" % concat dirs)
in
let cmd = Bos.Cmd.(v "ocamlbuild" % "-use-ocamlfind" %
"-classic-display" %
"-tags" % concat tags %
"-pkgs" % concat libs %
"-cflags" % concat cflags %
"-lflags" % concat lflags %
"-tag-line" % "<static*.*>: warn(-32-34)" %
"-X" % "_build-solo5-hvt" %
(* The following deprecated name is kept to allow mirage
* clean to continue to work after an upgrade *)
"-X" % "_build-ukvm" %
"-tag-line" % "<static*.*>: warn(-32-34)" %%
ignore_dirs %
result)
in
Log.info (fun m -> m "executing %a" Bos.Cmd.pp cmd);
@@ -790,6 +791,8 @@ let check_entropy libs =
else
R.ok ()
let ignore_dirs = ["_build-solo5-hvt"; "_build-ukvm"]
let build i =
let name = Info.name i in
let ctx = Info.context i in
@@ -798,7 +801,7 @@ let build i =
let libs = Info.libraries i in
let target_debug = Key.(get ctx target_debug) in
check_entropy libs >>= fun () ->
compile libs warn_error target >>= fun () ->
compile ignore_dirs libs warn_error target >>= fun () ->
link i name target target_debug >>| fun out ->
Log.info (fun m -> m "Build succeeded: %s" out)
@@ -847,7 +850,7 @@ module Project = struct
let packages = [package "mirage"]
(* The directories to ignore when compiling config.ml *)
let ignore_dirs = ["_build-solo5-hvt"; "_build-ukvm"]
let ignore_dirs = ignore_dirs
let create jobs = impl @@ object
inherit base_configurable
39 changes: 30 additions & 9 deletions lib/mirage_key.ml
Original file line number Diff line number Diff line change
@@ -91,16 +91,37 @@ type mode = [
| `Qubes
]

let first_ukvm_mention = ref true
let ukvm_warning = "The `ukvm' target has been renamed to `hvt'. \
Support for the `ukvm` target will be removed in a future MirageOS release. \
Please reconfigure using `-t hvt' at your earliest convenience."

let target_conv: mode Cmdliner.Arg.converter =
Cmdliner.Arg.enum [
"unix" , `Unix;
"macosx", `MacOSX;
"xen" , `Xen;
"virtio", `Virtio;
"hvt" ,`Hvt;
"muen" , `Muen;
"qubes" , `Qubes
]
let parser, printer =
Cmdliner.Arg.enum [
"unix" , `Unix;
"macosx", `MacOSX;
"xen" , `Xen;
"virtio", `Virtio;
"hvt" , `Hvt;
"muen" , `Muen;
"qubes" , `Qubes;
]
in
let filter_ukvm s =
let str =
if s = "ukvm" then begin
if !first_ukvm_mention then begin
Logs.warn (fun m -> m "%s" ukvm_warning) ;
first_ukvm_mention := false
end ;
"hvt"
end else
s
in
parser str
in
filter_ukvm, printer

let pp_target fmt m = snd target_conv fmt m

0 comments on commit ee6b6d9

Please sign in to comment.