| 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 | 5 |
| 6 """Skia-specific utilities for setting up build masters.""" | 6 """Skia-specific utilities for setting up build masters.""" |
| 7 | 7 |
| 8 | 8 |
| 9 from buildbot.changes import filter as change_filter | 9 from buildbot.changes import filter as change_filter |
| 10 from buildbot.scheduler import AnyBranchScheduler | 10 from buildbot.scheduler import AnyBranchScheduler |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SCHEDULERS = [ | 46 SCHEDULERS = [ |
| 47 PERCOMMIT_SCHEDULER_NAME, | 47 PERCOMMIT_SCHEDULER_NAME, |
| 48 MASTER_ONLY_SCHEDULER_NAME, | 48 MASTER_ONLY_SCHEDULER_NAME, |
| 49 TRY_SCHEDULER_NAME, | 49 TRY_SCHEDULER_NAME, |
| 50 PERIODIC_15MINS_SCHEDULER_NAME, | 50 PERIODIC_15MINS_SCHEDULER_NAME, |
| 51 NIGHTLY_SCHEDULER_NAME, | 51 NIGHTLY_SCHEDULER_NAME, |
| 52 WEEKLY_SCHEDULER_NAME, | 52 WEEKLY_SCHEDULER_NAME, |
| 53 INFRA_PERCOMMIT_SCHEDULER_NAME, | 53 INFRA_PERCOMMIT_SCHEDULER_NAME, |
| 54 ] | 54 ] |
| 55 | 55 |
| 56 KEYWORD_NO_MERGE_BUILDS = 'NO_MERGE_BUILDS' |
| 57 |
| 56 | 58 |
| 57 def CanMergeBuildRequests(req1, req2): | 59 def CanMergeBuildRequests(req1, req2): |
| 58 """Determine whether or not two BuildRequests can be merged. | 60 """Determine whether or not two BuildRequests can be merged. |
| 59 | 61 |
| 60 Rewrite of buildbot.sourcestamp.SourceStamp.canBeMergedWith(), which | 62 Rewrite of buildbot.sourcestamp.SourceStamp.canBeMergedWith(), which |
| 61 verifies that: | 63 verifies that: |
| 62 1. req1.source.repository == req2.source.repository | 64 1. req1.source.repository == req2.source.repository |
| 63 2. req1.source.project == req2.source.project | 65 2. req1.source.project == req2.source.project |
| 64 3. req1.source.branch == req2.source.branch | 66 3. req1.source.branch == req2.source.branch |
| 65 4. req1.patch == None and req2.patch = None | 67 4. req1.patch == None and req2.patch = None |
| (...skipping 20 matching lines...) Expand all Loading... |
| 86 if (builder_name_schema.IsTrybot(req1.buildername) or | 88 if (builder_name_schema.IsTrybot(req1.buildername) or |
| 87 builder_name_schema.IsTrybot(req2.buildername)): | 89 builder_name_schema.IsTrybot(req2.buildername)): |
| 88 return False | 90 return False |
| 89 | 91 |
| 90 # Verify that either: both requests are associated with changes OR neither | 92 # Verify that either: both requests are associated with changes OR neither |
| 91 # request is associated with a change but the revisions match (#5 above). | 93 # request is associated with a change but the revisions match (#5 above). |
| 92 if req1.source.changes and not req2.source.changes: | 94 if req1.source.changes and not req2.source.changes: |
| 93 return False | 95 return False |
| 94 if not req1.source.changes and req2.source.changes: | 96 if not req1.source.changes and req2.source.changes: |
| 95 return False | 97 return False |
| 96 if not (req1.source.changes and req2.source.changes): | 98 if req1.source.changes and req2.source.changes: |
| 99 for ch in (req1.source.changes + req2.source.changes): |
| 100 if KEYWORD_NO_MERGE_BUILDS in ch.comments: |
| 101 return False |
| 102 else: |
| 97 if req1.source.revision != req2.source.revision: | 103 if req1.source.revision != req2.source.revision: |
| 98 return False | 104 return False |
| 99 | 105 |
| 100 return True | 106 return True |
| 101 | 107 |
| 102 | 108 |
| 103 def SetupBuildersAndSchedulers(c, builders, slaves, ActiveMaster): | 109 def SetupBuildersAndSchedulers(c, builders, slaves, ActiveMaster): |
| 104 """Set up builders and schedulers for the build master.""" | 110 """Set up builders and schedulers for the build master.""" |
| 105 # List of dicts for every builder. | 111 # List of dicts for every builder. |
| 106 builder_dicts = [] | 112 builder_dicts = [] |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 relayhost=config.Master.smtp, | 358 relayhost=config.Master.smtp, |
| 353 lookup=master_utils.UsersAreEmails())) | 359 lookup=master_utils.UsersAreEmails())) |
| 354 | 360 |
| 355 # Rietveld status push. | 361 # Rietveld status push. |
| 356 if ActiveMaster.code_review_site: | 362 if ActiveMaster.code_review_site: |
| 357 c['status'].append( | 363 c['status'].append( |
| 358 TryServerHttpStatusPush(serverUrl=ActiveMaster.code_review_site)) | 364 TryServerHttpStatusPush(serverUrl=ActiveMaster.code_review_site)) |
| 359 | 365 |
| 360 c['mergeRequests'] = CanMergeBuildRequests | 366 c['mergeRequests'] = CanMergeBuildRequests |
| 361 return c | 367 return c |
| OLD | NEW |