Discussion:
[2755] List builds in progress at the top, it is an import part of build system status
root-odJJhXpcy38dnm+
2012-01-22 17:06:03 UTC
Permalink
Revision: 2755
Author: pterjan
Date: 2012-01-22 18:06:03 +0100 (Sun, 22 Jan 2012)
Log Message:
-----------
List builds in progress at the top, it is an import part of build system status

Modified Paths:
--------------
build_system/web/index.php

Modified: build_system/web/index.php
===================================================================
--- build_system/web/index.php 2012-01-22 15:46:02 UTC (rev 2754)
+++ build_system/web/index.php 2012-01-22 17:06:03 UTC (rev 2755)
@@ -129,6 +129,7 @@
PREG_SET_ORDER);

$pkgs = array();
+$hosts = array();

$buildtime_total = array();
$buid_dates = array();
@@ -167,11 +168,15 @@
} else if ($ext == '.upload') {
$pkgs[$key]['status']['upload'] = 1;
} else if ($ext == '.lock') {
- preg_match("!.*\.iurt\.(.*)\.\d+\.\d+!", $data, $buildhost);
+ 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[1]);
+ array_push($pkgs[$key]['status']['build'], $buildhost[2]);
else
- $pkgs[$key]['status']['build'] = array($buildhost[1]);
+ $pkgs[$key]['status']['build'] = array($buildhost[2]);
} else if ($ext == '.done') {
// beware! this block is called twice for a given $key

@@ -312,7 +317,37 @@

$buildtime_stats = array();

+// Builds in progress
$s = '';
+$tmpl = <<<TB
+<tr>
+ <td>%s</td>
+ <td>%s</td>
+ <td><a href="?user=%s">%s</a></td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s/%s</td>
+</tr>
+TB;
+foreach ($hosts as $machine => $b) {
+ foreach ($b as $arch => $key) {
+ $s .= sprintf($tmpl,
+ $machine,
+ $arch,
+ $pkgs[$key]['user'], $pkgs[$key]['user'],
+ $pkgs[$key]['package'],
+ $pkgs[$key]['version'],
+ $pkgs[$key]['media'], $pkgs[$key]['section']);
+ }
+}
+echo '<div align="center"><table>',
+ '<caption>', count($hosts), ' builds in progress.</caption>',
+ '<tr><th>Machine</th><th>Arch</th><<th>User</th><th>Package</th><th>Target</th><th>Media</th></tr>',
+ $s,
+ '</table></div>';
+echo '<div class="clear"></div>';
+
+$s = '';
$tmpl = <<<T
<tr class="%s">
<td>%s</td>

Loading...