| 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 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import collections | 10 import collections |
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 parse.add_option('--patch_root', help='Directory to patch on top of.') | 1450 parse.add_option('--patch_root', help='Directory to patch on top of.') |
| 1451 parse.add_option('--rietveld_server', | 1451 parse.add_option('--rietveld_server', |
| 1452 default='codereview.chromium.org', | 1452 default='codereview.chromium.org', |
| 1453 help='Rietveld server.') | 1453 help='Rietveld server.') |
| 1454 parse.add_option('--gerrit_repo', | 1454 parse.add_option('--gerrit_repo', |
| 1455 help='Gerrit repository to pull the ref from.') | 1455 help='Gerrit repository to pull the ref from.') |
| 1456 parse.add_option('--gerrit_ref', help='Gerrit ref to apply.') | 1456 parse.add_option('--gerrit_ref', help='Gerrit ref to apply.') |
| 1457 parse.add_option('--gerrit_no_reset', action='store_true', | 1457 parse.add_option('--gerrit_no_reset', action='store_true', |
| 1458 help='Bypass calling reset after applying a gerrit ref.') | 1458 help='Bypass calling reset after applying a gerrit ref.') |
| 1459 parse.add_option('--specs', help='Gcilent spec.') | 1459 parse.add_option('--specs', help='Gcilent spec.') |
| 1460 parse.add_option('--master', help='Master name.') | 1460 parse.add_option('--master', |
| 1461 help='Master name. If specified and it is not in ' |
| 1462 'bot_update\'s whitelist, bot_update will be noop.') |
| 1461 parse.add_option('-f', '--force', action='store_true', | 1463 parse.add_option('-f', '--force', action='store_true', |
| 1462 help='Bypass check to see if we want to be run. ' | 1464 help='Bypass check to see if we want to be run. ' |
| 1463 'Should ONLY be used locally or by smart recipes.') | 1465 'Should ONLY be used locally or by smart recipes.') |
| 1464 parse.add_option('--revision_mapping', | 1466 parse.add_option('--revision_mapping', |
| 1465 help='{"path/to/repo/": "property_name"}') | 1467 help='{"path/to/repo/": "property_name"}') |
| 1466 parse.add_option('--revision_mapping_file', | 1468 parse.add_option('--revision_mapping_file', |
| 1467 help=('Same as revision_mapping, except its a path to a json' | 1469 help=('Same as revision_mapping, except its a path to a json' |
| 1468 ' file containing that format.')) | 1470 ' file containing that format.')) |
| 1469 parse.add_option('--revision', action='append', default=[], | 1471 parse.add_option('--revision', action='append', default=[], |
| 1470 help='Revision to check out. Can be an SVN revision number, ' | 1472 help='Revision to check out. Can be an SVN revision number, ' |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE | 1720 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE |
| 1719 | 1721 |
| 1720 | 1722 |
| 1721 def main(): | 1723 def main(): |
| 1722 # Get inputs. | 1724 # Get inputs. |
| 1723 options, _ = parse_args() | 1725 options, _ = parse_args() |
| 1724 builder = options.builder_name | 1726 builder = options.builder_name |
| 1725 slave = options.slave_name | 1727 slave = options.slave_name |
| 1726 master = options.master | 1728 master = options.master |
| 1727 | 1729 |
| 1730 if not master: |
| 1731 # bot_update activation whitelist is checked only on buildbot masters. |
| 1732 # If there is no master, bot_update is always active. |
| 1733 options.force = True |
| 1734 |
| 1728 # Check if this script should activate or not. | 1735 # Check if this script should activate or not. |
| 1729 active = check_valid_host(master, builder, slave) or options.force or False | 1736 active = options.force or check_valid_host(master, builder, slave) |
| 1730 | 1737 |
| 1731 # Print a helpful message to tell developers whats going on with this step. | 1738 # Print a helpful message to tell developers whats going on with this step. |
| 1732 print_help_text( | 1739 print_help_text( |
| 1733 options.force, options.output_json, active, master, builder, slave) | 1740 options.force, options.output_json, active, master, builder, slave) |
| 1734 | 1741 |
| 1735 # Parse, munipulate, and print the gclient solutions. | 1742 # Parse, munipulate, and print the gclient solutions. |
| 1736 specs = {} | 1743 specs = {} |
| 1737 exec(options.specs, specs) | 1744 exec(options.specs, specs) |
| 1738 svn_solutions = specs.get('solutions', []) | 1745 svn_solutions = specs.get('solutions', []) |
| 1739 git_slns, svn_root, buildspec = solutions_to_git(svn_solutions) | 1746 git_slns, svn_root, buildspec = solutions_to_git(svn_solutions) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1765 except Exception: | 1772 except Exception: |
| 1766 # Unexpected failure. | 1773 # Unexpected failure. |
| 1767 emit_flag(options.flag_file) | 1774 emit_flag(options.flag_file) |
| 1768 raise | 1775 raise |
| 1769 else: | 1776 else: |
| 1770 emit_flag(options.flag_file) | 1777 emit_flag(options.flag_file) |
| 1771 | 1778 |
| 1772 | 1779 |
| 1773 if __name__ == '__main__': | 1780 if __name__ == '__main__': |
| 1774 sys.exit(main()) | 1781 sys.exit(main()) |
| OLD | NEW |