Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Subclasses of various slave command classes.""" | 5 """Subclasses of various slave command classes.""" |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 import errno | 8 import errno |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| 11 import os | 11 import os |
| 12 import time | 12 import time |
| 13 | 13 |
| 14 from twisted.python import log | 14 from twisted.python import log |
| 15 | 15 |
| 16 from buildbot import interfaces, util | 16 from buildbot import interfaces, util |
| 17 from buildbot.process import buildstep | 17 from buildbot.process import buildstep |
| 18 from buildbot.process.properties import WithProperties | 18 from buildbot.process.properties import WithProperties |
| 19 from buildbot.status import builder | 19 from buildbot.status import builder |
| 20 from buildbot.steps import shell | 20 from buildbot.steps import shell |
| 21 from buildbot.steps import source | 21 from buildbot.steps import source |
| 22 from buildbot.process.buildstep import LoggingBuildStep | 22 from buildbot.process.buildstep import LoggingBuildStep |
| 23 | 23 |
| 24 from common import annotator | 24 from common import annotator |
| 25 from common import chromium_utils | 25 from common import chromium_utils |
| 26 import config | 26 import config |
| 27 | 27 |
| 28 | 28 |
| 29 GOT_REVISION_PROPERTIES = ( | |
| 30 ('got_nacl_revision', 'got_nacl_revision'), | |
| 31 ('got_swarm_client_revision', 'got_swarm_client_revision'), | |
| 32 ('got_swarming_client_revision', 'got_swarming_client_revision'), | |
| 33 ('got_v8_revision', 'got_v8_revision'), | |
| 34 ('got_webkit_revision', 'got_webkit_revision'), | |
| 35 ('got_webrtc_revision', 'got_webrtc_revision'), | |
| 36 ) | |
| 37 | |
| 38 | |
| 29 def change_to_revision(c): | 39 def change_to_revision(c): |
| 30 """Handle revision == None or any invalid value.""" | 40 """Handle revision == None or any invalid value.""" |
| 31 try: | 41 try: |
| 32 return int(str(c.revision).split('@')[-1]) | 42 return int(str(c.revision).split('@')[-1]) |
| 33 except (ValueError, TypeError): | 43 except (ValueError, TypeError): |
| 34 return 0 | 44 return 0 |
| 35 | 45 |
| 36 | 46 |
| 37 def updateText(section): | 47 def updateText(section): |
| 38 # Reflect step status in text2. | 48 # Reflect step status in text2. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 def commandComplete(self, cmd): | 270 def commandComplete(self, cmd): |
| 261 """Handles status updates from buildbot slave when the step is done. | 271 """Handles status updates from buildbot slave when the step is done. |
| 262 | 272 |
| 263 Update the relevant got_XX_revision build properties if available. | 273 Update the relevant got_XX_revision build properties if available. |
| 264 """ | 274 """ |
| 265 source.Source.commandComplete(self, cmd) | 275 source.Source.commandComplete(self, cmd) |
| 266 primary_repo = self.args.get('primary_repo', '') | 276 primary_repo = self.args.get('primary_repo', '') |
| 267 primary_revision_key = 'got_' + primary_repo + 'revision' | 277 primary_revision_key = 'got_' + primary_repo + 'revision' |
| 268 properties = ( | 278 properties = ( |
| 269 ('got_revision', primary_revision_key), | 279 ('got_revision', primary_revision_key), |
| 270 ('got_nacl_revision', 'got_nacl_revision'), | 280 ) + GOT_REVISION_PROPERTIES |
| 271 ('got_swarm_client_revision', 'got_swarm_client_revision'), | |
| 272 ('got_swarming_client_revision', 'got_swarming_client_revision'), | |
| 273 ('got_v8_revision', 'got_v8_revision'), | |
| 274 ('got_webkit_revision', 'got_webkit_revision'), | |
| 275 ('got_webrtc_revision', 'got_webrtc_revision'), | |
| 276 ) | |
| 277 for prop_name, cmd_arg in properties: | 281 for prop_name, cmd_arg in properties: |
| 278 if cmd_arg in cmd.updates: | 282 if cmd_arg in cmd.updates: |
| 279 got_revision = cmd.updates[cmd_arg][-1] | 283 got_revision = cmd.updates[cmd_arg][-1] |
| 280 if got_revision: | 284 if got_revision: |
| 281 self.setProperty(prop_name, str(got_revision), 'Source') | 285 self.setProperty(prop_name, str(got_revision), 'Source') |
| 282 | 286 |
| 283 | 287 |
| 284 class ApplyIssue(LoggingBuildStep): | 288 class ApplyIssue(LoggingBuildStep): |
| 285 """Runs the apply_issue.py script on the slave.""" | 289 """Runs the apply_issue.py script on the slave.""" |
| 286 | 290 |
| 287 def __init__(self, root, issue, patchset, email, password, workdir, timeout, | 291 def __init__(self, root, issue, patchset, email, password, workdir, timeout, |
| 288 server, **kwargs): | 292 server, **kwargs): |
| 289 LoggingBuildStep.__init__(self, **kwargs) | 293 LoggingBuildStep.__init__(self, **kwargs) |
| 290 self.args = {'root': root, | 294 self.args = {'root': root, |
| 291 'issue': issue, | 295 'issue': issue, |
| 292 'patchset': patchset, | 296 'patchset': patchset, |
| 293 'email': email, | 297 'email': email, |
| 294 'password': password, | 298 'password': password, |
| 295 'workdir': workdir, | 299 'workdir': workdir, |
| 296 'timeout': timeout, | 300 'timeout': timeout, |
| 297 'server': server, | 301 'server': server, |
| 298 } | 302 } |
| 299 | 303 |
| 300 def start(self): | 304 def start(self): |
| 301 args = dict((name, self.build.render(value)) | 305 args = dict((name, self.build.render(value)) |
| 302 for name, value in self.args.iteritems()) | 306 for name, value in self.args.iteritems()) |
| 303 cmd = buildstep.LoggedRemoteCommand('apply_issue', args) | 307 cmd = buildstep.LoggedRemoteCommand('apply_issue', args) |
| 304 self.startCommand(cmd) | 308 self.startCommand(cmd) |
| 305 | 309 |
| 310 def commandComplete(self, cmd): | |
|
ghost stip (do not use)
2013/11/14 22:25:40
nope
| |
| 311 """Handles status updates from buildbot slave when the step is done. | |
| 312 | |
| 313 Update the relevant got_XX_revision build properties if available. This only | |
| 314 happens if the DEPS file was modified. | |
| 315 """ | |
| 316 LoggingBuildStep.commandComplete(self, cmd) | |
| 317 for prop_name, cmd_arg in GOT_REVISION_PROPERTIES: | |
| 318 if cmd_arg in cmd.updates: | |
| 319 got_revision = cmd.updates[cmd_arg][-1] | |
| 320 if got_revision: | |
| 321 self.setProperty(prop_name, str(got_revision), 'Source') | |
| 322 | |
| 306 | 323 |
| 307 class BuilderStatus(object): | 324 class BuilderStatus(object): |
| 308 # Order in asceding severity. | 325 # Order in asceding severity. |
| 309 BUILD_STATUS_ORDERING = [ | 326 BUILD_STATUS_ORDERING = [ |
| 310 builder.SUCCESS, | 327 builder.SUCCESS, |
| 311 builder.WARNINGS, | 328 builder.WARNINGS, |
| 312 builder.FAILURE, | 329 builder.FAILURE, |
| 313 builder.EXCEPTION, | 330 builder.EXCEPTION, |
| 314 ] | 331 ] |
| 315 | 332 |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 def evaluateCommand(self, cmd): | 1131 def evaluateCommand(self, cmd): |
| 1115 observer_result = self.script_observer.annotate_status | 1132 observer_result = self.script_observer.annotate_status |
| 1116 # Check if ProcessLogShellStep detected a failure or warning also. | 1133 # Check if ProcessLogShellStep detected a failure or warning also. |
| 1117 log_processor_result = ProcessLogShellStep.evaluateCommand(self, cmd) | 1134 log_processor_result = ProcessLogShellStep.evaluateCommand(self, cmd) |
| 1118 return BuilderStatus.combine(observer_result, log_processor_result) | 1135 return BuilderStatus.combine(observer_result, log_processor_result) |
| 1119 | 1136 |
| 1120 def commandComplete(self, cmd): | 1137 def commandComplete(self, cmd): |
| 1121 self.script_observer.handleReturnCode(cmd.rc) | 1138 self.script_observer.handleReturnCode(cmd.rc) |
| 1122 self._removePreamble() | 1139 self._removePreamble() |
| 1123 return ProcessLogShellStep.commandComplete(self, cmd) | 1140 return ProcessLogShellStep.commandComplete(self, cmd) |
| OLD | NEW |