From 251daf9fbcf0fe1ddcabff38bedf6a41d8039a66 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Wed, 25 Jan 2012 22:36:16 +0000 Subject: Allow restricting to a package name, and getting the status of last build in a header --- index.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index ab16c01..9d948ca 100644 --- a/index.php +++ b/index.php @@ -194,6 +194,17 @@ foreach ($matches as $val) { } } } + +// 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 @@ if ($stat) { } // publish stats as headers + foreach ($stats as $k => $v) { Header("X-BS-Queue-$k: $v"); } @@ -245,6 +257,12 @@ if($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); @@ -298,9 +316,11 @@ header(sprintf('X-BS-Buildtime-Average: %5.2f', $buildtime_avg));

« Back to full list'; +if (!$_GET['package']) { + # Temporary until initial mirror is ready echo sprintf( '

%s broken dependencies. %s unmaintained packages. You can help!

', @@ -347,6 +367,9 @@ echo '
', '
'; echo '
'; +} + +// Build queue $s = ''; $tmpl = << -- cgit v1.2.1