| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Utility functions used by the bisect tool. | 5 """Utility functions used by the bisect tool. |
| 6 | 6 |
| 7 This includes functions related to checking out the depot and outputting | 7 This includes functions related to checking out the depot and outputting |
| 8 annotations for the Buildbot waterfall. | 8 annotations for the Buildbot waterfall. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 spec = ''.join([l for l in spec.splitlines()]) | 278 spec = ''.join([l for l in spec.splitlines()]) |
| 279 | 279 |
| 280 if 'android' in opts.target_platform: | 280 if 'android' in opts.target_platform: |
| 281 spec += GCLIENT_SPEC_ANDROID | 281 spec += GCLIENT_SPEC_ANDROID |
| 282 | 282 |
| 283 return_code = RunGClient( | 283 return_code = RunGClient( |
| 284 ['config', '--spec=%s' % spec], cwd=cwd) | 284 ['config', '--spec=%s' % spec], cwd=cwd) |
| 285 return return_code | 285 return return_code |
| 286 | 286 |
| 287 | 287 |
| 288 def IsDepsFileBlink(git_revision=''): | |
| 289 """Reads .DEPS.git and returns whether or not we're using blink. | |
| 290 | |
| 291 Args: | |
| 292 git_revision: A git hash revision of chromium. | |
| 293 Returns: | |
| 294 True if blink, false if webkit. | |
| 295 """ | |
| 296 git_cmd = ['cat-file', 'blob', '%s:%s' %(git_revision, FILE_DEPS_GIT)] | |
| 297 search_str = 'blink.git' | |
| 298 search_key = 'webkit_url' | |
| 299 (out_put, ret_val) = RunGit(git_cmd) | |
| 300 if ret_val: | |
| 301 search_str = 'blink' | |
| 302 search_key = 'webkit_trunk' | |
| 303 git_cmd = ['cat-file', 'blob', '%s:%s' %(git_revision, FILE_DEPS)] | |
| 304 (out_put, ret_val) = RunGit(git_cmd) | |
| 305 if ret_val: | |
| 306 print 'Error processing DEPS or .DEPS.git' | |
| 307 return False | |
| 308 locals = { | |
| 309 'Var': lambda _: locals["vars"][_], | |
| 310 'From': lambda *args: None | |
| 311 } | |
| 312 | |
| 313 exec out_put in {}, locals | |
| 314 | |
| 315 return search_str in locals['vars'][search_key] | |
| 316 | |
| 317 | 288 |
| 318 def OnAccessError(func, path, _): | 289 def OnAccessError(func, path, _): |
| 319 """Error handler for shutil.rmtree. | 290 """Error handler for shutil.rmtree. |
| 320 | 291 |
| 321 Source: http://goo.gl/DEYNCT | 292 Source: http://goo.gl/DEYNCT |
| 322 | 293 |
| 323 If the error is due to an access error (read only file), it attempts to add | 294 If the error is due to an access error (read only file), it attempts to add |
| 324 write permissions, then retries. | 295 write permissions, then retries. |
| 325 | 296 |
| 326 If the error is for another reason it re-raises the error. | 297 If the error is for another reason it re-raises the error. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 if opts.output_buildbot_annotations: | 372 if opts.output_buildbot_annotations: |
| 402 OutputAnnotationStepStart(name) | 373 OutputAnnotationStepStart(name) |
| 403 | 374 |
| 404 passed = False | 375 passed = False |
| 405 | 376 |
| 406 if not RunGClientAndCreateConfig(opts, custom_deps): | 377 if not RunGClientAndCreateConfig(opts, custom_deps): |
| 407 passed_deps_check = True | 378 passed_deps_check = True |
| 408 if os.path.isfile(os.path.join('src', FILE_DEPS_GIT)): | 379 if os.path.isfile(os.path.join('src', FILE_DEPS_GIT)): |
| 409 cwd = os.getcwd() | 380 cwd = os.getcwd() |
| 410 os.chdir('src') | 381 os.chdir('src') |
| 411 if not IsDepsFileBlink(): | 382 passed_deps_check = True |
| 412 passed_deps_check = RemoveThirdPartyDirectory('Webkit') | |
| 413 else: | |
| 414 passed_deps_check = True | |
| 415 if passed_deps_check: | 383 if passed_deps_check: |
| 416 passed_deps_check = RemoveThirdPartyDirectory('libjingle') | 384 passed_deps_check = RemoveThirdPartyDirectory('libjingle') |
| 417 if passed_deps_check: | 385 if passed_deps_check: |
| 418 passed_deps_check = RemoveThirdPartyDirectory('skia') | 386 passed_deps_check = RemoveThirdPartyDirectory('skia') |
| 419 os.chdir(cwd) | 387 os.chdir(cwd) |
| 420 | 388 |
| 421 if passed_deps_check: | 389 if passed_deps_check: |
| 422 _CleanupPreviousGitRuns() | 390 _CleanupPreviousGitRuns() |
| 423 | 391 |
| 424 RunGClient(['revert']) | 392 RunGClient(['revert']) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 return sys.platform.startswith('linux') | 574 return sys.platform.startswith('linux') |
| 607 | 575 |
| 608 | 576 |
| 609 def IsMacHost(): | 577 def IsMacHost(): |
| 610 """Checks whether or not the script is running on Mac. | 578 """Checks whether or not the script is running on Mac. |
| 611 | 579 |
| 612 Returns: | 580 Returns: |
| 613 True if running on Mac. | 581 True if running on Mac. |
| 614 """ | 582 """ |
| 615 return sys.platform.startswith('darwin') | 583 return sys.platform.startswith('darwin') |
| OLD | NEW |