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 import codecs | 6 import codecs |
| 7 import copy | 7 import copy |
| 8 import cStringIO | 8 import cStringIO |
| 9 import ctypes | 9 import ctypes |
| 10 import json | 10 import json |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 parse.add_option('--patch_url', help='Optional URL to SVN patch.') | 976 parse.add_option('--patch_url', help='Optional URL to SVN patch.') |
| 977 parse.add_option('--root', help='Repository root.') | 977 parse.add_option('--root', help='Repository root.') |
| 978 parse.add_option('--rietveld_server', | 978 parse.add_option('--rietveld_server', |
| 979 default='codereview.chromium.org', | 979 default='codereview.chromium.org', |
| 980 help='Rietveld server.') | 980 help='Rietveld server.') |
| 981 parse.add_option('--specs', help='Gcilent spec.') | 981 parse.add_option('--specs', help='Gcilent spec.') |
| 982 parse.add_option('--master', help='Master name.') | 982 parse.add_option('--master', help='Master name.') |
| 983 parse.add_option('-f', '--force', action='store_true', | 983 parse.add_option('-f', '--force', action='store_true', |
| 984 help='Bypass check to see if we want to be run. ' | 984 help='Bypass check to see if we want to be run. ' |
| 985 'Should ONLY be used locally.') | 985 'Should ONLY be used locally.') |
| 986 parse.add_option('--revision_mapping') | 986 parse.add_option('--revision_mapping', |
| 987 parse.add_option('--revision-mapping') # Backwards compatability. | 987 help='{"path/to/repo/": "property_name"}') |
| 988 parse.add_option('--revision_mapping_file', | |
| 989 help=('Same as revision_mapping, except its a path to a json' | |
| 990 ' file containing that format.')) | |
| 991 parse.add_option('--revision-mapping', # Backwards compatability. | |
| 992 help='DEPRECATED, use "revision_mapping" instead') | |
| 988 # TODO(hinoka): Support root@revision format. | 993 # TODO(hinoka): Support root@revision format. |
| 989 parse.add_option('--revision', | 994 parse.add_option('--revision', |
| 990 help='Revision to check out. Can be an SVN revision number, ' | 995 help='Revision to check out. Can be an SVN revision number, ' |
| 991 'git hash, or any form of git ref.') | 996 'git hash, or any form of git ref.') |
| 992 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], | 997 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], |
| 993 help='Hostname of the current machine, ' | 998 help='Hostname of the current machine, ' |
| 994 'used for determining whether or not to activate.') | 999 'used for determining whether or not to activate.') |
| 995 parse.add_option('--builder_name', help='Name of the builder, ' | 1000 parse.add_option('--builder_name', help='Name of the builder, ' |
| 996 'used for determining whether or not to activate.') | 1001 'used for determining whether or not to activate.') |
| 997 parse.add_option('--build_dir', default=os.getcwd()) | 1002 parse.add_option('--build_dir', default=os.getcwd()) |
| 998 parse.add_option('--flag_file', default=path.join(os.getcwd(), | 1003 parse.add_option('--flag_file', default=path.join(os.getcwd(), |
| 999 'update.flag')) | 1004 'update.flag')) |
| 1000 parse.add_option('--shallow', action='store_true', | 1005 parse.add_option('--shallow', action='store_true', |
| 1001 help='Use shallow clones for cache repositories.') | 1006 help='Use shallow clones for cache repositories.') |
| 1002 parse.add_option('--gyp_env', action='append', default=[], | 1007 parse.add_option('--gyp_env', action='append', default=[], |
| 1003 help='Environment variables to pass into gclient runhooks.') | 1008 help='Environment variables to pass into gclient runhooks.') |
| 1004 parse.add_option('--clobber', action='store_true', | 1009 parse.add_option('--clobber', action='store_true', |
| 1005 help='Delete checkout first, always') | 1010 help='Delete checkout first, always') |
| 1006 parse.add_option('-o', '--output_json', | 1011 parse.add_option('-o', '--output_json', |
| 1007 help='Output JSON information into a specified file') | 1012 help='Output JSON information into a specified file') |
| 1008 | 1013 |
| 1009 | 1014 |
| 1010 return parse.parse_args() | 1015 opts, args = parse.parse_args() |
|
Ryan Tseng
2014/05/09 21:33:21
nit: options? for consistency below.
iannucci
2014/05/09 22:11:52
Done.
| |
| 1016 | |
| 1017 if opts.revision_mapping_file is not None: | |
| 1018 if opts.revision_mapping is not None: | |
| 1019 print ('WARNING: revision_mapping_file was set at the same ' | |
| 1020 'time as revision_mapping?') | |
| 1021 with open(opts.revision_mapping_file, 'r') as f: | |
| 1022 opts.revision_mapping = json.load(f) | |
| 1023 | |
| 1024 return opts, args | |
| 1011 | 1025 |
| 1012 | 1026 |
| 1013 def main(): | 1027 def main(): |
| 1014 # Get inputs. | 1028 # Get inputs. |
| 1015 options, _ = parse_args() | 1029 options, _ = parse_args() |
| 1016 builder = options.builder_name | 1030 builder = options.builder_name |
| 1017 slave = options.slave_name | 1031 slave = options.slave_name |
| 1018 master = options.master | 1032 master = options.master |
| 1019 | 1033 |
| 1020 # Check if this script should activate or not. | 1034 # Check if this script should activate or not. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 patch_root=options.root, | 1141 patch_root=options.root, |
| 1128 step_text=step_text, | 1142 step_text=step_text, |
| 1129 properties=got_revisions) | 1143 properties=got_revisions) |
| 1130 else: | 1144 else: |
| 1131 # If we're not on recipes, tell annotator about our got_revisions. | 1145 # If we're not on recipes, tell annotator about our got_revisions. |
| 1132 emit_properties(got_revisions) | 1146 emit_properties(got_revisions) |
| 1133 | 1147 |
| 1134 | 1148 |
| 1135 if __name__ == '__main__': | 1149 if __name__ == '__main__': |
| 1136 sys.exit(main()) | 1150 sys.exit(main()) |
| OLD | NEW |