aboutsummaryrefslogtreecommitdiff
path: root/utils/mangle-jobs/add-copy-to-slave.mangle
blob: de28ddef3045b1725e949f52e27b9245ec844d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Add copy-to-slave plugin setup for build dependencies

#from lxml.etree import Element
from lxml.etree import fromstring

new_node = """\
    <com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
      <includes>**/*</includes>
      <excludes></excludes>
      <flatten>false</flatten>
      <includeAntExcludes>false</includeAntExcludes>
      <hudsonHomeRelative>false</hudsonHomeRelative>
      <relativeTo>copyToSlave</relativeTo>
    </com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper>
"""

def mangle(tree):
    if tree.xpath("//com.michelin.cio.hudson.plugins.copytoslave.CopyToSlaveBuildWrapper"):
        # Already there
        return
    tag = tree.xpath('/project/buildWrappers')[0]
    node = fromstring(new_node)
    tag.append(node)
    node.getprevious().tail += "  "
    node.tail = "\n  "