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 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1420 parse.add_option('--root', dest='patch_root', | 1420 parse.add_option('--root', dest='patch_root', |
1421 help='DEPRECATED: Use --patch_root.') | 1421 help='DEPRECATED: Use --patch_root.') |
1422 parse.add_option('--patch_root', help='Directory to patch on top of.') | 1422 parse.add_option('--patch_root', help='Directory to patch on top of.') |
1423 parse.add_option('--rietveld_server', | 1423 parse.add_option('--rietveld_server', |
1424 default='codereview.chromium.org', | 1424 default='codereview.chromium.org', |
1425 help='Rietveld server.') | 1425 help='Rietveld server.') |
1426 parse.add_option('--gerrit_repo', | 1426 parse.add_option('--gerrit_repo', |
1427 help='Gerrit repository to pull the ref from.') | 1427 help='Gerrit repository to pull the ref from.') |
1428 parse.add_option('--gerrit_ref', help='Gerrit ref to apply.') | 1428 parse.add_option('--gerrit_ref', help='Gerrit ref to apply.') |
1429 parse.add_option('--specs', help='Gcilent spec.') | 1429 parse.add_option('--specs', help='Gcilent spec.') |
1430 parse.add_option('--master', help='Master name.') | 1430 parse.add_option('--master', |
1431 help='Master name. If specified and it is not in ' | |
1432 'bot_update\'s whitelist, bot_update will be noop.') | |
1431 parse.add_option('-f', '--force', action='store_true', | 1433 parse.add_option('-f', '--force', action='store_true', |
1432 help='Bypass check to see if we want to be run. ' | 1434 help='Bypass check to see if we want to be run. ' |
1433 'Should ONLY be used locally or by smart recipes.') | 1435 'Should ONLY be used locally or by smart recipes.') |
1434 parse.add_option('--revision_mapping', | 1436 parse.add_option('--revision_mapping', |
1435 help='{"path/to/repo/": "property_name"}') | 1437 help='{"path/to/repo/": "property_name"}') |
1436 parse.add_option('--revision_mapping_file', | 1438 parse.add_option('--revision_mapping_file', |
1437 help=('Same as revision_mapping, except its a path to a json' | 1439 help=('Same as revision_mapping, except its a path to a json' |
1438 ' file containing that format.')) | 1440 ' file containing that format.')) |
1439 parse.add_option('--revision', action='append', default=[], | 1441 parse.add_option('--revision', action='append', default=[], |
1440 help='Revision to check out. Can be an SVN revision number, ' | 1442 help='Revision to check out. Can be an SVN revision number, ' |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 'DEPOT_TOOLS_DIR': DEPOT_TOOLS_DIR, | 1678 'DEPOT_TOOLS_DIR': DEPOT_TOOLS_DIR, |
1677 }, | 1679 }, |
1678 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE | 1680 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE |
1679 | 1681 |
1680 | 1682 |
1681 def main(): | 1683 def main(): |
1682 # Get inputs. | 1684 # Get inputs. |
1683 options, _ = parse_args() | 1685 options, _ = parse_args() |
1684 builder = options.builder_name | 1686 builder = options.builder_name |
1685 slave = options.slave_name | 1687 slave = options.slave_name |
1686 master = options.master | 1688 master = options.master |
hinoka
2016/05/24 19:36:23
What about just
if not master:
options.force = T
nodir
2016/05/27 18:07:39
Done
| |
1687 | 1689 |
1688 # Check if this script should activate or not. | 1690 # Check if this script should activate or not. |
1689 active = check_valid_host(master, builder, slave) or options.force or False | 1691 active = ( |
1692 not master or | |
1693 check_valid_host(master, builder, slave) or | |
1694 options.force or | |
1695 False) | |
1690 | 1696 |
1691 # Print a helpful message to tell developers whats going on with this step. | 1697 # Print a helpful message to tell developers whats going on with this step. |
1692 print_help_text( | 1698 print_help_text( |
1693 options.force, options.output_json, active, master, builder, slave) | 1699 options.force, options.output_json, active, master, builder, slave) |
1694 | 1700 |
1695 # Parse, munipulate, and print the gclient solutions. | 1701 # Parse, munipulate, and print the gclient solutions. |
1696 specs = {} | 1702 specs = {} |
1697 exec(options.specs, specs) | 1703 exec(options.specs, specs) |
1698 svn_solutions = specs.get('solutions', []) | 1704 svn_solutions = specs.get('solutions', []) |
1699 git_slns, svn_root, buildspec = solutions_to_git(svn_solutions) | 1705 git_slns, svn_root, buildspec = solutions_to_git(svn_solutions) |
(...skipping 25 matching lines...) Expand all Loading... | |
1725 except Exception: | 1731 except Exception: |
1726 # Unexpected failure. | 1732 # Unexpected failure. |
1727 emit_flag(options.flag_file) | 1733 emit_flag(options.flag_file) |
1728 raise | 1734 raise |
1729 else: | 1735 else: |
1730 emit_flag(options.flag_file) | 1736 emit_flag(options.flag_file) |
1731 | 1737 |
1732 | 1738 |
1733 if __name__ == '__main__': | 1739 if __name__ == '__main__': |
1734 sys.exit(main()) | 1740 sys.exit(main()) |
OLD | NEW |