Source file strongconflicts.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
open Dose_common
open Defaultgraphs
include Util.Logging (struct
let label = "dose_algo.strongconflicts"
end)
module ICG = Strongconflicts_int.CG
type cfl_type = Explicit | Conjunctive | Other of Diagnostic.reason list
module CflE = struct
type t = Cudf.package * Cudf.package * cfl_type
let compare = Stdlib.compare
let default = (Cudf.default_package, Cudf.default_package, Other [])
end
module CG = Graph.Imperative.Graph.ConcreteLabeled (PackageGraph.PkgV) (CflE)
let reason univ rl =
let from_sat = CudfAdd.inttopkg univ in
List.map
(function
| Diagnostic.DependencyInt (i, vl, il) ->
Diagnostic.Dependency (from_sat i, vl, List.map from_sat il)
| Diagnostic.MissingInt (i, vl) -> Diagnostic.Missing (from_sat i, vl)
| Diagnostic.ConflictInt (i, j, vpkg) ->
Diagnostic.Conflict (from_sat i, from_sat j, vpkg))
rl
let cvt univ = function
| Strongconflicts_int.Explicit -> Explicit
| Strongconflicts_int.Conjunctive -> Conjunctive
| Strongconflicts_int.Other l -> Other (reason univ l)
(** strongconflicts return the list of all strong conflicts in universe.
invariant: the universe must contain only edos-installable packages : see
Depsolver.trim.
*)
let strongconflicts universe =
let g = CG.create () in
let universe = Depsolver.trim universe in
let ig = Strongconflicts_int.strongconflicts universe in
let inttovar = CudfAdd.inttopkg universe in
ICG.iter_vertex (fun v -> CG.add_vertex g (inttovar v)) ig ;
ICG.iter_edges_e
(fun (x, (x', y', l), y) ->
CG.add_edge_e
g
(inttovar x, (inttovar x', inttovar y', cvt universe l), inttovar y))
ig ;
g