$matches[1], 'version' => $matches[2]); } else { return false; } } $db = new SQLite3('autobuild.db'); $runs = Array(); $handle = opendir('cauldron/x86_64/core/'); while (false !== ($entry = readdir($handle))) { if (preg_match("/^....-..-..$/", $entry, $matches)) { array_push($runs, $matches[0]); } } closedir($handle); $handle = opendir('cauldron/aarch64/core/'); while (false !== ($entry = readdir($handle))) { if (preg_match("/^....-..-..$/", $entry, $matches)) { array_push($runs, $matches[0]); } } closedir($handle); sort($runs); $latest = readlink("cauldron/aarch64/core/latest"); $run = $_GET['run']; if (!$run) { $run = $latest; } foreach ($runs as $r) { if ($r==$run) { break; } $prev = $r; } $packages = Array(); if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) { while (false !== ($entry = readdir($handle))) { if ($parsed = parse_package($entry)) { $packages[$parsed['package']] = $entry; } } closedir($handle); } $prev_failure = Array(); if ($prev) { $status_name = array_values(glob("cauldron/*/core/$prev/status.core.log"))[0]; $status_file = fopen($status_name, "r"); while (!feof($status_file)) { $line = fgets($status_file); if (preg_match("/^(.*): (.*)$/", $line, $matches)) { $rpm = parse_package($matches[1]); $status = $matches[2]; if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") { $prev_failure[$rpm['package']] = 1; } } } fclose($status_file); } $success = Array(); $failure = Array(); $fixed = Array(); $removed = Array(); $broken = Array(); $base_dir = array_values(glob("cauldron/*/core/$run"))[0]; $status_name = "$base_dir/status.core.log"; if (!file_exists($status_name)) { echo "Invalid run"; exit; } $start_time = 0; if (file_exists("$base_dir/VERSION")) { #Mageia 5 Devel-i586-Download 20140311 15:50 #Mageia 5 Devel-x86_64-Download 20140311 15:50 $version = file_get_contents("$base_dir/VERSION"); preg_match('/ (\d{8} \d{2}:\d{2})$/', $version, $matches); $start_time = strtotime($matches[1]); } $status_file = fopen($status_name, "r"); while (!feof($status_file)) { $line = fgets($status_file); if (preg_match("/^(.*): (.*)$/", $line, $matches)) { $rpm = $matches[1]; $status = $matches[2]; if ($start_time == 0) { $build_stat = stat("$base_dir/$rpm"); if ($build_stat['mtime']) { $start_time = $build_stat['mtime']; } } if ($status == "ok") { array_push($success, $rpm); } elseif ($status != "unknown" && $status != "not_on_this_arch"){ $failure[$rpm] = $status; $parsed = parse_package($rpm); $package = $parsed['package']; if(!$prev_failure[$package]) { $broken[$rpm] = 1; } if(!$packages[$package]) { $removed[$rpm] = 1; } else { $build_stat = stat("$base_dir/$rpm"); $pkg_stat = stat('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/'.$packages[$package]); # For recreate_srpm_failure, $rpm is the one that was in the repo # For other failures, mga release may be incorrect so use something less reliable if (($status == 'recreate_srpm_failure' && $rpm != $packages[$package]) || ($pkg_stat['mtime'] > $start_time)) { $fixed[$rpm] = 1; } } } } } fclose($status_file); sort($success); ksort($failure); $nb_failed = count($failure); $nb_success = count($success); $nb_fixed = count($fixed); $nb_removed = count($removed); $nb_tried = $nb_failed + $nb_success; $succes_percent = round($nb_success*1000/$nb_tried)/10; $estimated_percent = round(($nb_success+$nb_fixed)*1000/($nb_tried-$nb_removed))/10; echo "