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 | 4 |
| 5 """A subclass of commands.SVN that allows more flexible error recovery. | 5 """A subclass of commands.SVN that allows more flexible error recovery. |
| 6 | 6 |
| 7 This code is only used on the slave but it is living in common/ because it is | 7 This code is only used on the slave but it is living in common/ because it is |
| 8 directly imported from buildbot/slave/bot.py.""" | 8 directly imported from buildbot/slave/bot.py.""" |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 # pylint complains that __init__ in GClient's parent isn't called. This is | 136 # pylint complains that __init__ in GClient's parent isn't called. This is |
| 137 # because it doesn't realize we call it through GetParentClass(). Disable | 137 # because it doesn't realize we call it through GetParentClass(). Disable |
| 138 # that warning next. | 138 # that warning next. |
| 139 # pylint: disable=W0231 | 139 # pylint: disable=W0231 |
| 140 | 140 |
| 141 header = 'gclient' | 141 header = 'gclient' |
| 142 | 142 |
| 143 def __init__(self, *args, **kwargs): | 143 def __init__(self, *args, **kwargs): |
| 144 # TODO(maruel): Mainly to keep pylint happy, remove once buildbot fixed | 144 # TODO(maruel): Mainly to keep pylint happy, remove once buildbot fixed |
| 145 # their style. | 145 # their style. |
| 146 self.branch = None | |
| 147 self.srcdir = None | 146 self.srcdir = None |
| 148 self.revision = None | 147 self.revision = None |
| 149 self.env = None | 148 self.env = None |
| 150 self.sourcedatafile = None | 149 self.sourcedatafile = None |
| 151 self.patch = None | 150 self.patch = None |
| 152 self.command = None | 151 self.command = None |
| 153 self.vcexe = None | 152 self.vcexe = None |
| 154 self.svnurl = None | 153 self.svnurl = None |
| 155 self.sudo_for_remove = None | 154 self.sudo_for_remove = None |
| 156 self.gclient_spec = None | 155 self.gclient_spec = None |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 command = [chromium_utils.GetGClientCommand(), | 269 command = [chromium_utils.GetGClientCommand(), |
| 271 'sync', '--verbose', '--reset', '--manually_grab_svn_rev', | 270 'sync', '--verbose', '--reset', '--manually_grab_svn_rev', |
| 272 '--delete_unversioned_trees'] | 271 '--delete_unversioned_trees'] |
| 273 # Don't run hooks if it was patched or there is a patch since runhooks will | 272 # Don't run hooks if it was patched or there is a patch since runhooks will |
| 274 # be run after. | 273 # be run after. |
| 275 if self.gclient_nohooks or self.patch or self.was_patched: | 274 if self.gclient_nohooks or self.patch or self.was_patched: |
| 276 command.append('--nohooks') | 275 command.append('--nohooks') |
| 277 # GClient accepts --revision argument of two types 'module@rev' and 'rev'. | 276 # GClient accepts --revision argument of two types 'module@rev' and 'rev'. |
| 278 if self.revision: | 277 if self.revision: |
| 279 command.append('--revision') | 278 command.append('--revision') |
| 280 if (not self.branch or | 279 command.append(str(self.revision)) |
|
nsylvain
2012/01/25 20:19:54
do you really want to touch this? or is this a reb
Dirk Pranke
2012/01/25 22:39:07
Change contamination :( Reverted.
| |
| 281 self.no_gclient_branch or | |
| 282 '@' in str(self.revision)): | |
| 283 command.append(str(self.revision)) | |
| 284 else: | |
| 285 # Make the revision look like branch@revision. | |
| 286 command.append('%s@%s' % (self.branch, self.revision)) | |
| 287 # We only add the transitive flag if we have a revision, otherwise it is | 280 # We only add the transitive flag if we have a revision, otherwise it is |
| 288 # meaningless. | 281 # meaningless. |
| 289 if self.gclient_transitive: | 282 if self.gclient_transitive: |
| 290 command.append('--transitive') | 283 command.append('--transitive') |
| 291 | 284 |
| 292 if self.gclient_deps: | 285 if self.gclient_deps: |
| 293 command.append('--deps=' + self.gclient_deps) | 286 command.append('--deps=' + self.gclient_deps) |
| 294 | 287 |
| 295 c = runprocesscmd(self.builder, command, dirname, | 288 c = runprocesscmd(self.builder, command, dirname, |
| 296 sendRC=False, timeout=self.timeout, | 289 sendRC=False, timeout=self.timeout, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 initialStdin=diff, environ=self.env) | 430 initialStdin=diff, environ=self.env) |
| 438 self.command = c | 431 self.command = c |
| 439 d = c.start() | 432 d = c.start() |
| 440 d.addCallback(self._abandonOnFailure) | 433 d.addCallback(self._abandonOnFailure) |
| 441 if diff.find('DEPS') != -1: | 434 if diff.find('DEPS') != -1: |
| 442 d.addCallback(self.doVCUpdateOnPatch) | 435 d.addCallback(self.doVCUpdateOnPatch) |
| 443 d.addCallback(self._abandonOnFailure) | 436 d.addCallback(self._abandonOnFailure) |
| 444 return d | 437 return d |
| 445 | 438 |
| 446 def doVCUpdateOnPatch(self, res): | 439 def doVCUpdateOnPatch(self, res): |
| 447 if self.revision and not self.branch and '@' not in str(self.revision): | 440 if self.revision: |
| 448 self.branch = 'src' | 441 self.branch = 'src' |
| 449 return self.doVCUpdate() | 442 return self.doVCUpdate() |
| 450 | 443 |
| 451 def doRunHooks(self, dummy): | 444 def doRunHooks(self, dummy): |
| 452 """Runs "gclient runhooks" after patching.""" | 445 """Runs "gclient runhooks" after patching.""" |
| 453 dirname = os.path.join(self.builder.basedir, self.srcdir) | 446 dirname = os.path.join(self.builder.basedir, self.srcdir) |
| 454 command = [chromium_utils.GetGClientCommand(), 'runhooks'] | 447 command = [chromium_utils.GetGClientCommand(), 'runhooks'] |
| 455 c = runprocesscmd(self.builder, command, dirname, | 448 c = runprocesscmd(self.builder, command, dirname, |
| 456 sendRC=False, timeout=self.timeout, | 449 sendRC=False, timeout=self.timeout, |
| 457 keepStdout=True, environ=self.env) | 450 keepStdout=True, environ=self.env) |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 # This version should work on BB 7.12 | 595 # This version should work on BB 7.12 |
| 603 | 596 |
| 604 # We run this code in a try because it fails with an assertion if | 597 # We run this code in a try because it fails with an assertion if |
| 605 # the module is loaded twice. | 598 # the module is loaded twice. |
| 606 registerSlaveCommand('gclient', GClient, commands.command_version) | 599 registerSlaveCommand('gclient', GClient, commands.command_version) |
| 607 except (AssertionError, NameError): | 600 except (AssertionError, NameError): |
| 608 pass | 601 pass |
| 609 | 602 |
| 610 | 603 |
| 611 RegisterGclient() | 604 RegisterGclient() |
| OLD | NEW |