Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Script that attempts to push to a special git repository to verify that git | 6 """Script that attempts to push to a special git repository to verify that git |
| 7 credentials are configured correctly. It also verifies that gclient solution is | 7 credentials are configured correctly. It also verifies that gclient solution is |
| 8 configured to use git checkout. | 8 configured to use git checkout. |
| 9 | 9 |
| 10 It will be added as gclient hook shortly before Chromium switches to git and | 10 It will be added as gclient hook shortly before Chromium switches to git and |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 'name': 'src', | 62 'name': 'src', |
| 63 'deps_file': '.DEPS.git', | 63 'deps_file': '.DEPS.git', |
| 64 'managed': False, | 64 'managed': False, |
| 65 'url': 'https://chromium.googlesource.com/chromium/src.git', | 65 'url': 'https://chromium.googlesource.com/chromium/src.git', |
| 66 } | 66 } |
| 67 | 67 |
| 68 # Possible chunks of git push response in case .netrc is misconfigured. | 68 # Possible chunks of git push response in case .netrc is misconfigured. |
| 69 BAD_ACL_ERRORS = ( | 69 BAD_ACL_ERRORS = ( |
| 70 '(prohibited by Gerrit)', | 70 '(prohibited by Gerrit)', |
| 71 'does not match your user account', | 71 'does not match your user account', |
| 72 'Git repository not found', | |
| 72 'Invalid user name or password', | 73 'Invalid user name or password', |
| 73 'Please make sure you have the correct access rights', | 74 'Please make sure you have the correct access rights', |
| 74 ) | 75 ) |
| 75 | 76 |
| 76 | 77 |
| 77 def is_on_bot(): | 78 def is_on_bot(): |
| 78 """True when running under buildbot.""" | 79 """True when running under buildbot.""" |
| 79 return os.environ.get('CHROME_HEADLESS') == '1' | 80 return os.environ.get('CHROME_HEADLESS') == '1' |
| 80 | 81 |
| 81 | 82 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 push_log='\n'.join(runner.log), | 350 push_log='\n'.join(runner.log), |
| 350 push_duration_ms=int((time.time() - started) * 1000)) | 351 push_duration_ms=int((time.time() - started) * 1000)) |
| 351 return uploaded and not flake | 352 return uploaded and not flake |
| 352 | 353 |
| 353 | 354 |
| 354 def check_gclient_config(conf): | 355 def check_gclient_config(conf): |
| 355 """Shows warning if gclient solution is not properly configured for git.""" | 356 """Shows warning if gclient solution is not properly configured for git.""" |
| 356 current = { | 357 current = { |
| 357 'name': 'src', | 358 'name': 'src', |
| 358 'deps_file': conf['gclient_deps'], | 359 'deps_file': conf['gclient_deps'], |
| 359 'managed': conf['gclient_managed'], | 360 'managed': conf['gclient_managed'] or False, |
| 360 'url': conf['gclient_url'], | 361 'url': conf['gclient_url'], |
| 361 } | 362 } |
| 362 if current != GOOD_GCLIENT_SOLUTION: | 363 good = GOOD_GCLIENT_SOLUTION |
| 364 if current == good: | |
| 365 return | |
| 366 # Show big warning if url or deps_file is wrong. | |
| 367 if current['url'] != good['url'] or current['deps_file'] != good['deps_file']: | |
|
iannucci
2014/08/20 20:26:28
maybe just pop out managed from both and see if th
Vadim Sh.
2014/08/20 21:10:34
I don't want to pop anything, since these dicts la
| |
| 363 print '-' * 80 | 368 print '-' * 80 |
| 364 print 'Your gclient solution is not set to use supported git workflow!' | 369 print 'Your gclient solution is not set to use supported git workflow!' |
| 365 print | 370 print |
| 366 print 'Your \'src\' solution (in %s):' % GCLIENT_CONFIG | 371 print 'Your \'src\' solution (in %s):' % GCLIENT_CONFIG |
| 367 print pprint.pformat(current, indent=2) | 372 print pprint.pformat(current, indent=2) |
| 368 print | 373 print |
| 369 print 'Correct \'src\' solution to use git:' | 374 print 'Correct \'src\' solution to use git:' |
| 370 print pprint.pformat(GOOD_GCLIENT_SOLUTION, indent=2) | 375 print pprint.pformat(good, indent=2) |
| 371 print | 376 print |
| 372 print 'Please update your .gclient file ASAP.' | 377 print 'Please update your .gclient file ASAP.' |
| 373 print '-' * 80 | 378 print '-' * 80 |
| 379 # Show smaller (additional) warning about managed workflow. | |
| 380 if current['managed']: | |
| 381 print '-' * 80 | |
| 382 print 'You are using deprecated managed gclient mode.' | |
|
iannucci
2014/08/20 20:26:28
let's find the ML discussion where we announced th
Vadim Sh.
2014/08/20 21:10:34
https://groups.google.com/a/chromium.org/forum/#!t
| |
| 383 print | |
| 384 print ( | |
| 385 'It is strongly advised to switch to unmanaged mode. For more ' | |
| 386 'information about managed mode and reasons for its deprecation see:') | |
| 387 print 'http://www.chromium.org/developers/how-tos/get-the-code#Managed_mode' | |
| 388 print '-' * 80 | |
| 374 | 389 |
| 375 | 390 |
| 376 def upload_report( | 391 def upload_report( |
| 377 conf, report_url, verbose, push_works, push_log, push_duration_ms): | 392 conf, report_url, verbose, push_works, push_log, push_duration_ms): |
| 378 """Posts report to the server, returns True if server accepted it. | 393 """Posts report to the server, returns True if server accepted it. |
| 379 | 394 |
| 380 Uploads the report only if script is running in Google corp network. Otherwise | 395 Uploads the report only if script is running in Google corp network. Otherwise |
| 381 just prints the report. | 396 just prints the report. |
| 382 """ | 397 """ |
| 383 report = conf.copy() | 398 report = conf.copy() |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 write_last_configuration(config) | 494 write_last_configuration(config) |
| 480 else: | 495 else: |
| 481 logging.warning('Check failed and will be retried on the next run') | 496 logging.warning('Check failed and will be retried on the next run') |
| 482 except Exception: | 497 except Exception: |
| 483 logging.exception('Unexpected exception when performing git access check') | 498 logging.exception('Unexpected exception when performing git access check') |
| 484 return 0 | 499 return 0 |
| 485 | 500 |
| 486 | 501 |
| 487 if __name__ == '__main__': | 502 if __name__ == '__main__': |
| 488 sys.exit(main(sys.argv[1:])) | 503 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |