| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 self.gclient_nohooks = False | 238 self.gclient_nohooks = False |
| 239 self.was_patched = False | 239 self.was_patched = False |
| 240 self.no_gclient_branch = False | 240 self.no_gclient_branch = False |
| 241 self.no_gclient_revision = False | 241 self.no_gclient_revision = False |
| 242 self.gclient_transitive = False | 242 self.gclient_transitive = False |
| 243 self.delete_unversioned_trees_when_updating = True | 243 self.delete_unversioned_trees_when_updating = True |
| 244 self.gclient_jobs = None | 244 self.gclient_jobs = None |
| 245 self.project = None | 245 self.project = None |
| 246 # TODO(maruel): Remove once buildbot 0.8.4p1 conversion is complete. | 246 # TODO(maruel): Remove once buildbot 0.8.4p1 conversion is complete. |
| 247 self.sourcedata = None | 247 self.sourcedata = None |
| 248 self.do_nothing = None |
| 248 chromium_utils.GetParentClass(GClient).__init__(self, *args, **kwargs) | 249 chromium_utils.GetParentClass(GClient).__init__(self, *args, **kwargs) |
| 249 | 250 |
| 250 def setup(self, args): | 251 def setup(self, args): |
| 251 """Our implementation of command.Commands.setup() method. | 252 """Our implementation of command.Commands.setup() method. |
| 252 The method will get all the arguments that are passed to remote command | 253 The method will get all the arguments that are passed to remote command |
| 253 and is invoked before start() method (that will in turn call doVCUpdate()). | 254 and is invoked before start() method (that will in turn call doVCUpdate()). |
| 254 """ | 255 """ |
| 255 SourceBaseCommand.setup(self, args) | 256 SourceBaseCommand.setup(self, args) |
| 256 self.vcexe = self.getCommand('gclient') | 257 self.vcexe = self.getCommand('gclient') |
| 257 self.svnurl = args['svnurl'] | 258 self.svnurl = args['svnurl'] |
| (...skipping 24 matching lines...) Expand all Loading... |
| 282 self.command = None | 283 self.command = None |
| 283 | 284 |
| 284 # self.srcdir is where the VC system should put the sources | 285 # self.srcdir is where the VC system should put the sources |
| 285 if self.mode == "copy": | 286 if self.mode == "copy": |
| 286 self.srcdir = "source" # hardwired directory name, sorry | 287 self.srcdir = "source" # hardwired directory name, sorry |
| 287 else: | 288 else: |
| 288 self.srcdir = self.workdir | 289 self.srcdir = self.workdir |
| 289 self.sourcedatafile = os.path.join(self.builder.basedir, | 290 self.sourcedatafile = os.path.join(self.builder.basedir, |
| 290 self.srcdir, | 291 self.srcdir, |
| 291 ".buildbot-sourcedata") | 292 ".buildbot-sourcedata") |
| 293 self.do_nothing = os.path.isfile(os.path.join(self.builder.basedir, |
| 294 self.srcdir, |
| 295 'update.flag')) |
| 292 | 296 |
| 293 d = defer.succeed(None) | 297 d = defer.succeed(0) |
| 298 |
| 299 if self.do_nothing: |
| 300 # If bot update is run, we don't need to run the traditional update step. |
| 301 msg = 'update.flag file found: bot_update has run and checkout is \n' |
| 302 msg += 'already in a consistent state.\n' |
| 303 msg += 'No actions will be performed in this step.' |
| 304 self.sendStatus({'header': msg}) |
| 305 d.addCallback(self._sendRC) |
| 306 return d |
| 307 |
| 294 # Do we need to clobber anything? | 308 # Do we need to clobber anything? |
| 295 if self.mode in ("copy", "clobber", "export"): | 309 if self.mode in ("copy", "clobber", "export"): |
| 296 d.addCallback(self.doClobber, self.workdir) | 310 d.addCallback(self.doClobber, self.workdir) |
| 297 if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()): | 311 if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()): |
| 298 # the directory cannot be updated, so we have to clobber it. | 312 # the directory cannot be updated, so we have to clobber it. |
| 299 # Perhaps the master just changed modes from 'export' to | 313 # Perhaps the master just changed modes from 'export' to |
| 300 # 'update'. | 314 # 'update'. |
| 301 d.addCallback(self.doClobber, self.srcdir) | 315 d.addCallback(self.doClobber, self.srcdir) |
| 302 elif self.sourcedirIsPatched(): | 316 elif self.sourcedirIsPatched(): |
| 303 # The directory is patched. Revert the sources. | 317 # The directory is patched. Revert the sources. |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 try: | 640 try: |
| 627 # We run this code in a try because it fails with an assertion if | 641 # We run this code in a try because it fails with an assertion if |
| 628 # the module is loaded twice. | 642 # the module is loaded twice. |
| 629 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' | 643 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' |
| 630 return | 644 return |
| 631 except (AssertionError, NameError): | 645 except (AssertionError, NameError): |
| 632 pass | 646 pass |
| 633 | 647 |
| 634 | 648 |
| 635 RegisterCommands() | 649 RegisterCommands() |
| OLD | NEW |