1 |
<?php |
2 |
/** |
3 |
* Cauldron ISO build service reporting box. |
4 |
* |
5 |
* Not working yet, mostly a mockup so far. |
6 |
* |
7 |
* PHP version 5 |
8 |
* |
9 |
* @category Dashboard |
10 |
* @package Buildsystem |
11 |
* @author Romain d'Alverny <rda@mageia.org> |
12 |
* @license MIT License, see LICENSE.txt |
13 |
* @link http://svnweb.mageia.org/svn/soft/dashboard/ |
14 |
*/ |
15 |
|
16 |
/** |
17 |
*/ |
18 |
class Report_Box_CauldronISOBuild extends Report_Box |
19 |
{ |
20 |
/** |
21 |
*/ |
22 |
var $title = "Cauldron ISO Build/QA/Pub"; |
23 |
|
24 |
/** |
25 |
*/ |
26 |
function _get_var_definitions() { |
27 |
return array( |
28 |
); |
29 |
} |
30 |
|
31 |
/** |
32 |
*/ |
33 |
function _get_links() |
34 |
{ |
35 |
return 'View <a href="http://bcd.mageia.org/">bcd site</a>'; |
36 |
} |
37 |
|
38 |
function render() |
39 |
{ |
40 |
$obj = array( |
41 |
array( |
42 |
'ts' => gmdate('c'), |
43 |
'type' => 'info', |
44 |
'value' => 'Built packages tree is not ready – no build planned.' |
45 |
), |
46 |
array( |
47 |
'ts' => gmdate('c') - 5, |
48 |
'type' => 'info', |
49 |
'value' => 'Next build 1a1 should start in about 12 hours (at 2011-03-15 20:23:33), with a <a href="">new context</a>.' |
50 |
), |
51 |
array( |
52 |
'ts' => gmdate('c') - 10, |
53 |
'type' => 'report', |
54 |
'build' => '1a0', |
55 |
'contextDiffLink' => '', |
56 |
'started_at' => '2011-03-14 23:03:15', |
57 |
'products' => array( |
58 |
array( |
59 |
'name' => 'DVD i586', |
60 |
'build' => array(true, 'url'), |
61 |
'tests' => array(false, 'url'), |
62 |
'iso' => 'cauldron-2-dvd-i586-1a0-qafail.iso' |
63 |
), |
64 |
array( |
65 |
'name' => 'DVD x86_64', |
66 |
'build' => array(true, 'url'), |
67 |
'tests' => array(true, 'url'), |
68 |
'iso' => 'cauldron-2-dvd-i586-1a0-qapass.iso' |
69 |
), |
70 |
array( |
71 |
'name' => 'CD dual', |
72 |
'build' => array(false, 'url'), |
73 |
'tests' => null, |
74 |
'iso' => null |
75 |
), |
76 |
array( |
77 |
'name' => 'netinstall', |
78 |
'build' => 'pending' |
79 |
) |
80 |
) |
81 |
) |
82 |
); |
83 |
$values = array(); |
84 |
foreach ($obj as $item) |
85 |
{ |
86 |
if ($item['type'] == 'info') { |
87 |
$values[] = array( |
88 |
't' => sprintf('<p>%s</p>', $item['value']), |
89 |
'c' => null |
90 |
); |
91 |
} |
92 |
elseif ($item['type'] == 'report') { |
93 |
$lis = ''; |
94 |
foreach ($item['products'] as $p) { |
95 |
$st = $item['build'][0] ? 'ok' : 'failed'; |
96 |
$lis .= <<<T |
97 |
<li>{$p['name']}, |
98 |
<span class="{$st}">build {$st}</span> (<a href="">log</a>), |
99 |
<span class="{$st}">tests {$st}</span> (<a href="">log</a>), |
100 |
<a href="">{$p['iso']}</a></li> |
101 |
T; |
102 |
} |
103 |
$text = <<<T |
104 |
<h4>Build {$item['build']} |
105 |
<span style="font-weight: normal;">(<a href="">context diff w/ build {$item['prev_build']}</a>)</span> |
106 |
– {$item['ts']}</h4> |
107 |
<ul>{$lis}</ul> |
108 |
T; |
109 |
$values[] = array( |
110 |
't' => $text, |
111 |
'c' => null |
112 |
); |
113 |
} |
114 |
} |
115 |
|
116 |
return array( |
117 |
'title' => $this->title, |
118 |
'status' => 0, |
119 |
'values' => $values, |
120 |
'links' => $links |
121 |
); |
122 |
} |
123 |
/* |
124 |
<li>DVD i586, |
125 |
<span class="ok">build ok</span> (<a href="">log</a>), |
126 |
<span class="failed">tests failed</span> (<a href="">log</a>), |
127 |
<a href="">cauldron-2-dvd-i586-1a0-qafail.iso</a></li> |
128 |
<li>DVD x86_64, |
129 |
<span class="ok">build ok</span> (<a href="">log</a>), |
130 |
<span class="ok">tests ok</span> (<a href="">log</a>), |
131 |
<a href="">cauldron-2-dvd-i586-1a0-ok.iso</a></li> |
132 |
<li>CD dual, |
133 |
<span class="failed">build failed</span> (<a href="">log</a>)</li> |
134 |
<li>building netinstall image...</li> |
135 |
</ul> |
136 |
<li><h4>Build 199 |
137 |
<span style="font-weight: normal;">(<a href="">context diff w/ build 198</a>)</span> |
138 |
– 2011-03-12 23:03:15</h4> |
139 |
<table border="1" class="isobuild"> |
140 |
<tbody> |
141 |
<tr> |
142 |
<th>Item</th> |
143 |
<th>Build</th> |
144 |
<th>Tests</th> |
145 |
<th>Download</th> |
146 |
</tr> |
147 |
<tr> |
148 |
<td>DVD i586</td> |
149 |
<td><span class="ok">OK</span> (<a href="">log</a>)</td> |
150 |
<td><span class="ok">OK</span> (<a href="">log</a>)</td> |
151 |
<td><a href="">cauldron-2-1a0-dvd-i586-ok.iso</a></td> |
152 |
</tr> |
153 |
<tr> |
154 |
<td>DVD x86_64</td> |
155 |
<td><span class="ok">OK</span> (<a href="">log</a>)</td> |
156 |
<td><span class="failed">FAILED</span> (<a href="">log</a>)</td> |
157 |
<td><a href="">cauldron-2-1a0-dvd-x86_64-qafail.iso</a></td> |
158 |
</tr> |
159 |
<tr> |
160 |
<td>CD dual</td> |
161 |
<td><span class="failed">FAILED</span> (<a href="">log</a>)</td> |
162 |
<td></td> |
163 |
<td></td> |
164 |
</tr> |
165 |
<tr> |
166 |
<td>netinstall</td> |
167 |
<td><span class="ok">OK</span> (<a href="">log</a>)</td> |
168 |
<td><span class="ok">OK</span> (<a href="">log</a>)</td> |
169 |
<td><a href="">cauldron-2-1a0-netinstall-ok.iso</td> |
170 |
</tr> |
171 |
</tbody> |
172 |
</table> |
173 |
|
174 |
</li> |
175 |
</ul> |
176 |
*/ |
177 |
} |