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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 parse.add_option('--patch_url', help='Optional URL to SVN patch.') | 1031 parse.add_option('--patch_url', help='Optional URL to SVN patch.') |
1032 parse.add_option('--root', help='Repository root.') | 1032 parse.add_option('--root', help='Repository root.') |
1033 parse.add_option('--rietveld_server', | 1033 parse.add_option('--rietveld_server', |
1034 default='codereview.chromium.org', | 1034 default='codereview.chromium.org', |
1035 help='Rietveld server.') | 1035 help='Rietveld server.') |
1036 parse.add_option('--specs', help='Gcilent spec.') | 1036 parse.add_option('--specs', help='Gcilent spec.') |
1037 parse.add_option('--master', help='Master name.') | 1037 parse.add_option('--master', help='Master name.') |
1038 parse.add_option('-f', '--force', action='store_true', | 1038 parse.add_option('-f', '--force', action='store_true', |
1039 help='Bypass check to see if we want to be run. ' | 1039 help='Bypass check to see if we want to be run. ' |
1040 'Should ONLY be used locally.') | 1040 'Should ONLY be used locally.') |
1041 parse.add_option('--revision_mapping') | 1041 parse.add_option('--revision_mapping', |
1042 parse.add_option('--revision-mapping') # Backwards compatability. | 1042 help='{"path/to/repo/": "property_name"}') |
| 1043 parse.add_option('--revision_mapping_file', |
| 1044 help=('Same as revision_mapping, except its a path to a json' |
| 1045 ' file containing that format.')) |
| 1046 parse.add_option('--revision-mapping', # Backwards compatability. |
| 1047 help='DEPRECATED, use "revision_mapping" instead') |
1043 # TODO(hinoka): Support root@revision format. | 1048 # TODO(hinoka): Support root@revision format. |
1044 parse.add_option('--revision', | 1049 parse.add_option('--revision', |
1045 help='Revision to check out. Can be an SVN revision number, ' | 1050 help='Revision to check out. Can be an SVN revision number, ' |
1046 'git hash, or any form of git ref.') | 1051 'git hash, or any form of git ref.') |
1047 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], | 1052 parse.add_option('--slave_name', default=socket.getfqdn().split('.')[0], |
1048 help='Hostname of the current machine, ' | 1053 help='Hostname of the current machine, ' |
1049 'used for determining whether or not to activate.') | 1054 'used for determining whether or not to activate.') |
1050 parse.add_option('--builder_name', help='Name of the builder, ' | 1055 parse.add_option('--builder_name', help='Name of the builder, ' |
1051 'used for determining whether or not to activate.') | 1056 'used for determining whether or not to activate.') |
1052 parse.add_option('--build_dir', default=os.getcwd()) | 1057 parse.add_option('--build_dir', default=os.getcwd()) |
1053 parse.add_option('--flag_file', default=path.join(os.getcwd(), | 1058 parse.add_option('--flag_file', default=path.join(os.getcwd(), |
1054 'update.flag')) | 1059 'update.flag')) |
1055 parse.add_option('--shallow', action='store_true', | 1060 parse.add_option('--shallow', action='store_true', |
1056 help='Use shallow clones for cache repositories.') | 1061 help='Use shallow clones for cache repositories.') |
1057 parse.add_option('--gyp_env', action='append', default=[], | 1062 parse.add_option('--gyp_env', action='append', default=[], |
1058 help='Environment variables to pass into gclient runhooks.') | 1063 help='Environment variables to pass into gclient runhooks.') |
1059 parse.add_option('--clobber', action='store_true', | 1064 parse.add_option('--clobber', action='store_true', |
1060 help='Delete checkout first, always') | 1065 help='Delete checkout first, always') |
1061 parse.add_option('-o', '--output_json', | 1066 parse.add_option('-o', '--output_json', |
1062 help='Output JSON information into a specified file') | 1067 help='Output JSON information into a specified file') |
1063 | 1068 |
1064 | 1069 |
1065 return parse.parse_args() | 1070 options, args = parse.parse_args() |
| 1071 |
| 1072 if options.revision_mapping_file is not None: |
| 1073 if options.revision_mapping is not None: |
| 1074 print ('WARNING: revision_mapping_file was set at the same ' |
| 1075 'time as revision_mapping?') |
| 1076 with open(options.revision_mapping_file, 'r') as f: |
| 1077 options.revision_mapping = json.load(f) |
| 1078 |
| 1079 return options, args |
1066 | 1080 |
1067 | 1081 |
1068 def main(): | 1082 def main(): |
1069 # Get inputs. | 1083 # Get inputs. |
1070 options, _ = parse_args() | 1084 options, _ = parse_args() |
1071 builder = options.builder_name | 1085 builder = options.builder_name |
1072 slave = options.slave_name | 1086 slave = options.slave_name |
1073 master = options.master | 1087 master = options.master |
1074 | 1088 |
1075 # Check if this script should activate or not. | 1089 # Check if this script should activate or not. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 specs=options.specs) | 1226 specs=options.specs) |
1213 all_threads.append(thr) | 1227 all_threads.append(thr) |
1214 | 1228 |
1215 # Sort of wait for all telemetry threads to finish. | 1229 # Sort of wait for all telemetry threads to finish. |
1216 for thr in all_threads: | 1230 for thr in all_threads: |
1217 thr.join(5) | 1231 thr.join(5) |
1218 | 1232 |
1219 | 1233 |
1220 if __name__ == '__main__': | 1234 if __name__ == '__main__': |
1221 sys.exit(main()) | 1235 sys.exit(main()) |
OLD | NEW |