Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
builbot configuration files back up
[simgrid.git] / buildbot / extensions.py
1
2
3 from buildbot.process import step
4 from buildbot.process.step import ShellCommand
5 from buildbot.status import builder
6 from buildbot.status.builder import SUCCESS,FAILURE, EXCEPTION,WARNINGS
7
8 # Define a new builder status
9 # Configure return the exit code 77 when the target platform don't
10 # bear ucontext functionnality. In this case the CustomConfigure returns
11 # INCOMPATIBLE_PLATFORM.
12
13 INCOMPATIBLE_PLATFORM = EXCEPTION +1
14
15 """
16 CustomConfigure class for master-side representation of the
17 custom configure command. This class considers the error (exit code 77)
18 that occurs when the platform target don't bear ucontext functionnality.
19 """
20 class CustomConfigure(ShellCommand):
21
22     name = "configure"
23     description = ["running configure"]
24     descriptionDone = [name]
25
26     # Override evaluateCommand method to handle the case of platform that 
27     # don't support ucontext. The method returns INCOMPATIBLE_PLATFORM
28     # in this case.
29         
30     def evaluateCommand(self, cmd):
31         """Decide whether the command was SUCCESS, INCOMPATIBLE_PLATFORM,
32         or FAILURE."""
33         
34         if cmd.rc == 0:
35                 return SUCCESS
36         elif cmd.rc == 77:
37                 builder.Results.append('incompatible_platform')
38                 return INCOMPATIBLE_PLATFORM
39         else:
40                  return FAILURE
41            
42      # Override getColor method. The method returns the text "yellow" 
43      # when the results parameter is INCOMPATIBLE_PLATFORM.
44         
45     def getColor(self, cmd, results):
46         assert results in (SUCCESS, WARNINGS, FAILURE,INCOMPATIBLE_PLATFORM)
47         if results == SUCCESS:
48             return "green"
49         elif results == WARNINGS:
50             return "orange"
51         elif results == INCOMPATIBLE_PLATFORM:
52             return "bleu"
53         else:
54             return "red"
55             
56         # Override getText method. The method calls describe method
57         # with the text "failed {incompatible platform}" when the platform
58         # don't support ucontext functionnality.
59                
60     def getText(self, cmd, results):
61         if results == SUCCESS:
62             return self.describe(True) + ["Configure success"]
63         elif results == WARNINGS:
64             return self.describe(True) + ["warnings"]
65         elif results == INCOMPATIBLE_PLATFORM:
66             return self.describe(True) + ["failed {incompatible platform}"]
67         else:
68             return self.describe(True) + ["failed"]
69             
70
71
72