Add buildbot tools and config include files.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
6
build/buildbot/tools/bot.xsd
Normal file
6
build/buildbot/tools/bot.xsd
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<element name="bot">
|
||||
<!-- todo -->
|
||||
</element>
|
||||
</schema>
|
304
build/buildbot/tools/embedded.xsl
Normal file
304
build/buildbot/tools/embedded.xsl
Normal file
@@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Name: embedded.xsl
|
||||
Purpose: Embedded XSLT
|
||||
Author: Mike Wetherell
|
||||
RCS-ID: $Id$
|
||||
Copyright: (c) 2007 Mike Wetherell
|
||||
Licence: wxWidgets licence
|
||||
-->
|
||||
|
||||
<transform xmlns="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:XSL="XSL"
|
||||
version="1.0">
|
||||
|
||||
<namespace-alias stylesheet-prefix="XSL" result-prefix="xsl"/>
|
||||
|
||||
<output indent="yes"/>
|
||||
|
||||
<variable
|
||||
name="top-level-base"
|
||||
select="/*/xsl:import |
|
||||
/*/xsl:include |
|
||||
/*/xsl:attribute-set |
|
||||
/*/xsl:character-map |
|
||||
/*/xsl:decimal-format |
|
||||
/*/xsl:function |
|
||||
/*/xsl:import-schema |
|
||||
/*/xsl:key |
|
||||
/*/xsl:namespace-alias |
|
||||
/*/xsl:output |
|
||||
/*/xsl:param |
|
||||
/*/xsl:preserve-space |
|
||||
/*/xsl:strip-space |
|
||||
/*/xsl:variable"/>
|
||||
|
||||
<variable
|
||||
name="top-level"
|
||||
select="$top-level-base |
|
||||
/*/xsl:template"/>
|
||||
|
||||
<variable
|
||||
name="top-level-copy"
|
||||
select="$top-level-base |
|
||||
/*/xsl:template
|
||||
[not(following-sibling::xsl:template/@name = @name)]"/>
|
||||
|
||||
<template match="/">
|
||||
<XSL:transform>
|
||||
<copy-of select="/*/namespace::*"/>
|
||||
|
||||
<for-each select="/*/@xsl:*">
|
||||
<attribute name="{local-name()}">
|
||||
<value-of select="."/>
|
||||
</attribute>
|
||||
</for-each>
|
||||
|
||||
<apply-templates mode="copy-xsl" select="$top-level-copy"/>
|
||||
<apply-templates select="*"/>
|
||||
</XSL:transform>
|
||||
</template>
|
||||
|
||||
<template match="*">
|
||||
<variable name="pattern">
|
||||
<call-template name="coord-pattern"/>
|
||||
</variable>
|
||||
|
||||
<XSL:template match="*[generate-id() = generate-id(document('', /){$pattern})]">
|
||||
<copy-of select="namespace::*"/>
|
||||
<choose>
|
||||
<when test="/*/xsl:template[@name = name(current())]">
|
||||
<call-template name="expand"/>
|
||||
</when>
|
||||
<when test="count($top-level | .) != count($top-level)">
|
||||
<call-template name="create-context"/>
|
||||
</when>
|
||||
</choose>
|
||||
</XSL:template>
|
||||
|
||||
<if test="not(self::xsl:*)">
|
||||
<apply-templates select="node()"/>
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<template match="text()"/>
|
||||
|
||||
<template match="@*">
|
||||
<copy/>
|
||||
</template>
|
||||
|
||||
<template mode="copy-xsl" match="*[/*/xsl:template/@name = name()]">
|
||||
<choose>
|
||||
<when test="ancestor::xsl:template[@name = name(current())]">
|
||||
<XSL:choose>
|
||||
<XSL:when test="name() = '{name()}'">
|
||||
<XSL:copy>
|
||||
<call-template name="copy-xsl-children"/>
|
||||
</XSL:copy>
|
||||
</XSL:when>
|
||||
<XSL:otherwise>
|
||||
<copy>
|
||||
<call-template name="copy-xsl-children"/>
|
||||
</copy>
|
||||
</XSL:otherwise>
|
||||
</XSL:choose>
|
||||
</when>
|
||||
<otherwise>
|
||||
<call-template name="expand"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
<template mode="copy-xsl" match="@*|node()">
|
||||
<copy>
|
||||
<call-template name="copy-xsl-children"/>
|
||||
</copy>
|
||||
</template>
|
||||
|
||||
<template name="copy-xsl-children">
|
||||
<copy-of select="namespace::*"/>
|
||||
<apply-templates mode="copy-xsl" select="@*|node()"/>
|
||||
</template>
|
||||
|
||||
<template name="coord-pattern">
|
||||
<param name="element" select="."/>
|
||||
|
||||
<for-each select="$element/ancestor-or-self::*">
|
||||
<text>/*[</text>
|
||||
<value-of select="count(preceding-sibling::*) + 1"/>
|
||||
<text>]</text>
|
||||
</for-each>
|
||||
</template>
|
||||
|
||||
<template name="expand">
|
||||
<variable name="params" select="/*/xsl:template[@name = name(current())]/xsl:param"/>
|
||||
|
||||
<XSL:call-template name="{name()}">
|
||||
<if test="$params">
|
||||
<XSL:with-param name="{$params[1]/@name}">
|
||||
<choose>
|
||||
<when test="ancestor-or-self::xsl:*">
|
||||
<apply-templates mode="copy-xsl" select="node()"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<variable name="pattern">
|
||||
<call-template name="coord-pattern"/>
|
||||
</variable>
|
||||
<XSL:apply-templates select="{$pattern}/node()"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</XSL:with-param>
|
||||
</if>
|
||||
|
||||
<for-each select="@*">
|
||||
<XSL:with-param name="{name()}">
|
||||
<call-template name="avt">
|
||||
<with-param name="string" select="."/>
|
||||
</call-template>
|
||||
</XSL:with-param>
|
||||
</for-each>
|
||||
</XSL:call-template>
|
||||
</template>
|
||||
|
||||
<template name="create-context">
|
||||
<param name="elements" select="ancestor-or-self::*
|
||||
[last() - 1 > position()]
|
||||
/preceding-sibling::xsl:variable | ."/>
|
||||
|
||||
<variable name="pattern">
|
||||
<call-template name="coord-pattern">
|
||||
<with-param name="element" select="$elements[1]"/>
|
||||
</call-template>
|
||||
</variable>
|
||||
|
||||
<variable name="parent-pattern">
|
||||
<call-template name="coord-pattern">
|
||||
<with-param name="element" select="$elements[1]/.."/>
|
||||
</call-template>
|
||||
</variable>
|
||||
|
||||
<XSL:for-each select="{$parent-pattern}/*">
|
||||
<XSL:if test="count({$pattern} | .) = 1">
|
||||
<choose>
|
||||
<when test="$elements[1]/self::xsl:*">
|
||||
<apply-templates mode="copy-xsl" select="$elements[1]"/>
|
||||
<if test="$elements[2]">
|
||||
<call-template name="create-context">
|
||||
<with-param name="elements" select="$elements[position() > 1]"/>
|
||||
</call-template>
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<copy>
|
||||
<apply-templates select="@*"/>
|
||||
<if test="node()">
|
||||
<XSL:apply-templates select="node()"/>
|
||||
</if>
|
||||
</copy>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</XSL:if>
|
||||
</XSL:for-each>
|
||||
</template>
|
||||
|
||||
<template name="before">
|
||||
<param name="string"/>
|
||||
<param name="target"/>
|
||||
|
||||
<variable name="apos">'</variable>
|
||||
<variable name="quot">"</variable>
|
||||
|
||||
<variable name="posapos" select="string-length(substring-before(
|
||||
concat($string, $apos), $apos))"/>
|
||||
<variable name="posquot" select="string-length(substring-before(
|
||||
concat($string, $quot), $quot))"/>
|
||||
<variable name="postarg" select="string-length(substring-before(
|
||||
concat($string, $target), $target))"/>
|
||||
|
||||
<choose>
|
||||
<when test="$posapos = $postarg and $posquot = $postarg">
|
||||
<value-of select="$string"/>
|
||||
</when>
|
||||
<when test="$posapos > $postarg and $posquot > $postarg">
|
||||
<value-of select="substring($string, 1, $postarg)"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<variable name="delim">
|
||||
<choose>
|
||||
<when test="$posquot > $posapos">'</when>
|
||||
<otherwise>"</otherwise>
|
||||
</choose>
|
||||
</variable>
|
||||
|
||||
<value-of select="substring-before($string, $delim)"/>
|
||||
<value-of select="$delim"/>
|
||||
|
||||
<variable name="mid" select="substring-after($string, $delim)"/>
|
||||
|
||||
<choose>
|
||||
<when test="contains($mid, $delim)">
|
||||
<value-of select="substring-before($mid, $delim)"/>
|
||||
<value-of select="$delim"/>
|
||||
|
||||
<call-template name="before">
|
||||
<with-param name="string"
|
||||
select="substring-after($mid, $delim)"/>
|
||||
<with-param name="target"
|
||||
select="$target"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<otherwise>
|
||||
<value-of select="$mid"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
<template name="avt">
|
||||
<param name="string"/>
|
||||
|
||||
<variable name="before1" select="substring-before(concat($string, '{'), '{')"/>
|
||||
<variable name="len1" select="string-length($before1)"/>
|
||||
|
||||
<variable name="before2" select="substring-before(concat($string, '}}'), '}}')"/>
|
||||
<variable name="len2" select="string-length($before2)"/>
|
||||
|
||||
<choose>
|
||||
<when test="$before1 = $string and $before2 = $string">
|
||||
<value-of select="$string"/>
|
||||
</when>
|
||||
<when test="$len2 < $len1">
|
||||
<value-of select="$before2"/>
|
||||
<text>}</text>
|
||||
<call-template name="avt">
|
||||
<with-param name="string" select="substring($string, $len2 + 3)"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<when test="substring($string, $len1 + 2, 1) = '{'">
|
||||
<value-of select="$before1"/>
|
||||
<text>{</text>
|
||||
<call-template name="avt">
|
||||
<with-param name="string" select="substring($string, $len1 + 3)"/>
|
||||
</call-template>
|
||||
</when>
|
||||
<otherwise>
|
||||
<variable name="mid" select="substring($string, $len1 + 2)"/>
|
||||
<variable name="expr">
|
||||
<call-template name="before">
|
||||
<with-param name="string" select="$mid"/>
|
||||
<with-param name="target">}</with-param>
|
||||
</call-template>
|
||||
</variable>
|
||||
<value-of select="$before1"/>
|
||||
<XSL:copy-of select="{$expr}"/>
|
||||
<call-template name="avt">
|
||||
<with-param name="string" select="substring($mid, string-length($expr) + 2)"/>
|
||||
</call-template>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</template>
|
||||
|
||||
</transform>
|
23
build/buildbot/tools/preprocess.sh
Executable file
23
build/buildbot/tools/preprocess.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
#############################################################################
|
||||
# Name: preprocess
|
||||
# Purpose: Expand embedded xslt
|
||||
# Author: Mike Wetherell
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2007 Mike Wetherell
|
||||
# Licence: wxWidgets licence
|
||||
#############################################################################
|
||||
|
||||
if [ $# -eq 0 -o ! -f "$1" ]; then
|
||||
echo "Usage: $0 FILE..."
|
||||
echo "Expands embedded xslt"
|
||||
exit 1
|
||||
fi >&2
|
||||
|
||||
DIR="`dirname $0`"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
xsltproc --xinclude $DIR/embedded.xsl "$1" 2>/dev/null |
|
||||
xsltproc --xinclude - "$1"
|
||||
shift
|
||||
done
|
65
build/buildbot/tools/validate.sh
Executable file
65
build/buildbot/tools/validate.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
#############################################################################
|
||||
# Name: validate
|
||||
# Purpose: Reports errors in wxWidgets buildbot configuration files
|
||||
# Author: Mike Wetherell
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2007 Mike Wetherell
|
||||
# Licence: wxWidgets licence
|
||||
#############################################################################
|
||||
|
||||
if [ $# -eq 0 -o ! -f "$1" ]; then
|
||||
echo "Usage: $0 FILE..."
|
||||
echo "Reports errors in wxWidgets buildbot configuration files"
|
||||
exit 1
|
||||
fi >&2
|
||||
|
||||
DIR="`dirname $0`"
|
||||
WORKDIR="${TMPDIR:-/tmp}/wx.$$"
|
||||
mkdir "$WORKDIR" || exit
|
||||
trap 'rm -rf "$WORKDIR"' EXIT
|
||||
WORKPAT=`echo "$WORKDIR" | sed 's|[^A-Za-z0-9/]|.|g'`
|
||||
|
||||
# Change the names of the temporary files in an error message to something
|
||||
# to something more informative
|
||||
#
|
||||
error()
|
||||
{
|
||||
if [ -n "$1" ]; then
|
||||
echo "$1" |
|
||||
sed "s|file ${WORKPAT}|${WORKPAT}|g;\
|
||||
s|${WORKPAT}/XSLT|generated XSLT (from $NAME)|g;\
|
||||
s|${WORKPAT}/prep|$NAME (preprocessed)|g"
|
||||
fi
|
||||
}
|
||||
|
||||
# This is pretty ugly, sorry. It tries not to print the same error more than
|
||||
# once, and it tries to send success message to stdout and errors to stderr.
|
||||
# It still doesn't return a meaningful exit code.
|
||||
#
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
INPUT="$1"
|
||||
NAME="`echo \"$INPUT\" | sed 's/[|\]/\\\&/g'`"
|
||||
XSLT="$WORKDIR/XSLT"
|
||||
OUTPUT="$WORKDIR/prep"
|
||||
|
||||
if STDERR=`xsltproc --xinclude -o "$XSLT" $DIR/embedded.xsl "$INPUT" 2>&1`
|
||||
then
|
||||
STDERR=`xsltproc --xinclude -o "$OUTPUT" "$XSLT" "$INPUT" 2>&1` \
|
||||
&& OK=true || OK=false
|
||||
error "$STDERR" >&2
|
||||
|
||||
if $OK; then
|
||||
STDERR=`xmllint --noout --schema $DIR/bot.xsd "$OUTPUT" 2>&1` \
|
||||
&& OUT=1 || OUT=2
|
||||
error "$STDERR" >&$OUT
|
||||
fi
|
||||
else
|
||||
error "$STDERR" >&2
|
||||
fi
|
||||
|
||||
rm -f "$XSLT" "$OUTPUT"
|
||||
|
||||
shift
|
||||
done
|
Reference in New Issue
Block a user