Consistency fix + added skeleton Ui_prototype for graphviz UI mockup
This commit is contained in:
parent
da630e7694
commit
fb9581ef2b
2 changed files with 18 additions and 7 deletions
|
@ -27,6 +27,10 @@ let () =
|
||||||
let graph = Opam_graph.dependencies data in
|
let graph = Opam_graph.dependencies data in
|
||||||
let dot = Opam_graph.Dot.of_graph graph in
|
let dot = Opam_graph.Dot.of_graph graph in
|
||||||
Format.printf "%a" Opam_graph.Dot.pp dot
|
Format.printf "%a" Opam_graph.Dot.pp dot
|
||||||
|
| "dot_proto_ui" ->
|
||||||
|
let graph = Opam_graph.Ui_prototype.dependencies data in
|
||||||
|
let dot = Opam_graph.Dot.of_graph graph in
|
||||||
|
Format.printf "%a" Opam_graph.Dot.pp dot
|
||||||
| _ -> failwith "Unsupported output format"
|
| _ -> failwith "Unsupported output format"
|
||||||
)
|
)
|
||||||
| _ ->
|
| _ ->
|
||||||
|
|
|
@ -25,9 +25,16 @@ let opam (switch : OpamFile.SwitchExport.t) pkg_name =
|
||||||
(* TODO build / dev packages *)
|
(* TODO build / dev packages *)
|
||||||
(* TODO constraints (os = "linux") *)
|
(* TODO constraints (os = "linux") *)
|
||||||
let direct_dependencies (switch : OpamFile.SwitchExport.t) pkg =
|
let direct_dependencies (switch : OpamFile.SwitchExport.t) pkg =
|
||||||
|
let available = switch.selections.sel_installed in
|
||||||
let opam = opam switch pkg in
|
let opam = opam switch pkg in
|
||||||
let set = filtered_formula_to_pkgs switch (OpamFile.OPAM.depends opam) in
|
let set = filtered_formula_to_pkgs switch (OpamFile.OPAM.depends opam) in
|
||||||
filtered_formula_to_pkgs switch ~set (OpamFile.OPAM.depopts opam)
|
filtered_formula_to_pkgs switch ~set (OpamFile.OPAM.depopts opam)
|
||||||
|
|> Name_set.filter (fun name ->
|
||||||
|
OpamPackage.Set.exists
|
||||||
|
(fun pkg -> pkg.OpamPackage.name = name)
|
||||||
|
available
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
let transitive_dependencies (switch : OpamFile.SwitchExport.t) pkg =
|
let transitive_dependencies (switch : OpamFile.SwitchExport.t) pkg =
|
||||||
let available = switch.selections.sel_installed in
|
let available = switch.selections.sel_installed in
|
||||||
|
@ -89,13 +96,6 @@ let dependencies ?(transitive=false) (switch : OpamFile.SwitchExport.t) =
|
||||||
| true -> transitive_dependencies switch x
|
| true -> transitive_dependencies switch x
|
||||||
| false -> direct_dependencies switch x
|
| false -> direct_dependencies switch x
|
||||||
in
|
in
|
||||||
let deps =
|
|
||||||
Name_set.filter (fun name ->
|
|
||||||
OpamPackage.Set.exists
|
|
||||||
(fun pkg -> pkg.OpamPackage.name = name)
|
|
||||||
available)
|
|
||||||
deps
|
|
||||||
in
|
|
||||||
let graph = add_node graph x deps in
|
let graph = add_node graph x deps in
|
||||||
let work =
|
let work =
|
||||||
Name_set.diff
|
Name_set.diff
|
||||||
|
@ -139,3 +139,10 @@ module Dot = struct
|
||||||
Format.fprintf ppf "%s" (Odot.string_of_graph dot)
|
Format.fprintf ppf "%s" (Odot.string_of_graph dot)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Ui_prototype = struct
|
||||||
|
|
||||||
|
let dependencies data =
|
||||||
|
failwith "todo"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue