let pkgcheck global_constraints callback solver 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
solve ~tested solver req
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, res with
|None, Diagnostic_int.Success _ -> true
|None, Diagnostic_int.Failure _ -> false
|Some f, Diagnostic_int.Success _ -> ( f (res,req) ; true )
|Some f, Diagnostic_int.Failure _ -> ( f (res,req) ; false )