| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 self.gclient_deps = args.get('gclient_deps') | 262 self.gclient_deps = args.get('gclient_deps') |
| 263 self.sourcedata = '%s\n' % self.svnurl | 263 self.sourcedata = '%s\n' % self.svnurl |
| 264 self.rm_timeout = args.get('rm_timeout', self.timeout) | 264 self.rm_timeout = args.get('rm_timeout', self.timeout) |
| 265 self.env = args.get('env') | 265 self.env = args.get('env') |
| 266 self.gclient_nohooks = args.get('gclient_nohooks', False) | 266 self.gclient_nohooks = args.get('gclient_nohooks', False) |
| 267 self.env['CHROMIUM_GYP_SYNTAX_CHECK'] = '1' | 267 self.env['CHROMIUM_GYP_SYNTAX_CHECK'] = '1' |
| 268 self.no_gclient_branch = args.get('no_gclient_branch') | 268 self.no_gclient_branch = args.get('no_gclient_branch') |
| 269 self.no_gclient_revision = args.get('no_gclient_revision', False) | 269 self.no_gclient_revision = args.get('no_gclient_revision', False) |
| 270 self.gclient_transitive = args.get('gclient_transitive') | 270 self.gclient_transitive = args.get('gclient_transitive') |
| 271 self.gclient_jobs = args.get('gclient_jobs') | 271 self.gclient_jobs = args.get('gclient_jobs') |
| 272 self.do_nothing = False |
| 272 | 273 |
| 273 def start(self): | 274 def start(self): |
| 274 """Start the update process. | 275 """Start the update process. |
| 275 | 276 |
| 276 start() is cut-and-paste from the base class, the block calling | 277 start() is cut-and-paste from the base class, the block calling |
| 277 self.sourcedirIsPatched() and the revert support is the only functional | 278 self.sourcedirIsPatched() and the revert support is the only functional |
| 278 difference from base.""" | 279 difference from base.""" |
| 279 self.sendStatus({'header': "starting " + self.header + "\n"}) | 280 self.sendStatus({'header': "starting " + self.header + "\n"}) |
| 280 self.command = None | 281 self.command = None |
| 281 | 282 |
| 282 # self.srcdir is where the VC system should put the sources | 283 # self.srcdir is where the VC system should put the sources |
| 283 if self.mode == "copy": | 284 if self.mode == "copy": |
| 284 self.srcdir = "source" # hardwired directory name, sorry | 285 self.srcdir = "source" # hardwired directory name, sorry |
| 285 else: | 286 else: |
| 286 self.srcdir = self.workdir | 287 self.srcdir = self.workdir |
| 287 self.sourcedatafile = os.path.join(self.builder.basedir, | 288 self.sourcedatafile = os.path.join(self.builder.basedir, |
| 288 self.srcdir, | 289 self.srcdir, |
| 289 ".buildbot-sourcedata") | 290 ".buildbot-sourcedata") |
| 291 self.do_nothing = os.path.isfile(os.path.join(self.builder.basedir, |
| 292 self.srcdir, |
| 293 'update.flag')) |
| 290 | 294 |
| 291 d = defer.succeed(None) | 295 d = defer.succeed(0) |
| 296 |
| 297 if self.do_nothing: |
| 298 # If bot update is run, we don't need to run the traditional update step. |
| 299 msg = 'update.flag file found: bot_update has run and checkout is \n' |
| 300 msg += 'already in a consistent state.\n' |
| 301 msg += 'No actions will be performed in this step.' |
| 302 self.sendStatus({'header': msg}) |
| 303 d.addCallback(self._sendRC) |
| 304 return d |
| 305 |
| 292 # Do we need to clobber anything? | 306 # Do we need to clobber anything? |
| 293 if self.mode in ("copy", "clobber", "export"): | 307 if self.mode in ("copy", "clobber", "export"): |
| 294 d.addCallback(self.doClobber, self.workdir) | 308 d.addCallback(self.doClobber, self.workdir) |
| 295 if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()): | 309 if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()): |
| 296 # the directory cannot be updated, so we have to clobber it. | 310 # the directory cannot be updated, so we have to clobber it. |
| 297 # Perhaps the master just changed modes from 'export' to | 311 # Perhaps the master just changed modes from 'export' to |
| 298 # 'update'. | 312 # 'update'. |
| 299 d.addCallback(self.doClobber, self.srcdir) | 313 d.addCallback(self.doClobber, self.srcdir) |
| 300 elif self.sourcedirIsPatched(): | 314 elif self.sourcedirIsPatched(): |
| 301 # The directory is patched. Revert the sources. | 315 # The directory is patched. Revert the sources. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 try: | 637 try: |
| 624 # We run this code in a try because it fails with an assertion if | 638 # We run this code in a try because it fails with an assertion if |
| 625 # the module is loaded twice. | 639 # the module is loaded twice. |
| 626 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' | 640 commandRegistry['gclient'] = 'slave.chromium_commands.GClient' |
| 627 return | 641 return |
| 628 except (AssertionError, NameError): | 642 except (AssertionError, NameError): |
| 629 pass | 643 pass |
| 630 | 644 |
| 631 | 645 |
| 632 RegisterCommands() | 646 RegisterCommands() |
| OLD | NEW |