summaryrefslogtreecommitdiffstats
path: root/WebKitTools/BuildSlaveSupport/build.webkit.org-config/webkit/basesteps.py
blob: 8bba8810d479fbfa4c621db175de6a9f6fb48640 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from buildbot.steps import shell, source
import os


def buildStepWithDefaultTimeout(klass, default_timeout=75*60):
    class Step(klass):
        timeout = default_timeout
        def __init__(self, *args, **kwargs):
            kwargs['timeout'] = self.timeout
            klass.__init__(self, *args, **kwargs)

    return Step


Test = buildStepWithDefaultTimeout(shell.Test)
Compile = buildStepWithDefaultTimeout(shell.Compile)
ShellCommand = buildStepWithDefaultTimeout(shell.ShellCommand)
SVN = buildStepWithDefaultTimeout(source.SVN)


class UploadCommand:
    def initializeForUpload(self):
        try:
            try:
                umask = os.umask(0)
                os.makedirs(self.getDestinationPath(), 042770)
            except OSError, e:
                if e.errno != 17:
                    raise
        finally:
            os.umask(umask)

    def getDestinationPath(self):
        return "/home/buildresults%s" % (self.getURLPath(), )

    def getRemotePath(self):
        return "buildresults@build.webkit.org:%s" % (self.getDestinationPath(), )

    def getURLPath(self):
        return '/results/%s/%s/' % (self.getBuild().builder.name, self.getBuild().getProperty("buildnumber"), )

    def getBuild(self):
        return self.build


    def getText(self, cmd, results):
        return self.getText2(cmd, results)

    def getText2(self, cmd, results):
        return ['<a href="%s">%s</a>' % (self.getURLPath(), self.name)]