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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 return uploaded and not flake | 374 return uploaded and not flake |
375 | 375 |
376 | 376 |
377 def check_gclient_config(conf): | 377 def check_gclient_config(conf): |
378 """Shows warning if gclient solution is not properly configured for git.""" | 378 """Shows warning if gclient solution is not properly configured for git.""" |
379 # Ignore configs that do not have 'src' solution at all. | 379 # Ignore configs that do not have 'src' solution at all. |
380 if not conf['gclient_url']: | 380 if not conf['gclient_url']: |
381 return | 381 return |
382 current = { | 382 current = { |
383 'name': 'src', | 383 'name': 'src', |
384 'deps_file': conf['gclient_deps'], | 384 'deps_file': conf['gclient_deps'] or 'DEPS', |
385 'managed': conf['gclient_managed'] or False, | 385 'managed': conf['gclient_managed'] or False, |
386 'url': conf['gclient_url'], | 386 'url': conf['gclient_url'], |
387 } | 387 } |
388 good = GOOD_GCLIENT_SOLUTION | 388 good = GOOD_GCLIENT_SOLUTION |
389 if current == good: | 389 if current == good: |
390 return | 390 return |
391 # Show big warning if url or deps_file is wrong. | 391 # Show big warning if url or deps_file is wrong. |
392 if current['url'] != good['url'] or current['deps_file'] != good['deps_file']: | 392 if current['url'] != good['url'] or current['deps_file'] != good['deps_file']: |
393 print '-' * 80 | 393 print '-' * 80 |
394 print 'Your gclient solution is not set to use supported git workflow!' | 394 print 'Your gclient solution is not set to use supported git workflow!' |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 write_last_configuration(config) | 529 write_last_configuration(config) |
530 else: | 530 else: |
531 logging.warning('Check failed and will be retried on the next run') | 531 logging.warning('Check failed and will be retried on the next run') |
532 except Exception: | 532 except Exception: |
533 logging.exception('Unexpected exception when performing git access check') | 533 logging.exception('Unexpected exception when performing git access check') |
534 return 0 | 534 return 0 |
535 | 535 |
536 | 536 |
537 if __name__ == '__main__': | 537 if __name__ == '__main__': |
538 sys.exit(main(sys.argv[1:])) | 538 sys.exit(main(sys.argv[1:])) |
OLD | NEW |