OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from buildbot.changes import svnpoller |
| 6 |
| 7 from common import chromium_utils |
| 8 |
| 9 from master import build_utils |
| 10 from master import gitiles_poller |
| 11 |
| 12 import config |
| 13 |
| 14 def ChromeTreeFileSplitter(path): |
| 15 """split_file for the 'src' project in the trunk.""" |
| 16 |
| 17 # Exclude .DEPS.git from triggering builds on chrome. |
| 18 if path == 'src/.DEPS.git': |
| 19 return None |
| 20 |
| 21 # List of projects we are interested in. The project names must exactly |
| 22 # match paths in the Subversion repository, relative to the 'path' URL |
| 23 # argument. build_utils.SplitPath() will use them as branch names to |
| 24 # kick off the Schedulers for different projects. |
| 25 projects = ['src'] |
| 26 return build_utils.SplitPath(projects, path) |
| 27 |
| 28 |
| 29 class _ChromiumSvnPoller(svnpoller.SVNPoller): |
| 30 def __init__(self, svnurl=None, svnbin=None, split_file=None, |
| 31 pollinterval=None, revlinktmpl=None, |
| 32 *args, **kwargs): |
| 33 if svnurl is None: |
| 34 svnurl = config.Master.trunk_url |
| 35 |
| 36 if svnbin is None: |
| 37 svnbin = chromium_utils.SVN_BIN |
| 38 |
| 39 if split_file is None: |
| 40 split_file = ChromeTreeFileSplitter |
| 41 |
| 42 if revlinktmpl is None: |
| 43 revlinktmpl = ( |
| 44 'http://src.chromium.org/viewvc/chrome?view=rev&revision=%s') |
| 45 |
| 46 if pollinterval is None: |
| 47 pollinterval = 10 |
| 48 |
| 49 svnpoller.SVNPoller.__init__( |
| 50 self, svnurl=svnurl, svnbin=svnbin, split_file=split_file, |
| 51 pollinterval=pollinterval, revlinktmpl=revlinktmpl, *args, **kwargs) |
| 52 |
| 53 |
| 54 def ChromiumChangeFilter(commit_json, branch): |
| 55 if 'tree_diff' not in commit_json: |
| 56 return True |
| 57 if (len(commit_json.get('tree_diff', [])) == 1 and |
| 58 commit_json['tree_diff'][0]['new_path'] == '.DEPS.git'): |
| 59 return False |
| 60 return True |
| 61 |
| 62 |
| 63 def ChromiumSvnPoller(svnurl=None, *args, **kwargs): |
| 64 cachepath = kwargs.pop('cachepath', None) |
| 65 change_filter = kwargs.pop('change_filter', ChromiumChangeFilter) |
| 66 pollInterval = kwargs.pop('pollinterval', 10) |
| 67 project = kwargs.pop('project', None) |
| 68 if svnurl is None: |
| 69 svnurl = config.Master.trunk_url |
| 70 if svnurl == config.Master.trunk_url and not args and not kwargs: |
| 71 poller_kwargs = { |
| 72 'repo_url': config.Master.git_server_url + '/chromium/src', |
| 73 'branches': ['master'], |
| 74 'revlinktmpl': |
| 75 'http://src.chromium.org/viewvc/chrome?view=rev&revision=%s', |
| 76 'pollInterval': pollInterval, |
| 77 'svn_mode': False, |
| 78 'change_filter': change_filter, |
| 79 } |
| 80 if project and project != 'src': |
| 81 poller_kwargs['svn_branch'] = 'src' |
| 82 return gitiles_poller.GitilesPoller(**poller_kwargs) |
| 83 kwargs.update([ |
| 84 ('cachepath', cachepath), |
| 85 ('pollinterval', pollInterval), |
| 86 ('project', project), |
| 87 ]) |
| 88 return _ChromiumSvnPoller(svnurl, *args, **kwargs) |
OLD | NEW |