| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 | |
| 7 """Update the root-level buildbot checkout on each buildslave host. | |
| 8 | |
| 9 This differs from UpdateScripts in that it updates the root-level buildbot | |
| 10 script checkouts on ALL host machines, as opposed to a single buildslave's | |
| 11 checkout of the buildbot scripts on a single host machine. | |
| 12 """ | |
| 13 | |
| 14 | |
| 15 import re | |
| 16 import skia_vars | |
| 17 import sys | |
| 18 | |
| 19 from build_step import BuildStep, BuildStepWarning | |
| 20 from utils import force_update_checkout | |
| 21 from py.utils import misc | |
| 22 | |
| 23 sys.path.append(misc.BUILDBOT_PATH) | |
| 24 | |
| 25 from scripts import run_cmd | |
| 26 | |
| 27 | |
| 28 BUILDBOT_GIT_URL = skia_vars.GetGlobalVariable('buildbot_git_url') | |
| 29 | |
| 30 | |
| 31 class UpdateAllSlaveHosts(BuildStep): | |
| 32 def _Run(self): | |
| 33 script_path = run_cmd.ResolvablePath('slave', 'skia_slave_scripts', 'utils', | |
| 34 'force_update_checkout.py') | |
| 35 sync_cmd = ['python', script_path] | |
| 36 results = run_cmd.run_on_all_slave_hosts(sync_cmd) | |
| 37 failed = [] | |
| 38 for host in results.iterkeys(): | |
| 39 print host, | |
| 40 # Check and report the results of the command for each build slave host. | |
| 41 if results[host].returncode != 0: | |
| 42 # If the command failed (or we failed to log in), print the output and | |
| 43 # report a failure. | |
| 44 failed.append(host) | |
| 45 results[host].print_results(pretty=True) | |
| 46 else: | |
| 47 # If the command succeeded, find and print the commit hash we synced | |
| 48 # to. If we can't find it, then something must have failed, so | |
| 49 # print the output and report a failure. | |
| 50 match = re.search( | |
| 51 force_update_checkout.GOT_REVISION_PATTERN % ('(\w+)'), | |
| 52 results[host].stdout) | |
| 53 if match: | |
| 54 print '\t%s' % match.group(1) | |
| 55 else: | |
| 56 failed.append(host) | |
| 57 results[host].print_results(pretty=True) | |
| 58 | |
| 59 if failed: | |
| 60 print | |
| 61 print 'Failed to update the following hosts:' | |
| 62 for failed_host in failed: | |
| 63 print ' ', failed_host | |
| 64 | |
| 65 if failed: | |
| 66 # TODO(borenet): Make sure that we can log in to all hosts, then make this | |
| 67 # an error. | |
| 68 raise BuildStepWarning('Could not update some hosts.') | |
| 69 | |
| 70 | |
| 71 if '__main__' == __name__: | |
| 72 sys.exit(BuildStep.RunBuildStep(UpdateAllSlaveHosts)) | |
| OLD | NEW |