| 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 """ Skia-specific subclass of BuildStep """ | 5 """ Skia-specific subclass of BuildStep """ |
| 6 | 6 |
| 7 | 7 |
| 8 from buildbot.status.logfile import STDOUT | 8 from buildbot.status.logfile import STDOUT |
| 9 from master.log_parser import retcode_command | 9 from master.log_parser import retcode_command |
| 10 import re | 10 import re |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 prop: string, the property to test | 84 prop: string, the property to test |
| 85 """ | 85 """ |
| 86 try: | 86 try: |
| 87 step.getProperty(prop) | 87 step.getProperty(prop) |
| 88 return True | 88 return True |
| 89 # pylint: disable=W0702 | 89 # pylint: disable=W0702 |
| 90 except: | 90 except: |
| 91 return False | 91 return False |
| 92 | 92 |
| 93 | 93 |
| 94 def _CheckRebaselineChanges(changes, gm_image_subdir): | |
| 95 """ Determine whether a set of changes consists of only files in 'gm-expected' | |
| 96 and whether any of those files are in the given gm_image_subdir. Returns a | |
| 97 tuple consisting of two booleans: whether or not the commit consists of only | |
| 98 new baseline images, and whether or not baselines changed for the given | |
| 99 platform. | |
| 100 | |
| 101 changes: a list of the changelists which are part of this build. | |
| 102 gm_image_subdir: the subdirectory inside gm-expected which corresponds to this | |
| 103 build slave's platform. | |
| 104 """ | |
| 105 commit_is_only_baselines = True | |
| 106 platform_changed = False | |
| 107 for change in changes: | |
| 108 for changed_file in change.asDict()['files']: | |
| 109 for subdir in utils.SKIA_PRIMARY_SUBDIRS: | |
| 110 if subdir != 'gm-expected' and subdir in changed_file['name']: | |
| 111 commit_is_only_baselines = False | |
| 112 if gm_image_subdir in changed_file: | |
| 113 platform_changed = True | |
| 114 return commit_is_only_baselines, platform_changed | |
| 115 | |
| 116 | |
| 117 def ShouldDoStep(step): | 94 def ShouldDoStep(step): |
| 118 """ At build time, use build properties to determine whether or not a step | 95 """ At build time, use build properties to determine whether or not a step |
| 119 should be run or skipped. | 96 should be run or skipped. |
| 120 | 97 |
| 121 step: an instance of BuildStep which we may or may not run. | 98 step: an instance of BuildStep which we may or may not run. |
| 122 """ | 99 """ |
| 123 print step.build.getProperties() | 100 print step.build.getProperties() |
| 124 if not isinstance(step, SkiaBuildStep): | 101 if not isinstance(step, SkiaBuildStep): |
| 125 return True | 102 return True |
| 126 | 103 |
| 127 # If this step uploads results (and thus overwrites the most recently uploaded | 104 # If this step uploads results (and thus overwrites the most recently uploaded |
| 128 # results), only run it on scheduled builds (i.e. most recent revision) or if | 105 # results), only run it on scheduled builds (i.e. most recent revision) or if |
| 129 # the "force_upload" property was set. | 106 # the "force_upload" property was set. |
| 130 if step.IsUploadStep() and \ | 107 if step.IsUploadStep() and \ |
| 131 not _HasProperty(step, 'scheduler') and \ | 108 not _HasProperty(step, 'scheduler') and \ |
| 132 not _HasProperty(step, 'force_upload'): | 109 not _HasProperty(step, 'force_upload'): |
| 133 return False | 110 return False |
| 134 | 111 |
| 135 # Unless we have determined otherwise, run the step. | 112 # Unless we have determined otherwise, run the step. |
| 136 return True | 113 return True |
| OLD | NEW |