diff options
Diffstat (limited to 'Report/Box')
-rw-r--r-- | Report/Box/02_SourcePackage.php | 69 | ||||
-rw-r--r-- | Report/Box/03_BuildSystem.php | 115 | ||||
-rw-r--r-- | Report/Box/04_CauldronPackages.php | 146 | ||||
-rw-r--r-- | Report/Box/ignore_01_UpstreamProjects.php | 49 | ||||
-rw-r--r-- | Report/Box/ignore_05_CauldronISOBuild.php | 177 |
5 files changed, 556 insertions, 0 deletions
diff --git a/Report/Box/02_SourcePackage.php b/Report/Box/02_SourcePackage.php new file mode 100644 index 0000000..9ba0039 --- /dev/null +++ b/Report/Box/02_SourcePackage.php @@ -0,0 +1,69 @@ +<?php +/** + * Source packages 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_SourcePackage extends Report_Box +{ + /** + */ + var $title = "Source packages"; + + /** + */ + function _get_var_definitions() { + return array( + 'size' => '%5.1fGB', + 'count-srpms' => '%d packages', + 'upstream-updates' => array('l' => '%d have an update', 't' => '==0'), + 'orphans' => array('l' => '%d orphans', 't' => '>0'), + 'patches' => '%d patches', + 'bugs' => array('l' => '%d open bugs', 't' => '>0'), + 'rpmlint' => array('l' => '%d rpmlint errors', 't' => '>0'), + ); + } + + /** + */ + function _get_links() + { + return 'View <a href="http://svn.mageia.org/">svn</a>, <a href="http://check.mageia.org/updates.html">youri-check report</a>'; + } + + /** + * Uses youri-check updates report (check.mageia.org) + */ + function _fetch_upstream_updates() + { + $txt = file('http://check.mageia.org/updates.txt'); + return array( + 'upstream-updates'=> count($txt) - 5 + ); + } + + /** + * Uses sophie.zarb.org + */ + function _fetch_source_packages() + { + $count = substr_count( + file_get_contents('http://sophie.zarb.org/distrib/Mageia/cauldron/i586/srpms?json=1'), + 'pkgid' + ); + + return array( + 'count-srpms' => $count, + ); + } + +} 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; + } +} diff --git a/Report/Box/04_CauldronPackages.php b/Report/Box/04_CauldronPackages.php new file mode 100644 index 0000000..c275f94 --- /dev/null +++ b/Report/Box/04_CauldronPackages.php @@ -0,0 +1,146 @@ +<?php +/** + * Cauldron packages 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_CauldronPackages extends Report_Box +{ + /** + */ + var $title = "Cauldron Compiled Packages"; + + /** + */ + function _get_var_definitions() { + return array( + 'size' => '%5.1fGB', + 'count-i586-rpms' => '%d packages (i586)', + 'count-x86_64-rpms' => '%d packages (x86_64)', + 'broken-pkgs' => array('l' => '%d have broken dependencies', 't' => '<=0'), + 'obs-bin' => array('l' => '%d obsolete binaries', 't' => '<=0'), + 'obs-source' => array('l' => '%d obsolete sources', 't' => '<=0'), + 'mis-source' => array('l' => '%d missing sources', 't' => '<=0'), + 'missing-deps' => array('l' => '%d missing dependencies', 't' => '<=0') + ); + /* + ?GB + ? packages + Broken hdlist (i586/nonfree) + Signatures: 23 missing (i586/nonfree, i586/tainted) + Dependencies: 32 missing, 2 circular + 15 packages are not in sync with their source + 432 missing/broken signatures + 213 bugs + @todo: per package test suite? rpmlint, other + @todo: src => 32/64/arm + Basesystem size: 437MB, w/o suggests: 163MB + view repository, detailed report + + */ + } + + /** + */ + function _get_links() + { + return 'View <a href="http://check.mageia.org/">youri-check report</a>'; + } + + + /** + * Uses youri-check report. + */ + function _fetch_03_missing_dependencies() + { + $txt = file('http://check.mageia.org/missing.txt'); + array_shift($txt); + array_shift($txt); + array_shift($txt); + + $ret = array( + 'obs-source' => 0, + 'obs-bin' => 0, + 'mis-source' => 0 + ); + foreach ($txt as $l) + { + $l = explode("\t", $l); + if (!isset($l[3]) || !isset($l[5])) + continue; + + $arch = trim($l[3]); + $reason = substr(trim($l[5]), 0, 14); + if ($arch == 'src') { //&& $l[5], 'Obsolete source')) { + $ret['obs-source'] += 1; + } elseif ($reason == 'Missing source') { + $ret['mis-source'] += 1; + } elseif ($reason == 'Obsolete binar') { + $ret['obs-bin'] += 1; + } + } + return $ret; + } + + /** + * Uses youri-check report. + */ + function _fetch_02_broken_dependencies() + { + $txt = file('http://check.mageia.org/dependencies.txt'); + array_shift($txt); + array_shift($txt); + array_shift($txt); + + $package = null; + + $reports = array(); + foreach ($txt as $l) + { + $l = explode("\t", $l); + if (isset($l[0]) && isset($l[4])) { + $packages[] = trim($l[0]); + $missing[] = trim($l[4]); + } + } + + $packages = array_unique($packages); + sort($packages); + $missing = array_unique($missing); + sort($missing); + + return array( + 'broken-pkgs' => count($packages) - 1, + 'missing-deps' => count($missing) - 1 + ); + } + + /** + * Uses sophie.zarb.org + */ + function _fetch_01_packages() + { + $count_i586 = substr_count( + file_get_contents('http://sophie.zarb.org/distrib/Mageia/cauldron/i586/rpms?json=1'), + 'pkgid' + ); + $count_x86_64 = substr_count( + file_get_contents('http://sophie.zarb.org/distrib/Mageia/cauldron/x86_64/rpms?json=1'), + 'pkgid' + ); + + return array( + 'count-i586-rpms' => $count_i586, + 'count-x86_64-rpms' => $count_x86_64 + ); + } +} diff --git a/Report/Box/ignore_01_UpstreamProjects.php b/Report/Box/ignore_01_UpstreamProjects.php new file mode 100644 index 0000000..77f83cf --- /dev/null +++ b/Report/Box/ignore_01_UpstreamProjects.php @@ -0,0 +1,49 @@ +<?php +/** + * Upstream projects source packages reporting box. + * + * Not working yet. Still a mockup. + * + * 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_UpstreamProjects extends Report_Box +{ + /** + */ + var $title = "Upstream Projects"; + + /** + */ + function _get_var_definitions() { + return array( + 'source-packages' => '%d source packages' + ); + } + + /** + */ + function _get_links() + { + return 'View <a href="http://check.mageia.org/updates.html">detailed report (youri-check)</a>'; + } + + /** + * Uses youri-check updates report. + */ + function _fetch_upstream_updates() + { + $txt = file('http://check.mageia.org/updates.txt'); + return array( + 'upstream-updates'=> count($txt) - 5 + ); + } +} diff --git a/Report/Box/ignore_05_CauldronISOBuild.php b/Report/Box/ignore_05_CauldronISOBuild.php new file mode 100644 index 0000000..254dcfb --- /dev/null +++ b/Report/Box/ignore_05_CauldronISOBuild.php @@ -0,0 +1,177 @@ +<?php +/** + * Cauldron ISO build service reporting box. + * + * Not working yet, mostly a mockup so far. + * + * 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_CauldronISOBuild extends Report_Box +{ + /** + */ + var $title = "Cauldron ISO Build/QA/Pub"; + + /** + */ + function _get_var_definitions() { + return array( + ); + } + + /** + */ + function _get_links() + { + return 'View <a href="http://bcd.mageia.org/">bcd site</a>'; + } + + function render() + { + $obj = array( + array( + 'ts' => gmdate('c'), + 'type' => 'info', + 'value' => 'Built packages tree is not ready – no build planned.' + ), + array( + 'ts' => gmdate('c') - 5, + 'type' => 'info', + 'value' => 'Next build 1a1 should start in about 12 hours (at 2011-03-15 20:23:33), with a <a href="">new context</a>.' + ), + array( + 'ts' => gmdate('c') - 10, + 'type' => 'report', + 'build' => '1a0', + 'contextDiffLink' => '', + 'started_at' => '2011-03-14 23:03:15', + 'products' => array( + array( + 'name' => 'DVD i586', + 'build' => array(true, 'url'), + 'tests' => array(false, 'url'), + 'iso' => 'cauldron-2-dvd-i586-1a0-qafail.iso' + ), + array( + 'name' => 'DVD x86_64', + 'build' => array(true, 'url'), + 'tests' => array(true, 'url'), + 'iso' => 'cauldron-2-dvd-i586-1a0-qapass.iso' + ), + array( + 'name' => 'CD dual', + 'build' => array(false, 'url'), + 'tests' => null, + 'iso' => null + ), + array( + 'name' => 'netinstall', + 'build' => 'pending' + ) + ) + ) + ); + $values = array(); + foreach ($obj as $item) + { + if ($item['type'] == 'info') { + $values[] = array( + 't' => sprintf('<p>%s</p>', $item['value']), + 'c' => null + ); + } + elseif ($item['type'] == 'report') { + $lis = ''; + foreach ($item['products'] as $p) { + $st = $item['build'][0] ? 'ok' : 'failed'; + $lis .= <<<T +<li>{$p['name']}, + <span class="{$st}">build {$st}</span> (<a href="">log</a>), + <span class="{$st}">tests {$st}</span> (<a href="">log</a>), + <a href="">{$p['iso']}</a></li> +T; + } + $text = <<<T +<h4>Build {$item['build']} + <span style="font-weight: normal;">(<a href="">context diff w/ build {$item['prev_build']}</a>)</span> + – {$item['ts']}</h4> +<ul>{$lis}</ul> +T; + $values[] = array( + 't' => $text, + 'c' => null + ); + } + } + + return array( + 'title' => $this->title, + 'status' => 0, + 'values' => $values, + 'links' => $links + ); + } +/* + <li>DVD i586, + <span class="ok">build ok</span> (<a href="">log</a>), + <span class="failed">tests failed</span> (<a href="">log</a>), + <a href="">cauldron-2-dvd-i586-1a0-qafail.iso</a></li> + <li>DVD x86_64, + <span class="ok">build ok</span> (<a href="">log</a>), + <span class="ok">tests ok</span> (<a href="">log</a>), + <a href="">cauldron-2-dvd-i586-1a0-ok.iso</a></li> + <li>CD dual, + <span class="failed">build failed</span> (<a href="">log</a>)</li> + <li>building netinstall image...</li> + </ul> + <li><h4>Build 199 + <span style="font-weight: normal;">(<a href="">context diff w/ build 198</a>)</span> + – 2011-03-12 23:03:15</h4> + <table border="1" class="isobuild"> + <tbody> + <tr> + <th>Item</th> + <th>Build</th> + <th>Tests</th> + <th>Download</th> + </tr> + <tr> + <td>DVD i586</td> + <td><span class="ok">OK</span> (<a href="">log</a>)</td> + <td><span class="ok">OK</span> (<a href="">log</a>)</td> + <td><a href="">cauldron-2-1a0-dvd-i586-ok.iso</a></td> + </tr> + <tr> + <td>DVD x86_64</td> + <td><span class="ok">OK</span> (<a href="">log</a>)</td> + <td><span class="failed">FAILED</span> (<a href="">log</a>)</td> + <td><a href="">cauldron-2-1a0-dvd-x86_64-qafail.iso</a></td> + </tr> + <tr> + <td>CD dual</td> + <td><span class="failed">FAILED</span> (<a href="">log</a>)</td> + <td></td> + <td></td> + </tr> + <tr> + <td>netinstall</td> + <td><span class="ok">OK</span> (<a href="">log</a>)</td> + <td><span class="ok">OK</span> (<a href="">log</a>)</td> + <td><a href="">cauldron-2-1a0-netinstall-ok.iso</td> + </tr> + </tbody> + </table> + + </li> + </ul> +*/ +} |