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 24 matching lines...) Expand all Loading... |
35 # Relative to the current working directory. | 35 # Relative to the current working directory. |
36 CURRENT_DIR = path.abspath(os.getcwd()) | 36 CURRENT_DIR = path.abspath(os.getcwd()) |
37 BUILDER_DIR = path.dirname(CURRENT_DIR) | 37 BUILDER_DIR = path.dirname(CURRENT_DIR) |
38 SLAVE_DIR = path.dirname(BUILDER_DIR) | 38 SLAVE_DIR = path.dirname(BUILDER_DIR) |
39 | 39 |
40 # Relative to this script's filesystem path. | 40 # Relative to this script's filesystem path. |
41 THIS_DIR = path.dirname(path.abspath(__file__)) | 41 THIS_DIR = path.dirname(path.abspath(__file__)) |
42 SCRIPTS_DIR = path.dirname(THIS_DIR) | 42 SCRIPTS_DIR = path.dirname(THIS_DIR) |
43 BUILD_DIR = path.dirname(SCRIPTS_DIR) | 43 BUILD_DIR = path.dirname(SCRIPTS_DIR) |
44 ROOT_DIR = path.dirname(BUILD_DIR) | 44 ROOT_DIR = path.dirname(BUILD_DIR) |
| 45 BUILD_INTERNAL_DIR = path.join(ROOT_DIR, 'build_internal') |
45 DEPOT_TOOLS_DIR = path.join(ROOT_DIR, 'depot_tools') | 46 DEPOT_TOOLS_DIR = path.join(ROOT_DIR, 'depot_tools') |
46 | 47 |
47 # TODO(luqui): This is a horrible hack to identify build_internal when build | |
48 # is a recipe dependency. bot_update should not be depending on internal, | |
49 # rather the arrow should go the other way (or just be destroyed). | |
50 def check_build_internal(d): | |
51 d = path.abspath(d) | |
52 if path.basename(d) == 'build_internal' and path.isdir(d): | |
53 return d | |
54 else: | |
55 return None | |
56 | |
57 BUILD_INTERNAL_DIR = ( | |
58 check_build_internal(path.join(ROOT_DIR, 'build_internal')) or | |
59 check_build_internal(path.join(ROOT_DIR, # .recipe_deps | |
60 path.pardir, # slave | |
61 path.pardir, # scripts | |
62 path.pardir))) # build_internal | |
63 | |
64 | 48 |
65 CHROMIUM_GIT_HOST = 'https://chromium.googlesource.com' | 49 CHROMIUM_GIT_HOST = 'https://chromium.googlesource.com' |
66 CHROMIUM_SRC_URL = CHROMIUM_GIT_HOST + '/chromium/src.git' | 50 CHROMIUM_SRC_URL = CHROMIUM_GIT_HOST + '/chromium/src.git' |
67 | 51 |
68 # Official builds use buildspecs, so this is a special case. | 52 # Official builds use buildspecs, so this is a special case. |
69 BUILDSPEC_TYPE = collections.namedtuple('buildspec', | 53 BUILDSPEC_TYPE = collections.namedtuple('buildspec', |
70 ('container', 'version')) | 54 ('container', 'version')) |
71 BUILDSPEC_RE = (r'^/chrome-internal/trunk/tools/buildspec/' | 55 BUILDSPEC_RE = (r'^/chrome-internal/trunk/tools/buildspec/' |
72 '(build|branches|releases)/(.+)$') | 56 '(build|branches|releases)/(.+)$') |
73 GIT_BUILDSPEC_PATH = ('https://chrome-internal.googlesource.com/chrome/tools/' | 57 GIT_BUILDSPEC_PATH = ('https://chrome-internal.googlesource.com/chrome/tools/' |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 180 |
197 GCLIENT_TEMPLATE = """solutions = %(solutions)s | 181 GCLIENT_TEMPLATE = """solutions = %(solutions)s |
198 | 182 |
199 cache_dir = r%(cache_dir)s | 183 cache_dir = r%(cache_dir)s |
200 %(target_os)s | 184 %(target_os)s |
201 %(target_os_only)s | 185 %(target_os_only)s |
202 """ | 186 """ |
203 | 187 |
204 | 188 |
205 internal_data = {} | 189 internal_data = {} |
206 if BUILD_INTERNAL_DIR: | 190 if os.path.isdir(BUILD_INTERNAL_DIR): |
207 local_vars = {} | 191 local_vars = {} |
208 try: | 192 try: |
209 execfile(os.path.join( | 193 execfile(os.path.join( |
210 BUILD_INTERNAL_DIR, 'scripts', 'slave', 'bot_update_cfg.py'), | 194 BUILD_INTERNAL_DIR, 'scripts', 'slave', 'bot_update_cfg.py'), |
211 local_vars) | 195 local_vars) |
212 except Exception: | 196 except Exception: |
213 # Same as if BUILD_INTERNAL_DIR didn't exist in the first place. | 197 # Same as if BUILD_INTERNAL_DIR didn't exist in the first place. |
214 print 'Warning: unable to read internal configuration file.' | 198 print 'Warning: unable to read internal configuration file.' |
215 print 'If this is an internal bot, this step may be erroneously inactive.' | 199 print 'If this is an internal bot, this step may be erroneously inactive.' |
216 internal_data = local_vars | 200 internal_data = local_vars |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 GIT_CACHE_PATH = path.join(DEPOT_TOOLS_DIR, 'git_cache.py') | 309 GIT_CACHE_PATH = path.join(DEPOT_TOOLS_DIR, 'git_cache.py') |
326 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir') | 310 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir') |
327 # Because we print CACHE_DIR out into a .gclient file, and then later run | 311 # Because we print CACHE_DIR out into a .gclient file, and then later run |
328 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets | 312 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets |
329 # parsed as "E:[\x08][\x08]uild". | 313 # parsed as "E:[\x08][\x08]uild". |
330 if sys.platform.startswith('win'): | 314 if sys.platform.startswith('win'): |
331 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\') | 315 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\') |
332 | 316 |
333 # Find the patch tool. | 317 # Find the patch tool. |
334 if sys.platform.startswith('win'): | 318 if sys.platform.startswith('win'): |
335 if not BUILD_INTERNAL_DIR: | 319 PATCH_TOOL = path.join(BUILD_INTERNAL_DIR, 'tools', 'patch.EXE') |
336 print 'Warning: could not find patch tool because there is no ' | |
337 print 'build_internal present.' | |
338 PATCH_TOOL = None | |
339 else: | |
340 PATCH_TOOL = path.join(BUILD_INTERNAL_DIR, 'tools', 'patch.EXE') | |
341 else: | 320 else: |
342 PATCH_TOOL = '/usr/bin/patch' | 321 PATCH_TOOL = '/usr/bin/patch' |
343 | 322 |
344 # If there is less than 100GB of disk space on the system, then we do | 323 # If there is less than 100GB of disk space on the system, then we do |
345 # a shallow checkout. | 324 # a shallow checkout. |
346 SHALLOW_CLONE_THRESHOLD = 100 * 1024 * 1024 * 1024 | 325 SHALLOW_CLONE_THRESHOLD = 100 * 1024 * 1024 * 1024 |
347 | 326 |
348 | 327 |
349 class SubprocessFailed(Exception): | 328 class SubprocessFailed(Exception): |
350 def __init__(self, message, code, output): | 329 def __init__(self, message, code, output): |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 except Exception: | 1669 except Exception: |
1691 # Unexpected failure. | 1670 # Unexpected failure. |
1692 emit_flag(options.flag_file) | 1671 emit_flag(options.flag_file) |
1693 raise | 1672 raise |
1694 else: | 1673 else: |
1695 emit_flag(options.flag_file) | 1674 emit_flag(options.flag_file) |
1696 | 1675 |
1697 | 1676 |
1698 if __name__ == '__main__': | 1677 if __name__ == '__main__': |
1699 sys.exit(main()) | 1678 sys.exit(main()) |
OLD | NEW |