| 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 from datetime import datetime | 7 from datetime import datetime |
| 8 import copy | 8 import copy |
| 9 import errno | 9 import errno |
| 10 import json | 10 import json |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 }, | 618 }, |
| 619 'Debug': { | 619 'Debug': { |
| 620 'chromium-dbg-linux': 'linux-debug', | 620 'chromium-dbg-linux': 'linux-debug', |
| 621 'chromium-dbg-win': 'win-debug', | 621 'chromium-dbg-win': 'win-debug', |
| 622 'chromium-dbg-mac': 'mac-debug', | 622 'chromium-dbg-mac': 'mac-debug', |
| 623 'chromium-dbg-xp': 'xp-debug', | 623 'chromium-dbg-xp': 'xp-debug', |
| 624 'chromium-dbg-linux-try': 'linux-try-debug', | 624 'chromium-dbg-linux-try': 'linux-try-debug', |
| 625 }, | 625 }, |
| 626 } | 626 } |
| 627 def __init__(self, command=None, show_perf=False, perf_id=None, | 627 def __init__(self, command=None, show_perf=False, perf_id=None, |
| 628 perf_report_url_suffix=None, target=None, *args, **kwargs): | 628 perf_report_url_suffix=None, target=None, active_master=None, |
| 629 *args, **kwargs): |
| 629 buildstep.LogLineObserver.__init__(self, *args, **kwargs) | 630 buildstep.LogLineObserver.__init__(self, *args, **kwargs) |
| 630 self.command = command | 631 self.command = command |
| 631 self.sections = [] | 632 self.sections = [] |
| 632 self.annotate_status = builder.SUCCESS | 633 self.annotate_status = builder.SUCCESS |
| 633 self.halt_on_failure = False | 634 self.halt_on_failure = False |
| 634 self.honor_zero_return_code = False | 635 self.honor_zero_return_code = False |
| 635 self.cursor = None | 636 self.cursor = None |
| 636 | 637 |
| 637 self.show_perf = show_perf | 638 self.show_perf = show_perf |
| 638 self.perf_id = perf_id | 639 self.perf_id = perf_id |
| 639 self.perf_report_url_suffix = perf_report_url_suffix | 640 self.perf_report_url_suffix = perf_report_url_suffix |
| 640 self.target = target | 641 self.target = target |
| 642 self.active_master = active_master |
| 641 | 643 |
| 642 def initialSection(self): | 644 def initialSection(self): |
| 643 """Initializes the annotator's sections. | 645 """Initializes the annotator's sections. |
| 644 | 646 |
| 645 Annotator uses a list of dictionaries which hold information stuch as status | 647 Annotator uses a list of dictionaries which hold information stuch as status |
| 646 and logs for each added step. This method populates the section list with an | 648 and logs for each added step. This method populates the section list with an |
| 647 entry referencing the original buildbot step.""" | 649 entry referencing the original buildbot step.""" |
| 648 if self.sections: | 650 if self.sections: |
| 649 return | 651 return |
| 650 # Add a log section for output before the first section heading. | 652 # Add a log section for output before the first section heading. |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 'closed') | 1370 'closed') |
| 1369 | 1371 |
| 1370 step_deferreds = [s['step'].waitUntilFinished() | 1372 step_deferreds = [s['step'].waitUntilFinished() |
| 1371 for s in sections_to_wait] | 1373 for s in sections_to_wait] |
| 1372 return defer.DeferredList(step_deferreds) | 1374 return defer.DeferredList(step_deferreds) |
| 1373 | 1375 |
| 1374 | 1376 |
| 1375 class AnnotatedCommand(ProcessLogShellStep): | 1377 class AnnotatedCommand(ProcessLogShellStep): |
| 1376 """Buildbot command that knows how to display annotations.""" | 1378 """Buildbot command that knows how to display annotations.""" |
| 1377 | 1379 |
| 1378 def __init__(self, target=None, *args, **kwargs): | 1380 def __init__(self, target=None, active_master=None, *args, **kwargs): |
| 1381 self.active_master = active_master |
| 1379 clobber = '' | 1382 clobber = '' |
| 1380 perf_id = None | 1383 perf_id = None |
| 1381 perf_report_url_suffix = None | 1384 perf_report_url_suffix = None |
| 1382 show_perf = None | 1385 show_perf = None |
| 1383 if 'factory_properties' in kwargs: | 1386 if 'factory_properties' in kwargs: |
| 1384 if kwargs['factory_properties'].get('clobber'): | 1387 if kwargs['factory_properties'].get('clobber'): |
| 1385 clobber = '1' | 1388 clobber = '1' |
| 1386 perf_id = kwargs['factory_properties'].get('perf_id') | 1389 perf_id = kwargs['factory_properties'].get('perf_id') |
| 1387 perf_report_url_suffix = kwargs['factory_properties'].get( | 1390 perf_report_url_suffix = kwargs['factory_properties'].get( |
| 1388 'perf_report_url_suffix') | 1391 'perf_report_url_suffix') |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1408 } | 1411 } |
| 1409 # Apply the passed in environment on top. | 1412 # Apply the passed in environment on top. |
| 1410 old_env = kwargs.get('env') or {} | 1413 old_env = kwargs.get('env') or {} |
| 1411 env.update(old_env) | 1414 env.update(old_env) |
| 1412 # Change passed in args (ok as a copy is made internally). | 1415 # Change passed in args (ok as a copy is made internally). |
| 1413 kwargs['env'] = env | 1416 kwargs['env'] = env |
| 1414 | 1417 |
| 1415 ProcessLogShellStep.__init__(self, *args, **kwargs) | 1418 ProcessLogShellStep.__init__(self, *args, **kwargs) |
| 1416 self.script_observer = AnnotationObserver( | 1419 self.script_observer = AnnotationObserver( |
| 1417 self, show_perf=show_perf, perf_id=perf_id, | 1420 self, show_perf=show_perf, perf_id=perf_id, |
| 1418 perf_report_url_suffix=perf_report_url_suffix, target=target) | 1421 perf_report_url_suffix=perf_report_url_suffix, target=target, |
| 1422 active_master=active_master) |
| 1419 self.addLogObserver('stdio', self.script_observer) | 1423 self.addLogObserver('stdio', self.script_observer) |
| 1420 | 1424 |
| 1421 def describe(self, done=False): | 1425 def describe(self, done=False): |
| 1422 if self.step_status and self.step_status.isStarted(): | 1426 if self.step_status and self.step_status.isStarted(): |
| 1423 observer_text = self.script_observer.describe() | 1427 observer_text = self.script_observer.describe() |
| 1424 else: | 1428 else: |
| 1425 observer_text = [] | 1429 observer_text = [] |
| 1426 if observer_text: | 1430 if observer_text: |
| 1427 return observer_text | 1431 return observer_text |
| 1428 else: | 1432 else: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 and starts to wait for remaining steps to finish. Returns command_result | 1468 and starts to wait for remaining steps to finish. Returns command_result |
| 1465 as Deferred.""" | 1469 as Deferred.""" |
| 1466 self.scriptComplete(command_result) | 1470 self.scriptComplete(command_result) |
| 1467 steps_d = self.script_observer.waitForSteps() | 1471 steps_d = self.script_observer.waitForSteps() |
| 1468 # Ignore the waitForSteps' result and return the original result, | 1472 # Ignore the waitForSteps' result and return the original result, |
| 1469 # so the caller of runCommand receives command_result. | 1473 # so the caller of runCommand receives command_result. |
| 1470 steps_d.addCallback(lambda *_: command_result) | 1474 steps_d.addCallback(lambda *_: command_result) |
| 1471 return steps_d | 1475 return steps_d |
| 1472 d.addCallback(onCommandFinished) | 1476 d.addCallback(onCommandFinished) |
| 1473 return d | 1477 return d |
| OLD | NEW |