let pkgcheck global_constraints callback solver failed tested id =
let req =
if global_constraints then begin
let globalid = (Array.length tested) - 1 in
Diagnostic_int.Sng (Some globalid,id)
end else
Diagnostic_int.Sng (None,id)
in
let res =
Util.Progress.progress progressbar_univcheck;
if not(tested.(id)) then begin
match solve ~tested solver req with
|Diagnostic_int.Success _ as res -> res
|Diagnostic_int.Failure _ as res -> (incr failed; res)
end
else begin
let f ?(all=false) () =
if all then begin
match solve solver req with
|Diagnostic_int.Success(f_int) -> f_int ()
|Diagnostic_int.Failure _ -> assert false
end else []
in Diagnostic_int.Success(f)
end
in
match callback with
|None -> ()
|Some f -> f (res,req)