* @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;
}
}