2006-10-04 Mark Rowe <bdash@webkit.org>
[WebKit-https.git] / WebKitTools / BuildSlaveSupport / build.webkit.org-config / webkit / basesteps.py
1 from buildbot.process import step
2 import os
3
4
5 def buildStepWithDefaultTimeout(klass, default_timeout=45*60):
6     class Step(klass):
7         timeout = default_timeout
8         def __init__(self, *args, **kwargs):
9             kwargs['timeout'] = self.timeout
10             klass.__init__(self, *args, **kwargs)
11
12     return Step
13
14
15 Test = buildStepWithDefaultTimeout(step.Test)
16 Compile = buildStepWithDefaultTimeout(step.Compile)
17 ShellCommand = buildStepWithDefaultTimeout(step.ShellCommand)
18 SVN = buildStepWithDefaultTimeout(step.SVN)
19
20
21 class UploadCommand:
22     def __init__(self, *args, **kwargs):
23         self.__build = kwargs['build'].getStatus()
24         try:
25             try:
26                 umask = os.umask(0)
27                 os.makedirs(self.getDestinationPath(), 042770)
28             except OSError, e:
29                 if e.errno != 17:
30                     raise
31         finally:
32             os.umask(umask)
33
34     def getDestinationPath(self):
35         return "/home/buildresults/results/%s/%s/" % (self.getBuild().getBuilder().getName(), self.getBuild().getNumber())
36
37     def getRemotePath(self):
38         return "buildresults@build.webkit.org:%s" % (self.getDestinationPath(), )
39
40     def getURLPath(self):
41         return '/results/%s/%s/' % (self.getBuild().getBuilder().getName(), self.getBuild().getNumber(), )
42
43     def getBuild(self):
44         return self.__build
45
46
47     def getText(self, cmd, results):
48         return self.getText2(cmd, results)
49
50     def getText2(self, cmd, results):
51         return ['<a href="%s">%s</a>' % (self.getURLPath(), self.name)]
52