2 - Copyright (c) 2018 Vojtech Horky
5 - Redistribution and use in source and binary forms, with or without
6 - modification, are permitted provided that the following conditions
9 - - Redistributions of source code must retain the above copyright
10 - notice, this list of conditions and the following disclaimer.
11 - - Redistributions in binary form must reproduce the above copyright
12 - notice, this list of conditions and the following disclaimer in the
13 - documentation and/or other materials provided with the distribution.
14 - - The name of the author may not be used to endorse or promote products
15 - derived from this software without specific prior written permission.
17 - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 <xsl:stylesheet version=
"1.0"
29 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
30 xmlns=
"http://www.w3.org/2005/Atom"
31 xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
33 <xsl:import href=
"common.xsl" />
35 <xsl:param name=
"BASE_URL" select=
"'http://ci.helenos.org/'" />
36 <xsl:param name=
"RSS_TAG_PREFIX" select=
"'ci.helenos.org'" />
37 <xsl:param name=
"PREVIOUS_REPORTS" select=
"''" />
40 <xsl:variable name=
"PREVIOUS_REPORT">
42 <xsl:when test=
"substring-before(normalize-space($PREVIOUS_REPORTS), ' ') = ''">
43 <xsl:value-of select=
"normalize-space($PREVIOUS_REPORTS)" />
46 <xsl:value-of select=
"substring-before(normalize-space($PREVIOUS_REPORTS), ' ')" />
52 <xsl:output method=
"xml" indent=
"yes" />
55 <xsl:template match=
"/" xmlns=
"http://www.w3.org/2005/Atom">
56 <feed version=
"2.0" xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
57 <title>HelenOS nightly builds difference results
</title>
58 <description></description>
59 <link href=
"{$BASE_URL}" />
61 <xsl:if test=
"normalize-space($PREVIOUS_REPORTS) != ''">
62 <xsl:call-template name=
"SHOW_DIFF">
63 <xsl:with-param name=
"FIRST" select=
"/" />
64 <xsl:with-param name=
"SECOND" select=
"document($PREVIOUS_REPORT)" />
66 <xsl:call-template name=
"MAKE_DIFFS">
67 <xsl:with-param name=
"BUILDS" select=
"normalize-space($PREVIOUS_REPORTS)" />
74 <xsl:template name=
"MAKE_DIFFS">
75 <xsl:param name=
"BUILDS" />
76 <xsl:variable name=
"FIRST">
78 <xsl:when test=
"substring-before($BUILDS, ' ') = ''">
79 <xsl:value-of select=
"$BUILDS" />
82 <xsl:value-of select=
"substring-before($BUILDS, ' ')" />
86 <xsl:variable name=
"REMAINING" select=
"substring-after($BUILDS, ' ')" />
88 <xsl:if test=
"$REMAINING != ''" >
89 <xsl:variable name=
"SECOND">
91 <xsl:when test=
"substring-before($REMAINING, ' ') = ''">
92 <xsl:value-of select=
"$REMAINING" />
95 <xsl:value-of select=
"substring-before($REMAINING, ' ')" />
99 <xsl:call-template name=
"SHOW_DIFF">
100 <xsl:with-param name=
"FIRST" select=
"document($FIRST)" />
101 <xsl:with-param name=
"SECOND" select=
"document($SECOND)" />
103 <xsl:call-template name=
"MAKE_DIFFS">
104 <xsl:with-param name=
"BUILDS" select=
"$REMAINING" />
109 <xsl:template name=
"SHOW_DIFF" xmlns=
"http://www.w3.org/2005/Atom">
110 <xsl:param name=
"FIRST" />
111 <xsl:param name=
"SECOND" />
113 <xsl:call-template name=
"MAKE_ENTRY">
114 <xsl:with-param name=
"BEFORE" select=
"$SECOND" />
115 <xsl:with-param name=
"AFTER" select=
"$FIRST" />
120 <xsl:template name=
"GET_FILENAME">
121 <xsl:param name=
"ID" />
123 <xsl:value-of select=
"$WEB_ROOT_ABSOLUTE_FILE_PATH" />
124 <xsl:text>/build-
</xsl:text>
125 <xsl:value-of select=
"$ID" />
126 <xsl:text>/report.xml
</xsl:text>
131 <xsl:template name=
"MAKE_ENTRY" xmlns=
"http://www.w3.org/2005/Atom" xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
132 <xsl:param name=
"BEFORE" />
133 <xsl:param name=
"AFTER" />
135 <xsl:variable name=
"FAILURES_SINCE_LAST_BUILD">
136 <xsl:call-template name=
"FIND_NEW_FAILURES">
137 <xsl:with-param name=
"BEFORE" select=
"$BEFORE" />
138 <xsl:with-param name=
"AFTER" select=
"$AFTER" />
142 <xsl:variable name=
"FIXES_SINCE_LAST_BUILD">
143 <xsl:call-template name=
"FIND_NEW_FIXES">
144 <xsl:with-param name=
"BEFORE" select=
"$BEFORE" />
145 <xsl:with-param name=
"AFTER" select=
"$AFTER" />
149 <xsl:variable name=
"PERSISTING_FAILURES">
150 <xsl:call-template name=
"FIND_PERMANENT_FAILURES">
151 <xsl:with-param name=
"BEFORE" select=
"$BEFORE" />
152 <xsl:with-param name=
"AFTER" select=
"$AFTER" />
156 <xsl:variable name=
"SUMMARY">
157 <xsl:call-template name=
"MAKE_SUMMARY">
158 <xsl:with-param name=
"REGRESSION_LIST" select=
"$FAILURES_SINCE_LAST_BUILD" />
159 <xsl:with-param name=
"IMPROVEMENT_LIST" select=
"$FIXES_SINCE_LAST_BUILD" />
164 <title>Build
<xsl:value-of select=
"$AFTER/build/@number" /> (
<xsl:value-of select=
"$SUMMARY" />)
</title>
166 <xsl:attribute name=
"href">
167 <xsl:value-of select=
"$BASE_URL" />
168 <xsl:text>build-
</xsl:text>
169 <xsl:value-of select=
"$AFTER/build/@number" />
170 <xsl:text>/
</xsl:text>
173 <updated><xsl:value-of select=
"$AFTER/build/buildinfo/@started" /></updated>
174 <id>tag:
<xsl:value-of select=
"$RSS_TAG_PREFIX" />,build-diff-
<xsl:value-of select=
"$BEFORE/build/@number" />-
<xsl:value-of select=
"$AFTER/build/@number" /></id>
175 <content type=
"xhtml">
176 <xhtml:div xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
177 <xhtml:h1>HelenOS nightly build
<xsl:value-of select=
"$AFTER/build/@number" /> (
<xsl:value-of select=
"$SUMMARY" />)
</xhtml:h1>
178 <xhtml:h2>Broken since build
<xsl:value-of select=
"$BEFORE/build/@number" /></xhtml:h2>
180 <xsl:when test=
"normalize-space($FAILURES_SINCE_LAST_BUILD) = ''">
181 <xhtml:p>No change.
</xhtml:p>
185 <xsl:call-template name=
"MAKE_LIST">
186 <xsl:with-param name=
"ROOT" select=
"$AFTER" />
187 <xsl:with-param name=
"LOGS" select=
"normalize-space($FAILURES_SINCE_LAST_BUILD)" />
193 <xhtml:h2>Fixed since build
<xsl:value-of select=
"$BEFORE/build/@number" /></xhtml:h2>
195 <xsl:when test=
"normalize-space($FIXES_SINCE_LAST_BUILD) = ''">
196 <xhtml:p>No change.
</xhtml:p>
200 <!-- Remove the link here -->
201 <xsl:call-template name=
"MAKE_LIST">
202 <xsl:with-param name=
"ROOT" select=
"$BEFORE" />
203 <xsl:with-param name=
"LOGS" select=
"normalize-space($FIXES_SINCE_LAST_BUILD)" />
209 <xhtml:h2>Still failing
</xhtml:h2>
211 <xsl:when test=
"normalize-space($PERSISTING_FAILURES) = ''">
212 <xhtml:p>No other failures.
</xhtml:p>
216 <!-- Remove the link here -->
217 <xsl:call-template name=
"MAKE_LIST">
218 <xsl:with-param name=
"ROOT" select=
"$AFTER" />
219 <xsl:with-param name=
"LOGS" select=
"normalize-space($PERSISTING_FAILURES)" />
229 <xsl:template name=
"FIND_NEW_FAILURES">
230 <xsl:param name=
"BEFORE" />
231 <xsl:param name=
"AFTER" />
232 <xsl:for-each select=
"$AFTER/build/*[@result = 'fail']">
234 <xsl:variable name=
"AFTER_LOG" select=
"./@log" />
235 <xsl:variable name=
"BEFORE_NODE" select=
"$BEFORE/build/*[@log=$AFTER_LOG][1]" />
236 <xsl:if test=
"not($BEFORE_NODE)">
237 <xsl:value-of select=
"$AFTER_LOG" />
238 <xsl:text> </xsl:text>
241 <xsl:for-each select=
"$BEFORE/build/*[@result != 'fail']">
243 <xsl:variable name=
"BEFORE_RESULT" select=
"./@result" />
244 <xsl:variable name=
"BEFORE_LOG" select=
"./@log" />
245 <xsl:variable name=
"AFTER_NODE" select=
"$AFTER/build/*[@log=$BEFORE_LOG][1]" />
246 <xsl:variable name=
"AFTER_RESULT" select=
"$AFTER_NODE/@result" />
247 <xsl:if test=
"$AFTER_RESULT = 'fail'">
248 <xsl:value-of select=
"$BEFORE_LOG" />
249 <xsl:text> </xsl:text>
251 <xsl:if test=
"($AFTER_RESULT = 'skip') and ($BEFORE_RESULT = 'ok')">
252 <xsl:value-of select=
"$BEFORE_LOG" />
253 <xsl:text> </xsl:text>
258 <xsl:template name=
"FIND_NEW_FIXES">
259 <xsl:param name=
"BEFORE" />
260 <xsl:param name=
"AFTER" />
261 <xsl:for-each select=
"$AFTER/build/*[@result = 'ok']">
263 <xsl:variable name=
"AFTER_RESULT" select=
"./@result" />
264 <xsl:variable name=
"AFTER_LOG" select=
"./@log" />
265 <xsl:variable name=
"BEFORE_NODE" select=
"$BEFORE/build/*[@log=$AFTER_LOG][1]" />
266 <xsl:variable name=
"BEFORE_RESULT" select=
"$BEFORE_NODE/@result" />
267 <xsl:if test=
"$BEFORE_RESULT = 'fail'">
268 <xsl:value-of select=
"$AFTER_LOG" />
269 <xsl:text> </xsl:text>
274 <xsl:template name=
"FIND_PERMANENT_FAILURES">
275 <xsl:param name=
"BEFORE" />
276 <xsl:param name=
"AFTER" />
277 <xsl:for-each select=
"$BEFORE/build/*[@result != 'ok']">
278 <xsl:sort select=
"name()" />
279 <xsl:sort select=
"@package" />
280 <xsl:sort select=
"@arch" />
281 <xsl:sort select=
"@scenario" />
282 <xsl:variable name=
"BEFORE_RESULT" select=
"./@result" />
283 <xsl:variable name=
"BEFORE_LOG" select=
"./@log" />
284 <xsl:variable name=
"AFTER_NODE" select=
"$AFTER/build/*[@log=$BEFORE_LOG][1]" />
285 <xsl:variable name=
"AFTER_RESULT" select=
"$AFTER_NODE/@result" />
286 <xsl:if test=
"($AFTER_RESULT != 'ok') and not(($BEFORE_RESULT = 'skip') and ($AFTER_RESULT = 'fail'))">
287 <xsl:value-of select=
"$BEFORE_LOG" />
288 <xsl:text> </xsl:text>
296 <xsl:template name=
"MAKE_LIST">
297 <xsl:param name=
"ROOT" />
298 <xsl:param name=
"LOGS" />
300 <xsl:variable name=
"FIRST">
302 <xsl:when test=
"substring-before($LOGS, ' ') = ''">
303 <xsl:value-of select=
"$LOGS" />
306 <xsl:value-of select=
"substring-before($LOGS, ' ')" />
310 <xsl:variable name=
"REMAINING" select=
"substring-after($LOGS, ' ')" />
312 <xsl:variable name=
"NODE" select=
"$ROOT/build/*[@log=$FIRST][1]" />
314 <xsl:variable name=
"TEXT">
315 <xsl:apply-templates select=
"$NODE" mode=
"failure-list" />
320 <xsl:attribute name=
"href">
321 <xsl:value-of select=
"$BASE_URL" />
322 <xsl:text>build-
</xsl:text>
323 <xsl:value-of select=
"$ROOT/build/@number" />
324 <xsl:text>/
</xsl:text>
325 <xsl:value-of select=
"$NODE/@log" />
327 <xsl:value-of select=
"$TEXT" />
331 <xsl:if test=
"$REMAINING != ''" >
332 <xsl:call-template name=
"MAKE_LIST">
333 <xsl:with-param name=
"ROOT" select=
"$ROOT" />
334 <xsl:with-param name=
"LOGS" select=
"$REMAINING" />
340 <xsl:template match=
"browsable-sources-global" mode=
"failure-list">
341 <xsl:text>Browsable sources.
</xsl:text>
344 <xsl:template match=
"checkout" mode=
"failure-list">
345 <xsl:text>Checkout of
</xsl:text>
346 <xsl:value-of select=
"@repository" />
347 <xsl:text>.
</xsl:text>
350 <xsl:template match=
"harbour-build" mode=
"failure-list">
351 <xsl:text>Harbour build of
</xsl:text>
352 <xsl:value-of select=
"@package" />
353 <xsl:text> for
</xsl:text>
354 <xsl:value-of select=
"@arch" />
355 <xsl:text>.
</xsl:text>
358 <xsl:template match=
"harbour-fetch" mode=
"failure-list">
359 <xsl:text>Harbour fetch for
</xsl:text>
360 <xsl:value-of select=
"@package" />
361 <xsl:text>.
</xsl:text>
364 <xsl:template match=
"helenos-build" mode=
"failure-list">
365 <xsl:text>HelenOS build for
</xsl:text>
366 <xsl:value-of select=
"@arch" />
367 <xsl:text>.
</xsl:text>
370 <xsl:template match=
"helenos-extra-build" mode=
"failure-list">
371 <xsl:text>HelenOS extra build with
</xsl:text>
372 <xsl:value-of select=
"@harbours" />
373 <xsl:text> for
</xsl:text>
374 <xsl:value-of select=
"@arch" />
375 <xsl:text>.
</xsl:text>
378 <xsl:template match=
"sycek-style-check" mode=
"failure-list">
379 <xsl:text>Sycek C style check.
</xsl:text>
382 <xsl:template match=
"test" mode=
"failure-list">
383 <xsl:text>Automated test
</xsl:text>
384 <xsl:value-of select=
"@scenario" />
385 <xsl:text> on
</xsl:text>
386 <xsl:value-of select=
"@arch" />
387 <xsl:text>.
</xsl:text>
390 <xsl:template match=
"tool-build" mode=
"failure-list">
391 <xsl:text>Build of
</xsl:text>
392 <xsl:value-of select=
"@tool" />
393 <xsl:text> tool.
</xsl:text>
397 <xsl:template match=
"*" mode=
"failure-list">
398 <xsl:value-of select=
"name()" />
399 <xsl:text>.
</xsl:text>
403 <xsl:template name=
"MAKE_SUMMARY">
404 <xsl:param name=
"REGRESSION_LIST" select=
"''" />
405 <xsl:param name=
"IMPROVEMENT_LIST" select=
"''" />
407 <xsl:variable name=
"REGRESSION_COUNT">
408 <xsl:call-template name=
"COUNT_ITEMS">
409 <xsl:with-param name=
"LIST" select=
"normalize-space($REGRESSION_LIST)" />
413 <xsl:variable name=
"IMPROVEMENT_COUNT">
414 <xsl:call-template name=
"COUNT_ITEMS">
415 <xsl:with-param name=
"LIST" select=
"normalize-space($IMPROVEMENT_LIST)" />
420 <xsl:text>[</xsl:text>
421 <xsl:value-of select="$REGRESSION_COUNT" />
422 <xsl:text>:</xsl:text>
423 <xsl:value-of select="$IMPROVEMENT_COUNT" />
424 <xsl:text>]</xsl:text>
427 <xsl:variable name=
"REGRESSION_TEXT">
429 <xsl:when test=
"$REGRESSION_COUNT = 1">
430 <xsl:text>1 regression
</xsl:text>
433 <xsl:value-of select=
"$REGRESSION_COUNT" />
434 <xsl:text> regressions
</xsl:text>
439 <xsl:variable name=
"IMPROVEMENT_TEXT">
441 <xsl:when test=
"$IMPROVEMENT_COUNT = 1">
442 <xsl:text>1 fix
</xsl:text>
445 <xsl:value-of select=
"$IMPROVEMENT_COUNT" />
446 <xsl:text> fixes
</xsl:text>
452 <xsl:when test=
"$REGRESSION_COUNT + $IMPROVEMENT_COUNT = 0">
453 <xsl:text>no change
</xsl:text>
455 <xsl:when test=
"$REGRESSION_COUNT = 0">
456 <xsl:value-of select=
"$IMPROVEMENT_TEXT" />
458 <xsl:when test=
"$IMPROVEMENT_COUNT = 0">
459 <xsl:value-of select=
"$REGRESSION_TEXT" />
462 <xsl:value-of select=
"$REGRESSION_TEXT" />
463 <xsl:text>,
</xsl:text>
464 <xsl:value-of select=
"$IMPROVEMENT_TEXT" />
469 <xsl:template name=
"COUNT_ITEMS">
470 <xsl:param name=
"LIST" select=
"''" />
472 <xsl:variable name=
"FIRST">
474 <xsl:when test=
"substring-before($LIST, ' ') = ''">
475 <xsl:value-of select=
"$LIST" />
478 <xsl:value-of select=
"substring-before($LIST, ' ')" />
483 <xsl:variable name=
"REMAINING" select=
"substring-after($LIST, ' ')" />
485 <xsl:variable name=
"REMAINING_COUNT">
487 <xsl:when test=
"$REMAINING = ''">0</xsl:when>
489 <xsl:call-template name=
"COUNT_ITEMS">
490 <xsl:with-param name=
"LIST" select=
"$REMAINING" />
496 <xsl:variable name=
"RESULT">
498 <xsl:when test=
"$FIRST = ''">0</xsl:when>
499 <xsl:otherwise><xsl:value-of select=
"1 + $REMAINING_COUNT" /></xsl:otherwise>
503 <xsl:value-of select=
"$RESULT" />