Discussion:
[2816] Allow restricting to a package name, and getting the status of last build in a header
root-odJJhXpcy38dnm+
2012-01-25 22:36:17 UTC
Permalink
Revision: 2816
Author: pterjan
Date: 2012-01-25 23:36:16 +0100 (Wed, 25 Jan 2012)
Log Message:
-----------
Allow restricting to a package name, and getting the status of last build in a header

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

Modified: build_system/web/index.php
===================================================================
--- build_system/web/index.php 2012-01-25 18:33:07 UTC (rev 2815)
+++ build_system/web/index.php 2012-01-25 22:36:16 UTC (rev 2816)
@@ -194,6 +194,17 @@
}
}
}
+
+// 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);
@@ -235,6 +246,7 @@
}

// publish stats as headers
+
foreach ($stats as $k => $v) {
Header("X-BS-Queue-$k: $v");
}
@@ -245,6 +257,12 @@
$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);
@@ -298,9 +316,11 @@
<h1><?php echo $title ?></h1>

<?php
-if (!is_null($g_user))
+if (!is_null($g_user) || $_GET['package'])
echo '<a href="/">&laquo;&nbsp;Back to full list</a>';

+if (!$_GET['package']) {
+
# Temporary until initial mirror is ready
echo sprintf(
'<p><a href="%s">%s broken dependencies</a>. <a href="%s">%s unmaintained packages</a>. <strong><a href="%s">You can help!</a></strong></p>',
@@ -347,6 +367,9 @@
'</table></div>';
echo '<div class="clear"></div>';

+}
+
+// Build queue
$s = '';
$tmpl = <<<T
<tr class="%s">

Loading...