function parse_error($version) { global $known_errors, $nbTotal, $totalFailed, $totalNbNotCat; $totalFailed = 0; $totalNbNotCat = 0; $req = "SELECT * FROM errors WHERE clang_version='{$version}'"; $result = mysql_query($req); $nbTotal = mysql_num_rows($result); while ($row = mysql_fetch_object($result)) { $set = false; $totalFailed++; get_key_clang($known_errors, $row->detected_error); } usort($known_errors, "cmp"); return $known_errors; }
if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { $line = explode(" ", $buffer); if ($line[2] != "OK") { if ($line[0] == "UNKNOWN") { echo "Fix line {$i}"; } else { if ($line[2] != "Failed" && $line[2] != "Unknown") { echo "error on line {$buffer}"; die; } $msg = ""; for ($j = 4; $j < count($line); $j++) { $msg .= $line[$j] . " "; } $key_code = get_key_clang($known_errors, $msg); if ($key_code != "BUILD_DEP") { $pkg_name = mysql_real_escape_string($line[0]); if (trim($msg) == "XXX") { $msg = "Undetected error"; } if ($previous_pkg_name == $pkg_name) { // Duplicate. Delete the former one $sql = "DELETE FROM errors WHERE package='{$pkg_name}' AND clang_version='{$CLANG_VERSION}'"; mysql_query($sql); $i--; } $SQL = "INSERT INTO errors (package, version, detected_error, error_code, date_build, clang_version, key_code) VALUES ("; $SQL .= "'" . $pkg_name . "', '" . mysql_real_escape_string($line[1]) . "', '" . mysql_real_escape_string($msg) . "', '" . mysql_real_escape_string($line[3]) . "','{$DATE_REBUILD}','{$CLANG_VERSION}','{$key_code}')"; $result = mysql_query($SQL); if (!$result) {