diff options
Diffstat (limited to 'Report/Box/03_BuildSystem.php')
-rw-r--r-- | Report/Box/03_BuildSystem.php | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/Report/Box/03_BuildSystem.php b/Report/Box/03_BuildSystem.php new file mode 100644 index 0000000..b2d020d --- /dev/null +++ b/Report/Box/03_BuildSystem.php @@ -0,0 +1,115 @@ +<?php +/** + * Buildsystem reporting box. + * + * PHP version 5 + * + * @category Dashboard + * @package Buildsystem + * @author Romain d'Alverny <rda@mageia.org> + * @license MIT License, see LICENSE.txt + * @link http://svnweb.mageia.org/svn/soft/dashboard/ +*/ +/** +*/ +class Report_Box_PackageBuildSystem extends Report_Box +{ + /** + */ + var $title = "Packages Build <span class=\"light\">(past 48 hours)</span>"; + + /** + */ + function _get_var_definitions() { + return array( + 'x_bs_queue_uploaded' => ':render', //'%d packages uploaded', + 'x_bs_queue_failure' => array('l' => '%d failed to build', 't' => '==0', 'w' => 0), + 'x_bs_queue_rejected' => array('l' => '%d rejected', 't' => '==0', 'w' => 0), + 'x_bs_buildtime' => ':render', + 'x_bs_buildtime_average' => ':render', + 'nodes' => ':render', + 'queue_size_avg' => 'queue size: 4/0/20', + 'wait_time' => 'wait time: 5/2/45' + ); + } + /* + missing dependencies % + other + */ + + function _render_value_x_bs_buildtime() + { + return array( + 't' => sprintf('%5.2f hours of total buildtime<br />(%d%% of the time)', + $this->_cur_val / 60, + $this->_cur_val / 60 / 48 * 100 + ), + 'c' => 'ok', + 's' => 0 + ); + } + + function _render_value_x_bs_buildtime_average() + { + return array( + 't' => sprintf('%5.2f min of average buildtime', $this->_cur_val), + 'c' => 'ok', + 's' => 0 + ); + } + + function _render_value_nodes() + { + return array( + 't' => '? nodes working fine out of ?', + 'c' => 'unk', + 's' => 0 + ); + } + + function _render_value_x_bs_queue_uploaded() + { + return array( + 't' => sprintf('%d packages uploaded', $this->_cur_val), + 'c' => 'ok', + 's' => 0 + ); + } + + /** + */ + function _get_links() + { + return 'View <a href="http://pkgsubmit.mageia.org/">pkgsubmit</a>'; + } + + /** + * Fetch live report values from pkgsubmit HTTP headers, + * prefixed with X-BS- + * + * @return array + */ + function _fetch_buildsystem() + { + $ret = array(); + $h = get_headers('http://pkgsubmit.mageia.org/'); + foreach ($h as $v) + { + $v = explode(':', trim($v)); + if (substr($v[0], 0, 5) == 'X-BS-') + { + $k = str_replace('-', '_', strtolower($v[0])); + if (in_array($k, array( + 'x_bs_queue_todo', + 'x_bs_queue_building', + 'x_bs_queue_partial', + 'x_bs_queue_built', + 'x_bs_throttle' + ))) + continue; + $ret[$k] = trim($v[1]); + } + } + return $ret; + } +} |