From d08c07b68d0e88d863f597fe5e9ed72d84229ab7 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Wed, 4 May 2011 13:26:54 +0000 Subject: initial import --- Report/Box/03_BuildSystem.php | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Report/Box/03_BuildSystem.php (limited to 'Report/Box/03_BuildSystem.php') 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 @@ + + * @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 (past 48 hours)"; + + /** + */ + 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
(%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 pkgsubmit'; + } + + /** + * 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; + } +} -- cgit v1.2.1