| 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 """Functions specific to build slaves, shared by several buildbot scripts. | 5 """Functions specific to build slaves, shared by several buildbot scripts. |
| 6 """ | 6 """ |
| 7 | 7 |
| 8 import datetime | 8 import datetime |
| 9 import glob | 9 import glob |
| 10 import os | 10 import os |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 Raises chromium_utils.PathNotFound if there is no such directory. | 203 Raises chromium_utils.PathNotFound if there is no such directory. |
| 204 """ | 204 """ |
| 205 result = '' | 205 result = '' |
| 206 prev_dir = '' | 206 prev_dir = '' |
| 207 curr_dir = chrome_dir | 207 curr_dir = chrome_dir |
| 208 while prev_dir != curr_dir: | 208 while prev_dir != curr_dir: |
| 209 (parent, leaf) = os.path.split(curr_dir) | 209 (parent, leaf) = os.path.split(curr_dir) |
| 210 if leaf == 'build': | 210 if leaf == 'build': |
| 211 # Remember this one and keep looking for something shallower. | 211 # Remember this one and keep looking for something shallower. |
| 212 result = parent | 212 result = parent |
| 213 if leaf == 'slave': | 213 # DO NOT SUBMIT: Hack for running locally. |
| 214 # We are too deep, stop now. | 214 #if leaf == 'slave': |
| 215 break | 215 # # We are too deep, stop now. |
| 216 # break |
| 216 prev_dir = curr_dir | 217 prev_dir = curr_dir |
| 217 curr_dir = parent | 218 curr_dir = parent |
| 218 if not result: | 219 if not result: |
| 219 raise chromium_utils.PathNotFound('Unable to find slave base dir above %s' % | 220 raise chromium_utils.PathNotFound('Unable to find slave base dir above %s' % |
| 220 chrome_dir) | 221 chrome_dir) |
| 221 return result | 222 return result |
| 222 | 223 |
| 223 | 224 |
| 224 def GetStagingDir(start_dir): | 225 def GetStagingDir(start_dir): |
| 225 """Creates a chrome_staging dir in the starting directory. and returns its | 226 """Creates a chrome_staging dir in the starting directory. and returns its |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 def WriteLogLines(logname, lines, perf=None): | 699 def WriteLogLines(logname, lines, perf=None): |
| 699 logname = logname.rstrip() | 700 logname = logname.rstrip() |
| 700 lines = [line.rstrip() for line in lines] | 701 lines = [line.rstrip() for line in lines] |
| 701 for line in lines: | 702 for line in lines: |
| 702 print '@@@STEP_LOG_LINE@%s@%s@@@' % (logname, line) | 703 print '@@@STEP_LOG_LINE@%s@%s@@@' % (logname, line) |
| 703 if perf: | 704 if perf: |
| 704 perf = perf.rstrip() | 705 perf = perf.rstrip() |
| 705 print '@@@STEP_LOG_END_PERF@%s@%s@@@' % (logname, perf) | 706 print '@@@STEP_LOG_END_PERF@%s@%s@@@' % (logname, perf) |
| 706 else: | 707 else: |
| 707 print '@@@STEP_LOG_END@%s@@@' % logname | 708 print '@@@STEP_LOG_END@%s@@@' % logname |
| OLD | NEW |