| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import ast | 5 import ast |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from buildbot.changes.filter import ChangeFilter | 8 from buildbot.changes.filter import ChangeFilter |
| 9 from buildbot.schedulers.basic import SingleBranchScheduler | 9 from buildbot.schedulers.basic import SingleBranchScheduler |
| 10 from buildbot.schedulers.timed import Nightly | 10 from buildbot.schedulers.timed import Nightly |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 # useful for most projects. We should fix that. | 83 # useful for most projects. We should fix that. |
| 84 c['buildHorizon'] = 3000 | 84 c['buildHorizon'] = 3000 |
| 85 c['logHorizon'] = 3000 | 85 c['logHorizon'] = 3000 |
| 86 # Must be at least 2x the number of slaves. | 86 # Must be at least 2x the number of slaves. |
| 87 c['eventHorizon'] = 200 | 87 c['eventHorizon'] = 200 |
| 88 | 88 |
| 89 | 89 |
| 90 def _ComputeBuilders(builders, m_annotator, active_master_cls): | 90 def _ComputeBuilders(builders, m_annotator, active_master_cls): |
| 91 actual_builders = [] | 91 actual_builders = [] |
| 92 | 92 |
| 93 default_properties = builders.get('default_properties') | |
| 94 | |
| 95 def cmp_fn(a, b): | 93 def cmp_fn(a, b): |
| 96 a_cat = builders['builders'][a].get('category') | 94 a_cat = builders['builders'][a].get('category') |
| 97 b_cat = builders['builders'][b].get('category') | 95 b_cat = builders['builders'][b].get('category') |
| 98 if a_cat != b_cat: | 96 if a_cat != b_cat: |
| 99 return 1 if a_cat > b_cat else -1 | 97 return 1 if a_cat > b_cat else -1 |
| 100 if a != b: | 98 if a != b: |
| 101 return 1 if a > b else -1 | 99 return 1 if a > b else -1 |
| 102 return 0 | 100 return 0 |
| 103 | 101 |
| 104 for builder_name in sorted(builders['builders'], cmp=cmp_fn): | 102 for builder_name in sorted(builders['builders'], cmp=cmp_fn): |
| 105 builder_data = builders['builders'][builder_name] | 103 builder_data = builders['builders'][builder_name] |
| 106 has_schedulers = bool( | 104 has_schedulers = bool( |
| 107 builder_data.get('scheduler', builder_data.get('schedulers'))) | 105 builder_data.get('scheduler', builder_data.get('schedulers'))) |
| 108 | 106 |
| 109 # We will automatically merge all build requests for any | 107 # We will automatically merge all build requests for any |
| 110 # builder that can be scheduled; this is normally the behavior | 108 # builder that can be scheduled; this is normally the behavior |
| 111 # we want for repo-triggered builders and cron-triggered builders. | 109 # we want for repo-triggered builders and cron-triggered builders. |
| 112 # You can override this behavior by setting the mergeRequests field though. | 110 # You can override this behavior by setting the mergeRequests field though. |
| 113 merge_requests = builder_data.get('mergeRequests', has_schedulers) | 111 merge_requests = builder_data.get('mergeRequests', has_schedulers) |
| 114 | 112 |
| 115 slavebuilddir = builder_data.get('slavebuilddir', | 113 slavebuilddir = builder_data.get('slavebuilddir', |
| 116 util.safeTranslate(builder_name)) | 114 util.safeTranslate(builder_name)) |
| 117 | 115 |
| 118 if default_properties: | 116 props = {} |
| 119 props = default_properties.copy() | 117 props.update(builders.get('default_properties', {}).copy()) |
| 120 props.update(builder_data.get('properties', {})) | 118 if builder_data.get('use_remote_run'): |
| 121 else: | 119 props.update(builders.get('default_remote_run_properties', {}).copy()) |
| 122 props = builder_data.get('properties') | 120 props.update(builder_data.get('properties', {})) |
| 123 | 121 |
| 124 if builder_data.get('use_remote_run'): | 122 if builder_data.get('use_remote_run'): |
| 125 factory = remote_run_factory.RemoteRunFactory( | 123 factory = remote_run_factory.RemoteRunFactory( |
| 126 active_master=active_master_cls, | 124 active_master=active_master_cls, |
| 127 repository=builder_data.get( | 125 repository=builder_data.get( |
| 128 'repository', builders.get('default_remote_run_repository')), | 126 'repository', builders.get('default_remote_run_repository')), |
| 129 recipe=builder_data['recipe'], | 127 recipe=builder_data['recipe'], |
| 130 max_time=builder_data.get('builder_timeout_s'), | 128 max_time=builder_data.get('builder_timeout_s'), |
| 131 factory_properties=props, | 129 factory_properties=props, |
| 132 ) | 130 ) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 pollInterval=300, | 237 pollInterval=300, |
| 240 revlinktmpl=rev_link_template)) | 238 revlinktmpl=rev_link_template)) |
| 241 | 239 |
| 242 # We have to set the tag_comparator to something, but if we have multiple | 240 # We have to set the tag_comparator to something, but if we have multiple |
| 243 # repos, the tag_comparator will not work properly (it's meaningless). | 241 # repos, the tag_comparator will not work properly (it's meaningless). |
| 244 # It's not clear if there's a good answer to this. | 242 # It's not clear if there's a good answer to this. |
| 245 if change_source: | 243 if change_source: |
| 246 tag_comparator = change_source[0].comparator | 244 tag_comparator = change_source[0].comparator |
| 247 | 245 |
| 248 return change_source, tag_comparator | 246 return change_source, tag_comparator |
| OLD | NEW |