array(), 'path' => $val[2], 'version' => $val[3], 'media' => $val[4], 'section' => $val[5], 'user' => $val[7], 'host' => $val[8], 'job' => $val[9] ); } $status = $val[1]; $data = $val[10]; if (preg_match("/@(\d+):/", $data, $revision)) { $pkgs[$key]['revision'] = $revision[1]; } $pkgs[$key]['status'][$status] = 1; $ext = $val[11]; if ($ext == '.src.rpm.info') { preg_match("!^(?:@\d+:)?(.*)!", $data, $name); $pkgs[$key]['package'] = $name[1]; } else if ($ext == '.src.rpm') { $pkgs[$key]['status']['src'] = 1; } else if ($ext == '.upload') { $pkgs[$key]['status']['upload'] = 1; } else if ($ext == '.lock') { preg_match("!(.*)\.iurt\.(.*)\.\d+\.\d+!", $data, $buildhost); if (!$hosts[$buildhost[2]]) { $hosts[$buildhost[2]]= array(); } $hosts[$buildhost[2]][$buildhost[1]] = $key; if ($pkgs[$key]['status']['build']) { array_push($pkgs[$key]['status']['build'], $buildhost[2]); } else { $pkgs[$key]['status']['build'] = array($buildhost[2]); } } else if ($ext == '.done') { // beware! this block is called twice for a given $key $pkgs[$key]['buildtime']['start'] = key2timestamp($val[6]); $pkgs[$key]['buildtime']['end'] = round($val[12]); $pkgs[$key]['buildtime']['diff'] = $pkgs[$key]['buildtime']['end'] - $pkgs[$key]['buildtime']['start']; @$build_dates[date('H', $pkgs[$key]['buildtime']['start'])] += 1; // keep obviously dubious values out of there // 12 hours is be an acceptable threshold given current BS global perfs // as of April 2011 if ($pkgs[$key]['buildtime']['diff'] < 43200) { $buildtime_total[$key] = $pkgs[$key]['buildtime']['diff']; } } } // filter packages if a package name was provided if ($_GET['package']) { foreach ($pkgs as $key => $pkg) { preg_match("/^(.*)-[^-]*-[^-]*$/", $pkg['package'], $name); if ($_GET['package'] != $name[1]) { unset($pkgs[$key]); } } } // sort by key in reverse order to have more recent pkgs first krsort($pkgs); ksort($build_dates); $build_count = count($buildtime_total); $buildtime_total = array_sum($buildtime_total); // count all packages statuses $stats = array( 'uploaded' => 0, 'failure' => 0, 'todo' => 0, 'building' => 0, 'partial' => 0 ); $total = count($pkgs); // count users' packages $users = array(); if ($total > 0) { foreach ($pkgs as $key => $p) { $pkgs[$key]['type'] = pkg_gettype($p); $stats[$pkgs[$key]['type']] += 1; if (!array_key_exists($p['user'], $users)) { $users[$p['user']] = 1; } else { $users[$p['user']] += 1; } } } // check if emi is running $stat = stat("/var/lib/schedbot/tmp/upload"); if ($stat) { $upload_time = $stat['mtime']; } // publish stats as headers foreach ($stats as $k => $v) { Header("X-BS-Queue-$k: $v"); } $w = $stats['todo'] - 10; if($w < 0) { $w = 0; } $w = $w * 60; Header("X-BS-Throttle: $w"); if ($_GET['last'] && $total > 0) { reset($pkgs); $last = current($pkgs); Header("X-BS-Package-Status: ".$last['type']); } $buildtime_total = $buildtime_total / 60; header(sprintf('X-BS-Buildtime: %d', round($buildtime_total))); $buildtime_avg = round($buildtime_total / $build_count, 2); header(sprintf('X-BS-Buildtime-Average: %5.2f', $buildtime_avg)); ?>
"; if ($missing_deps_count > 0) { echo "$missing_deps_count broken dependencies. "; } if ($unmaintained_count > 0) { echo "$unmaintained_count unmaintained packages. "; } echo 'You can help!
'; } preg_match_all('/(\d+)/', file_get_contents("https://bugs.mageia.org/buglist.cgi?quicksearch=%40qa-bugs+-kw%3Avali"), $matches); $qa_bugs = $matches[1][0]; if ($qa_bugs > 0) { echo ""; echo "$qa_bugs package updates to validate. "; echo 'You can help!
'; } if ($upload_time) { echo sprintf('Upload in progress for %s.
', timediff($upload_time)); } $buildtime_stats = array(); // Builds in progress $s = ''; $tmpl = <<Machine | Arch | User | Package | Target | Media |
---|
Submitted | User | Package | Target | Media | Status | Build time |
---|
Status | Count | % | |
---|---|---|---|
%s | %d | %d%% |
User | Packages |
---|---|
%s | %d |
Total time | %s hours |
Average | %s minutes |
Builds count | %s |
Duration | Pack. nb. |
---|
%d |
No package has been submitted in the past %d hours.
', $max_modified * 24); } ?>Generated at . Code for this page is in http://svnweb.mageia.org/soft/build_system/web/.