Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 """Define the supported projects.""" | 4 """Define the supported projects.""" |
| 5 | 5 |
| 6 import datetime | |
| 6 import os | 7 import os |
| 7 import re | 8 import re |
| 8 import sys | 9 import sys |
| 9 | 10 |
| 10 import find_depot_tools # pylint: disable=W0611 | 11 import find_depot_tools # pylint: disable=W0611 |
| 11 import checkout | 12 import checkout |
| 12 | 13 |
| 13 import committer_list | 14 import committer_list |
| 14 import creds | 15 import creds |
| 15 import errors | 16 import errors |
| 16 import pending_manager | 17 import pending_manager |
| 18 from post_process import mangle | |
| 17 from verification import presubmit_check | 19 from verification import presubmit_check |
| 18 from verification import project_base | 20 from verification import project_base |
| 19 from verification import reviewer_lgtm | 21 from verification import reviewer_lgtm |
| 20 from verification import tree_status | 22 from verification import tree_status |
| 21 from verification import try_server | 23 from verification import try_server |
| 22 | 24 |
| 23 | 25 |
| 24 # It's tricky here because 'chrome' is remapped to 'svn' on src.chromium.org but | 26 # It's tricky here because 'chrome' is remapped to 'svn' on src.chromium.org but |
| 25 # the other repositories keep their repository name. So don't list it here. | 27 # the other repositories keep their repository name. So don't list it here. |
| 26 SVN_HOST_ALIASES = [ | 28 SVN_HOST_ALIASES = [ |
| 27 'svn://svn.chromium.org', | 29 'svn://svn.chromium.org', |
| 28 'svn://chrome-svn', | 30 'svn://chrome-svn', |
| 29 'svn://chrome-svn.corp', | 31 'svn://chrome-svn.corp', |
| 30 'svn://chrome-svn.corp.google.com' | 32 'svn://chrome-svn.corp.google.com' |
| 31 ] | 33 ] |
| 32 | 34 |
| 33 CHROME_SVN_BASES = [item + '/chrome' for item in SVN_HOST_ALIASES] + [ | 35 CHROME_SVN_BASES = [item + '/chrome' for item in SVN_HOST_ALIASES] + [ |
| 34 'http://src.chromium.org/svn', | 36 'http://src.chromium.org/svn', |
| 35 ] | 37 ] |
| 36 | 38 |
| 37 | 39 |
| 38 # Anyone with a @chromium.org account. | 40 # Anyone with a @chromium.org account. |
| 39 CHROMITES = r'^[\w\-\+\%\.]+\@chromium\.org$' | 41 CHROMITES = r'^[\w\-\+\%\.]+\@chromium\.org$' |
| 40 # Anyone with a @chromium.org or @google.com account. | 42 # Anyone with a @chromium.org or @google.com account. |
| 41 GOOGLERS_OR_CHROMITES = r'^[\w\-\+\%\.]+\@(google\.com|chromium\.org)$' | 43 GOOGLERS_OR_CHROMITES = r'^[\w\-\+\%\.]+\@(google\.com|chromium\.org)$' |
| 42 | 44 |
| 43 | 45 |
| 46 # Will mangle the copyright line. | |
| 47 COPYRIGHT_MANGLER = mangle.CopyrightMangle( | |
| 48 r'^(.*)Copyright \(c\) \d\d\d\d The Chromium Authors. ' | |
| 49 r'All rights reserved.$', | |
| 50 r'\1Copyright (c) %s The Chromium Authors. All rights reserved.' % | |
| 51 datetime.date.today().year) | |
|
Dirk Pranke
2011/04/21 20:26:13
I think it's a little weird to (a) use a CONSTANT
| |
| 52 | |
| 53 | |
| 44 def _get_escaped_committers(root_dir): | 54 def _get_escaped_committers(root_dir): |
| 45 filepath = os.path.join(root_dir, '.committers_pwd') | 55 filepath = os.path.join(root_dir, '.committers_pwd') |
| 46 try: | 56 try: |
| 47 password = open(filepath).readlines()[0].strip() | 57 password = open(filepath).readlines()[0].strip() |
| 48 except IOError: | 58 except IOError: |
| 49 raise errors.ConfigurationError( | 59 raise errors.ConfigurationError( |
| 50 'Put the committers list password in %s' % filepath) | 60 'Put the committers list password in %s' % filepath) |
| 51 return [re.escape(i) for i in committer_list.get_committers(password)] | 61 return [re.escape(i) for i in committer_list.get_committers(password)] |
| 52 | 62 |
| 53 | 63 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 ) | 109 ) |
| 100 verifiers.append(try_server.TryRunner( | 110 verifiers.append(try_server.TryRunner( |
| 101 'http://build.chromium.org/p/tryserver.chromium/', | 111 'http://build.chromium.org/p/tryserver.chromium/', |
| 102 user, | 112 user, |
| 103 builders, | 113 builders, |
| 104 tests, | 114 tests, |
| 105 ['--root', 'src'])) | 115 ['--root', 'src'])) |
| 106 | 116 |
| 107 verifiers.append(tree_status.TreeStatusVerifier( | 117 verifiers.append(tree_status.TreeStatusVerifier( |
| 108 'http://chromium-status.appspot.com/status')) | 118 'http://chromium-status.appspot.com/status')) |
| 119 | |
| 120 post_processors = [COPYRIGHT_MANGLER.process] | |
| 109 return pending_manager.PendingManager( | 121 return pending_manager.PendingManager( |
| 110 rietveld_obj, | 122 rietveld_obj, |
| 111 local_checkout, | 123 local_checkout, |
| 112 verifiers_no_patch, | 124 verifiers_no_patch, |
| 113 verifiers) | 125 verifiers, |
| 126 post_processors) | |
| 114 | 127 |
| 115 | 128 |
| 116 def _gen_nacl(user, root_dir, rietveld_obj, git_svn, no_try): | 129 def _gen_nacl(user, root_dir, rietveld_obj, git_svn, no_try): |
| 117 """Generates a PendingManager commit queue for Native Client.""" | 130 """Generates a PendingManager commit queue for Native Client.""" |
| 118 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd')) | 131 svn_creds = creds.Credentials(os.path.join(root_dir, '.svn_pwd')) |
| 119 offset = 'trunk/src/native_client' | 132 offset = 'trunk/src/native_client' |
| 120 if git_svn: | 133 if git_svn: |
| 121 local_checkout = checkout.GitSvnCheckout( | 134 local_checkout = checkout.GitSvnCheckout( |
| 122 root_dir, | 135 root_dir, |
| 123 'nacl', | 136 'nacl', |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 builders, | 190 builders, |
| 178 [], | 191 [], |
| 179 ['--root', 'native_client'])) | 192 ['--root', 'native_client'])) |
| 180 | 193 |
| 181 verifiers.append(tree_status.TreeStatusVerifier( | 194 verifiers.append(tree_status.TreeStatusVerifier( |
| 182 'http://nativeclient-status.appspot.com/status')) | 195 'http://nativeclient-status.appspot.com/status')) |
| 183 return pending_manager.PendingManager( | 196 return pending_manager.PendingManager( |
| 184 rietveld_obj, | 197 rietveld_obj, |
| 185 local_checkout, | 198 local_checkout, |
| 186 verifiers_no_patch, | 199 verifiers_no_patch, |
| 187 verifiers) | 200 verifiers, |
| 201 []) | |
| 188 | 202 |
| 189 | 203 |
| 190 def _gen_build(user, root_dir, rietveld_obj, git_svn, no_try): | 204 def _gen_build(user, root_dir, rietveld_obj, git_svn, no_try): |
| 191 """Generates a PendingManager commit queue for chrome/trunk/tools/build.""" | 205 """Generates a PendingManager commit queue for chrome/trunk/tools/build.""" |
| 192 return _internal_simple( | 206 return _internal_simple( |
| 193 'build', user, root_dir, rietveld_obj, git_svn, no_try) | 207 'build', user, root_dir, rietveld_obj, git_svn, no_try) |
| 194 | 208 |
| 195 | 209 |
| 196 def _gen_depot_tools(user, root_dir, rietveld_obj, git_svn, no_try): | 210 def _gen_depot_tools(user, root_dir, rietveld_obj, git_svn, no_try): |
| 197 """Generates a PendingManager commit queue for chrome/trunk/tools/depot_tools. | 211 """Generates a PendingManager commit queue for chrome/trunk/tools/depot_tools. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 verifiers_no_patch = [ | 256 verifiers_no_patch = [ |
| 243 project_base.ProjectBaseUrlVerifier(project_bases), | 257 project_base.ProjectBaseUrlVerifier(project_bases), |
| 244 reviewer_lgtm.ReviewerLgtmVerifier( | 258 reviewer_lgtm.ReviewerLgtmVerifier( |
| 245 _get_escaped_committers(root_dir), | 259 _get_escaped_committers(root_dir), |
| 246 [re.escape(user)]), | 260 [re.escape(user)]), |
| 247 ] | 261 ] |
| 248 verifiers = [ | 262 verifiers = [ |
| 249 presubmit_check.PresubmitCheckVerifier(), | 263 presubmit_check.PresubmitCheckVerifier(), |
| 250 ] | 264 ] |
| 251 | 265 |
| 266 post_processors = [COPYRIGHT_MANGLER.process] | |
| 252 return pending_manager.PendingManager( | 267 return pending_manager.PendingManager( |
| 253 rietveld_obj, | 268 rietveld_obj, |
| 254 local_checkout, | 269 local_checkout, |
| 255 verifiers_no_patch, | 270 verifiers_no_patch, |
| 256 verifiers) | 271 verifiers, |
| 272 post_processors) | |
| 257 | 273 |
| 258 | 274 |
| 259 def supported_projects(): | 275 def supported_projects(): |
| 260 """List the projects that can be managed by the commit queue.""" | 276 """List the projects that can be managed by the commit queue.""" |
| 261 return sorted( | 277 return sorted( |
| 262 x[5:] for x in dir(sys.modules[__name__]) if x.startswith('_gen_')) | 278 x[5:] for x in dir(sys.modules[__name__]) if x.startswith('_gen_')) |
| 263 | 279 |
| 264 | 280 |
| 265 def load_project(project, user, root_dir, rietveld_obj, git_svn, no_try): | 281 def load_project(project, user, root_dir, rietveld_obj, git_svn, no_try): |
| 266 """Loads the specified project.""" | 282 """Loads the specified project.""" |
| 267 return getattr(sys.modules[__name__], '_gen_' + project)( | 283 return getattr(sys.modules[__name__], '_gen_' + project)( |
| 268 user, root_dir, rietveld_obj, git_svn, no_try) | 284 user, root_dir, rietveld_obj, git_svn, no_try) |
| OLD | NEW |