Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: scripts/slave/bot_update.py

Issue 1241323004: Cross-repo recipe package system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Change to googlesource Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
34 # Relative to the current working directory. 34 # Relative to the current working directory.
35 CURRENT_DIR = path.abspath(os.getcwd()) 35 CURRENT_DIR = path.abspath(os.getcwd())
36 BUILDER_DIR = path.dirname(CURRENT_DIR) 36 BUILDER_DIR = path.dirname(CURRENT_DIR)
37 SLAVE_DIR = path.dirname(BUILDER_DIR) 37 SLAVE_DIR = path.dirname(BUILDER_DIR)
38 38
39 # Relative to this script's filesystem path. 39 # Relative to this script's filesystem path.
40 THIS_DIR = path.dirname(path.abspath(__file__)) 40 THIS_DIR = path.dirname(path.abspath(__file__))
41 SCRIPTS_DIR = path.dirname(THIS_DIR) 41 SCRIPTS_DIR = path.dirname(THIS_DIR)
42 BUILD_DIR = path.dirname(SCRIPTS_DIR) 42 BUILD_DIR = path.dirname(SCRIPTS_DIR)
43 ROOT_DIR = path.dirname(BUILD_DIR) 43 ROOT_DIR = path.dirname(BUILD_DIR)
44 BUILD_INTERNAL_DIR = path.join(ROOT_DIR, 'build_internal')
45 DEPOT_TOOLS_DIR = path.join(ROOT_DIR, 'depot_tools') 44 DEPOT_TOOLS_DIR = path.join(ROOT_DIR, 'depot_tools')
46 45
46 # TODO(luqui): This is a horrible hack to identify build_internal when build
47 # is a recipe dependency. bot_update should not be depending on internal,
48 # rather the arrow should go the other way (or just be destroyed).
49 def check_build_internal(d):
50 d = path.abspath(d)
51 if path.basename(d) == 'build_internal' and path.isdir(d):
52 return d
53 else:
54 return None
55
56 BUILD_INTERNAL_DIR = (
57 check_build_internal(path.join(ROOT_DIR, 'build_internal')) or
58 check_build_internal(path.join(ROOT_DIR, # .recipe_deps
59 path.pardir, # slave
60 path.pardir, # scripts
61 path.pardir))) # build_internal
62
47 63
48 CHROMIUM_GIT_HOST = 'https://chromium.googlesource.com' 64 CHROMIUM_GIT_HOST = 'https://chromium.googlesource.com'
49 CHROMIUM_SRC_URL = CHROMIUM_GIT_HOST + '/chromium/src.git' 65 CHROMIUM_SRC_URL = CHROMIUM_GIT_HOST + '/chromium/src.git'
50 66
51 # Official builds use buildspecs, so this is a special case. 67 # Official builds use buildspecs, so this is a special case.
52 BUILDSPEC_TYPE = collections.namedtuple('buildspec', 68 BUILDSPEC_TYPE = collections.namedtuple('buildspec',
53 ('container', 'version')) 69 ('container', 'version'))
54 BUILDSPEC_RE = (r'^/chrome-internal/trunk/tools/buildspec/' 70 BUILDSPEC_RE = (r'^/chrome-internal/trunk/tools/buildspec/'
55 '(build|branches|releases)/(.+)$') 71 '(build|branches|releases)/(.+)$')
56 GIT_BUILDSPEC_PATH = ('https://chrome-internal.googlesource.com/chrome/tools/' 72 GIT_BUILDSPEC_PATH = ('https://chrome-internal.googlesource.com/chrome/tools/'
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 195
180 GCLIENT_TEMPLATE = """solutions = %(solutions)s 196 GCLIENT_TEMPLATE = """solutions = %(solutions)s
181 197
182 cache_dir = r%(cache_dir)s 198 cache_dir = r%(cache_dir)s
183 %(target_os)s 199 %(target_os)s
184 %(target_os_only)s 200 %(target_os_only)s
185 """ 201 """
186 202
187 203
188 internal_data = {} 204 internal_data = {}
189 if os.path.isdir(BUILD_INTERNAL_DIR): 205 if BUILD_INTERNAL_DIR:
190 local_vars = {} 206 local_vars = {}
191 try: 207 try:
192 execfile(os.path.join( 208 execfile(os.path.join(
193 BUILD_INTERNAL_DIR, 'scripts', 'slave', 'bot_update_cfg.py'), 209 BUILD_INTERNAL_DIR, 'scripts', 'slave', 'bot_update_cfg.py'),
194 local_vars) 210 local_vars)
195 except Exception: 211 except Exception:
196 # Same as if BUILD_INTERNAL_DIR didn't exist in the first place. 212 # Same as if BUILD_INTERNAL_DIR didn't exist in the first place.
197 print 'Warning: unable to read internal configuration file.' 213 print 'Warning: unable to read internal configuration file.'
198 print 'If this is an internal bot, this step may be erroneously inactive.' 214 print 'If this is an internal bot, this step may be erroneously inactive.'
199 internal_data = local_vars 215 internal_data = local_vars
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 GIT_CACHE_PATH = path.join(DEPOT_TOOLS_DIR, 'git_cache.py') 324 GIT_CACHE_PATH = path.join(DEPOT_TOOLS_DIR, 'git_cache.py')
309 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir') 325 CACHE_DIR = path.join(SLAVE_DIR, 'cache_dir')
310 # Because we print CACHE_DIR out into a .gclient file, and then later run 326 # Because we print CACHE_DIR out into a .gclient file, and then later run
311 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets 327 # eval() on it, backslashes need to be escaped, otherwise "E:\b\build" gets
312 # parsed as "E:[\x08][\x08]uild". 328 # parsed as "E:[\x08][\x08]uild".
313 if sys.platform.startswith('win'): 329 if sys.platform.startswith('win'):
314 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\') 330 CACHE_DIR = CACHE_DIR.replace('\\', '\\\\')
315 331
316 # Find the patch tool. 332 # Find the patch tool.
317 if sys.platform.startswith('win'): 333 if sys.platform.startswith('win'):
318 PATCH_TOOL = path.join(BUILD_INTERNAL_DIR, 'tools', 'patch.EXE') 334 if not BUILD_INTERNAL_DIR:
335 print 'Warning: could not find patch tool because there is no '
336 print 'build_internal present.'
337 PATCH_TOOL = None
338 else:
339 PATCH_TOOL = path.join(BUILD_INTERNAL_DIR, 'tools', 'patch.EXE')
319 else: 340 else:
320 PATCH_TOOL = '/usr/bin/patch' 341 PATCH_TOOL = '/usr/bin/patch'
321 342
322 # If there is less than 100GB of disk space on the system, then we do 343 # If there is less than 100GB of disk space on the system, then we do
323 # a shallow checkout. 344 # a shallow checkout.
324 SHALLOW_CLONE_THRESHOLD = 100 * 1024 * 1024 * 1024 345 SHALLOW_CLONE_THRESHOLD = 100 * 1024 * 1024 * 1024
325 346
326 347
327 class SubprocessFailed(Exception): 348 class SubprocessFailed(Exception):
328 def __init__(self, message, code, output): 349 def __init__(self, message, code, output):
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 except Exception: 1661 except Exception:
1641 # Unexpected failure. 1662 # Unexpected failure.
1642 emit_flag(options.flag_file) 1663 emit_flag(options.flag_file)
1643 raise 1664 raise
1644 else: 1665 else:
1645 emit_flag(options.flag_file) 1666 emit_flag(options.flag_file)
1646 1667
1647 1668
1648 if __name__ == '__main__': 1669 if __name__ == '__main__':
1649 sys.exit(main()) 1670 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698