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 10 matching lines...) Expand all Loading... | |
| 21 import urllib2 | 21 import urllib2 |
| 22 import urlparse | 22 import urlparse |
| 23 | 23 |
| 24 import os.path as path | 24 import os.path as path |
| 25 | 25 |
| 26 from common import chromium_utils | 26 from common import chromium_utils |
| 27 | 27 |
| 28 | 28 |
| 29 CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src.git' | 29 CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src.git' |
| 30 | 30 |
| 31 # Solution names that use git_buildspecs to resolve .DEPS.git. | |
| 32 BUILDSPEC_SOLUTIONS = [ | |
| 33 'chrome-official', | |
|
agable
2014/04/18 19:09:33
Is there any way these could be regex'd? 'chrome-o
Ryan Tseng
2014/04/21 22:10:33
Hm, maybe we can regex "/chrome-internal/trunk/too
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 34 'chrome-official-android', | |
| 35 'chrome-official-aura', | |
| 36 'chrome-official-chromeos', | |
| 37 'chrome-official-ios', | |
| 38 'chrome-official-linux', | |
| 39 'chrome-official-mac', | |
| 40 'chrome-official-win', | |
| 41 'chrome-official-win-asan', | |
| 42 'chrome-official-win64', | |
| 43 'chrome-official-wincf', | |
| 44 ] | |
| 45 | |
| 31 RECOGNIZED_PATHS = { | 46 RECOGNIZED_PATHS = { |
| 32 # If SVN path matches key, the entire URL is rewritten to the Git url. | 47 # If SVN path matches key, the entire URL is rewritten to the Git url. |
| 33 '/chrome/trunk/src': | 48 '/chrome/trunk/src': |
| 34 CHROMIUM_SRC_URL, | 49 CHROMIUM_SRC_URL, |
| 35 '/chrome-internal/trunk/src-internal': | 50 '/chrome-internal/trunk/src-internal': |
| 36 'https://chrome-internal.googlesource.com/chrome/src-internal.git' | 51 'https://chrome-internal.googlesource.com/chrome/src-internal.git', |
| 37 } | 52 } |
| 53 # Official builders trigger on changes to buildspecs, and therefore the | |
| 54 # gclient solution they get are always in a very specific folder. | |
| 55 # We need to add all of them into our set of recognized paths. | |
| 56 GIT_BUILDSPEC_PATH = ('https://chrome-internal.googlesource.com/chrome/tools/' | |
| 57 'buildspec') | |
| 58 for build_name in BUILDSPEC_SOLUTIONS: | |
| 59 RECOGNIZED_PATHS['/chrome-internal/trunk/tools/buildspec/build/%s' | |
| 60 % build_name] = GIT_BUILDSPEC_PATH | |
| 61 | |
| 62 # In addition, because buildspecs are in a very specific directory that isn't | |
| 63 # mirrored into Git as its own repo, but rather the parent of the solution | |
| 64 # directory is mirrored into Git, we have to tell gclient to use the DEPS | |
| 65 # thats farther down in the Git directory structure. | |
| 66 CUSTOM_DEPS_FILE = { | |
| 67 '/chrome-internal/trunk/tools/buildspec/build/%s' % sln_name: | |
| 68 'build/%s/DEPS' % sln_name | |
| 69 for sln_name in BUILDSPEC_SOLUTIONS | |
| 70 } | |
| 71 | |
| 72 # This is the repository that the buildspec -> git deps cron job mirrors | |
| 73 # all buildspecs into. When we see an svn buildspec, we rely on the | |
| 74 # buildspec -> git cron job to produce the git version of the buildspec. | |
|
agable
2014/04/18 19:09:33
buildspec2git
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 75 GIT_BUILDSPEC_REPO = ( | |
| 76 'https://chrome-internal.googlesource.com/chrome/tools/git_buildspecs') | |
| 38 | 77 |
| 39 # Copied from scripts/recipes/chromium.py. | 78 # Copied from scripts/recipes/chromium.py. |
| 40 GOT_REVISION_MAPPINGS = { | 79 GOT_REVISION_MAPPINGS = { |
| 41 '/chrome/trunk/src': { | 80 '/chrome/trunk/src': { |
| 42 'src/': 'got_revision', | 81 'src/': 'got_revision', |
| 43 'src/native_client/': 'got_nacl_revision', | 82 'src/native_client/': 'got_nacl_revision', |
| 44 'src/tools/swarm_client/': 'got_swarm_client_revision', | 83 'src/tools/swarm_client/': 'got_swarm_client_revision', |
| 45 'src/tools/swarming_client/': 'got_swarming_client_revision', | 84 'src/tools/swarming_client/': 'got_swarming_client_revision', |
| 46 'src/third_party/WebKit/': 'got_webkit_revision', | 85 'src/third_party/WebKit/': 'got_webkit_revision', |
| 47 'src/third_party/webrtc/': 'got_webrtc_revision', | 86 'src/third_party/webrtc/': 'got_webrtc_revision', |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 138 |
| 100 | 139 |
| 101 GCLIENT_TEMPLATE = """solutions = %(solutions)s | 140 GCLIENT_TEMPLATE = """solutions = %(solutions)s |
| 102 | 141 |
| 103 cache_dir = %(cache_dir)s | 142 cache_dir = %(cache_dir)s |
| 104 %(target_os)s | 143 %(target_os)s |
| 105 """ | 144 """ |
| 106 | 145 |
| 107 # IMPORTANT: If you're trying to enable a RECIPE bot, you'll need to | 146 # IMPORTANT: If you're trying to enable a RECIPE bot, you'll need to |
| 108 # edit recipe_modules/bot_update/api.py instead. | 147 # edit recipe_modules/bot_update/api.py instead. |
| 109 ENABLED_MASTERS = ['chromium.git'] | 148 ENABLED_MASTERS = ['chromium.git', 'chrome_git'] |
|
agable
2014/04/18 19:09:33
Have we made sure that the chrome_git waterfall is
Ryan Tseng
2014/04/21 22:10:33
Yep
| |
| 110 ENABLED_BUILDERS = { | 149 ENABLED_BUILDERS = { |
| 111 'tryserver.chromium': ['linux_rel_alt'], | 150 'tryserver.chromium': ['linux_rel_alt'], |
| 112 } | 151 } |
| 113 ENABLED_SLAVES = { | 152 ENABLED_SLAVES = { |
| 114 # This is enabled on a bot-to-bot basis to ensure that we don't have | 153 # This is enabled on a bot-to-bot basis to ensure that we don't have |
| 115 # bots that have mixed configs. | 154 # bots that have mixed configs. |
| 116 'chromium.fyi': [ | 155 'chromium.fyi': [ |
| 117 'build1-m1', # Chromium Builder / Chromium Builder (dbg) | 156 'build1-m1', # Chromium Builder / Chromium Builder (dbg) |
| 118 'vm928-m1', # Chromium Linux Buildrunner | 157 'vm928-m1', # Chromium Linux Buildrunner |
| 119 'vm859-m1', # Chromium Linux Redux | 158 'vm859-m1', # Chromium Linux Redux |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 """ | 340 """ |
| 302 assert input_solutions | 341 assert input_solutions |
| 303 solutions = copy.deepcopy(input_solutions) | 342 solutions = copy.deepcopy(input_solutions) |
| 304 first_solution = True | 343 first_solution = True |
| 305 for solution in solutions: | 344 for solution in solutions: |
| 306 original_url = solution['url'] | 345 original_url = solution['url'] |
| 307 parsed_url = urlparse.urlparse(original_url) | 346 parsed_url = urlparse.urlparse(original_url) |
| 308 parsed_path = parsed_url.path | 347 parsed_path = parsed_url.path |
| 309 if first_solution: | 348 if first_solution: |
| 310 root = parsed_path | 349 root = parsed_path |
| 350 deps_file = CUSTOM_DEPS_FILE.get(parsed_path, 'DEPS') | |
| 311 first_solution = False | 351 first_solution = False |
| 352 | |
| 353 # Rewrite SVN urls into Git urls. | |
| 312 if parsed_path in RECOGNIZED_PATHS: | 354 if parsed_path in RECOGNIZED_PATHS: |
| 313 solution['url'] = RECOGNIZED_PATHS[parsed_path] | 355 solution['url'] = RECOGNIZED_PATHS[parsed_path] |
| 314 else: | 356 else: |
| 315 print 'Warning: path %s not recognized' % parsed_path | 357 print 'Warning: path %s not recognized' % parsed_path |
| 316 if solution.get('deps_file', 'DEPS') == 'DEPS': | 358 |
| 317 solution['deps_file'] = '.DEPS.git' | 359 if parsed_path in CUSTOM_DEPS_FILE: |
| 360 # For some bots (eg. official), we want to specify what DEPS file | |
| 361 # to look at. | |
| 362 solution['deps_file'] = CUSTOM_DEPS_FILE[parsed_path] | |
| 363 | |
| 364 if solution.get('deps_file', 'DEPS').endswith('DEPS'): | |
| 365 # Point .DEPS.git is the git version of the DEPS file. | |
| 366 solution['deps_file'] = '.DEPS.git'.join( | |
| 367 solution['deps_file'].rsplit('DEPS', 1)) | |
|
agable
2014/04/18 19:09:33
wat. '.DEPS.git'.join()!?
Ryan Tseng
2014/04/21 22:10:33
rsplit('DEPS') will remove the rightmost 'DEPS', a
| |
| 368 | |
| 318 solution['managed'] = False | 369 solution['managed'] = False |
| 319 # We don't want gclient to be using a safesync URL. Instead it should | 370 # We don't want gclient to be using a safesync URL. Instead it should |
| 320 # using the lkgr/lkcr branch/tags. | 371 # using the lkgr/lkcr branch/tags. |
| 321 if 'safesync_url' in solution: | 372 if 'safesync_url' in solution: |
| 322 print 'Removing safesync url %s from %s' % (solution['safesync_url'], | 373 print 'Removing safesync url %s from %s' % (solution['safesync_url'], |
| 323 parsed_path) | 374 parsed_path) |
| 324 del solution['safesync_url'] | 375 del solution['safesync_url'] |
| 325 return solutions, root | 376 return solutions, root, deps_file |
| 326 | 377 |
| 327 | 378 |
| 328 def ensure_no_checkout(dir_names, scm_dirname): | 379 def ensure_no_checkout(dir_names, scm_dirname): |
| 329 """Ensure that there is no undesired checkout under build/. | 380 """Ensure that there is no undesired checkout under build/. |
| 330 | 381 |
| 331 If there is an incorrect checkout under build/, then | 382 If there is an incorrect checkout under build/, then |
| 332 move build/ to build.dead/ | 383 move build/ to build.dead/ |
| 333 This function will check each directory in dir_names. | 384 This function will check each directory in dir_names. |
| 334 | 385 |
| 335 scm_dirname is expected to be either ['.svn', '.git'] | 386 scm_dirname is expected to be either ['.svn', '.git'] |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 353 chromium_utils.RemoveFile(deletion_target) | 404 chromium_utils.RemoveFile(deletion_target) |
| 354 print 'done' | 405 print 'done' |
| 355 | 406 |
| 356 | 407 |
| 357 def gclient_configure(solutions, target_os): | 408 def gclient_configure(solutions, target_os): |
| 358 """Should do the same thing as gclient --spec='...'.""" | 409 """Should do the same thing as gclient --spec='...'.""" |
| 359 with codecs.open('.gclient', mode='w', encoding='utf-8') as f: | 410 with codecs.open('.gclient', mode='w', encoding='utf-8') as f: |
| 360 f.write(get_gclient_spec(solutions, target_os)) | 411 f.write(get_gclient_spec(solutions, target_os)) |
| 361 | 412 |
| 362 | 413 |
| 363 def gclient_sync(output_json): | 414 def gclient_sync(output_json, buildspec_mode): |
| 364 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' | 415 gclient_bin = 'gclient.bat' if sys.platform.startswith('win') else 'gclient' |
| 365 call(gclient_bin, 'sync', '--verbose', '--reset', '--force', | 416 cmd = [gclient_bin, 'sync', '--verbose', '--reset', '--force', |
| 366 '--nohooks', '--noprehooks', '--output-json', output_json) | 417 '--output-json', output_json] |
| 418 if buildspec_mode: | |
| 419 cmd += ['--with_branch_heads'] | |
| 420 else: | |
| 421 cmd += ['--nohooks', '--noprehooks'] | |
| 422 call(*cmd) | |
| 367 with open(output_json) as f: | 423 with open(output_json) as f: |
| 368 return json.load(f) | 424 return json.load(f) |
| 369 | 425 |
| 370 | 426 |
| 371 def create_less_than_or_equal_regex(number): | 427 def create_less_than_or_equal_regex(number): |
| 372 """ Return a regular expression to test whether an integer less than or equal | 428 """ Return a regular expression to test whether an integer less than or equal |
| 373 to 'number' is present in a given string. | 429 to 'number' is present in a given string. |
| 374 """ | 430 """ |
| 375 | 431 |
| 376 # In three parts, build a regular expression that match any numbers smaller | 432 # In three parts, build a regular expression that match any numbers smaller |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 def _last_commit_for_file(filename, repo_base): | 525 def _last_commit_for_file(filename, repo_base): |
| 470 cmd = ['log', '--format=%H', '--max-count=1', '--', filename] | 526 cmd = ['log', '--format=%H', '--max-count=1', '--', filename] |
| 471 return git(*cmd, cwd=repo_base).strip() | 527 return git(*cmd, cwd=repo_base).strip() |
| 472 | 528 |
| 473 | 529 |
| 474 def need_to_run_deps2git(repo_base, deps_file, deps_git_file): | 530 def need_to_run_deps2git(repo_base, deps_file, deps_git_file): |
| 475 """Checks to see if we need to run deps2git. | 531 """Checks to see if we need to run deps2git. |
| 476 | 532 |
| 477 Returns True if there was a DEPS change after the last .DEPS.git update. | 533 Returns True if there was a DEPS change after the last .DEPS.git update. |
| 478 """ | 534 """ |
| 535 print 'Checking if %s exists' % deps_git_file | |
| 479 if not path.isfile(deps_git_file): | 536 if not path.isfile(deps_git_file): |
| 480 # .DEPS.git doesn't exist but DEPS does? We probably want to generate one. | 537 # .DEPS.git doesn't exist but DEPS does? We probably want to generate one. |
| 538 print 'it exists!' | |
| 481 return True | 539 return True |
| 482 | 540 |
| 483 last_known_deps_ref = _last_commit_for_file(deps_file, repo_base) | 541 last_known_deps_ref = _last_commit_for_file(deps_file, repo_base) |
| 484 last_known_deps_git_ref = _last_commit_for_file(deps_git_file, repo_base) | 542 last_known_deps_git_ref = _last_commit_for_file(deps_git_file, repo_base) |
| 485 merge_base_ref = git('merge-base', last_known_deps_ref, | 543 merge_base_ref = git('merge-base', last_known_deps_ref, |
| 486 last_known_deps_git_ref, cwd=repo_base).strip() | 544 last_known_deps_git_ref, cwd=repo_base).strip() |
| 487 | 545 |
| 488 # If the merge base of the last DEPS and last .DEPS.git file is not | 546 # If the merge base of the last DEPS and last .DEPS.git file is not |
| 489 # equivilent to the hash of the last DEPS file, that means the DEPS file | 547 # equivilent to the hash of the last DEPS file, that means the DEPS file |
| 490 # was committed after the last .DEPS.git file. | 548 # was committed after the last .DEPS.git file. |
| 491 return last_known_deps_ref != merge_base_ref | 549 return last_known_deps_ref != merge_base_ref |
| 492 | 550 |
| 493 | 551 |
| 494 def ensure_deps2git(sln_dir, shallow): | 552 def get_git_buildspec(version): |
| 553 """Get the git buildspec of a version, return its contents. | |
| 554 | |
| 555 The contents are returned instead of the file so that we can check the | |
| 556 repository into a temp directory and confine the cleanup logic here.""" | |
|
agable
2014/04/18 19:09:33
nit: close docstring quotes on next line
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 557 git('cache', 'populate', '-v', '--cache-dir', CACHE_DIR, GIT_BUILDSPEC_REPO) | |
| 558 mirror_dir = git( | |
| 559 'cache', 'exists', '--cache-dir', CACHE_DIR, GIT_BUILDSPEC_REPO).strip() | |
| 560 tempdir = tempfile.mkdtemp() | |
| 561 git('clone', mirror_dir, tempdir) | |
|
agable
2014/04/18 19:09:33
Shouldn't need the tempdir or the clone. Once you
Ryan Tseng
2014/04/21 22:10:33
Ohh interesting, done.
| |
| 562 while True: | |
| 563 if path.isdir(path.join(tempdir, version)): | |
| 564 with open(path.join(tempdir, version, 'DEPS'), 'rb') as f: | |
| 565 git_buildspec = f.read() | |
| 566 chromium_utils.RemoveDirectory(tempdir) | |
| 567 return git_buildspec | |
| 568 print 'Buildspec for %s not committed yet, waiting 5 seconds...' | |
| 569 time.sleep(5) | |
|
agable
2014/04/18 19:09:33
Would be wise to have an upper limit on this, so i
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 570 git('cache', 'populate', '-v', '--cache-dir', | |
| 571 CACHE_DIR, GIT_BUILDSPEC_REPO) | |
| 572 git('fetch', 'origin' , cwd=tempdir) | |
| 573 | |
| 574 | |
| 575 def buildspecs2git(repo_base, deps_file, deps_git_file): | |
| 576 """This is like deps2git, but for buildspecs. | |
| 577 | |
| 578 Because buildspecs are vastly different than normal DEPS files, we cannot | |
| 579 use deps2git.py to generate git versions of the git DEPS. Fortunately | |
| 580 we don't have buildspec trybots, and there is already a service that | |
| 581 generates git DEPS for every buildspec commit already, so we can leverage | |
| 582 that service so that we don't need to run buildspec2git.py serially. | |
| 583 | |
| 584 This checks the commit message of the current DEPS file for the release | |
| 585 number, waits in a busy loop for the coorisponding .DEPS.git file to be | |
| 586 committed into the git_buildspecs repository.""" | |
|
agable
2014/04/18 19:09:33
nit: close docstring quotes on next line.
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 587 deps_log = git('log', '-1', deps_file, cwd=repo_base) | |
|
agable
2014/04/18 19:09:33
you could pass a format argument to git-log so tha
Ryan Tseng
2014/04/21 22:10:33
Done.
| |
| 588 m = re.search(r'Buildspec for\s+version (\d+\.\d+\.\d+\.\d+)', deps_log) | |
| 589 version = m.group(1) | |
| 590 git_buildspec = get_git_buildspec(version) | |
| 591 with open(deps_git_file, 'wb') as f: | |
| 592 f.write(git_buildspec) | |
| 593 | |
| 594 | |
| 595 def ensure_deps2git(sln_dir, deps_file, shallow, buildspec_mode): | |
| 495 repo_base = path.join(os.getcwd(), sln_dir) | 596 repo_base = path.join(os.getcwd(), sln_dir) |
| 496 deps_file = path.join(repo_base, 'DEPS') | 597 deps_file = path.join(repo_base, deps_file) |
| 497 deps_git_file = path.join(repo_base, '.DEPS.git') | 598 deps_git_file = path.join(path.dirname(deps_file), '.DEPS.git') |
| 599 if buildspec_mode: | |
| 600 return buildspecs2git(repo_base, deps_file, deps_git_file) | |
| 601 print 'Checking if %s is newer than %s' % (deps_file, deps_git_file) | |
| 498 if not path.isfile(deps_file): | 602 if not path.isfile(deps_file): |
| 499 return | 603 return |
| 500 | 604 |
| 501 if not need_to_run_deps2git(repo_base, deps_file, deps_git_file): | 605 if not need_to_run_deps2git(repo_base, deps_file, deps_git_file): |
| 502 return | 606 return |
| 503 | 607 |
| 504 print '===DEPS file modified, need to run deps2git===' | 608 print '===DEPS file modified, need to run deps2git===' |
| 505 # Magic to get deps2git to work with internal DEPS. | 609 # Magic to get deps2git to work with internal DEPS. |
| 506 shutil.copyfile(S2G_INTERNAL_FROM_PATH, S2G_INTERNAL_DEST_PATH) | 610 shutil.copyfile(S2G_INTERNAL_FROM_PATH, S2G_INTERNAL_DEST_PATH) |
| 507 | 611 |
| 508 # TODO(hinoka): This might need to be smarter if we need to deal with | 612 # TODO(hinoka): This might need to be smarter if we need to deal with |
| 509 # DEPS changes that are in an internal repository. | 613 # DEPS changes that are in an internal repository. |
| 510 repo_type = 'internal' if 'internal' in sln_dir else 'public' | 614 repo_type = 'public' |
| 615 if sln_dir in ['src-internal', 'chrome-official']: | |
|
agable
2014/04/18 19:09:33
hard-coding chrome-official again
Ryan Tseng
2014/04/21 22:10:33
Removed, this actually isn't needed
| |
| 616 repo_type = 'internal' | |
| 511 cmd = [sys.executable, DEPS2GIT_PATH, | 617 cmd = [sys.executable, DEPS2GIT_PATH, |
| 512 '-t', repo_type, | 618 '-t', repo_type, |
| 513 '--cache_dir=%s' % CACHE_DIR, | 619 '--cache_dir=%s' % CACHE_DIR, |
| 514 '--deps=%s' % deps_file, | 620 '--deps=%s' % deps_file, |
| 515 '--out=%s' % deps_git_file] | 621 '--out=%s' % deps_git_file] |
| 516 if shallow: | 622 if shallow: |
| 517 cmd.append('--shallow') | 623 cmd.append('--shallow') |
| 518 call(*cmd) | 624 call(*cmd) |
| 519 | 625 |
| 520 | 626 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 'slave': slave or 'Not specified', | 874 'slave': slave or 'Not specified', |
| 769 'recipe': recipe_force, | 875 'recipe': recipe_force, |
| 770 }, | 876 }, |
| 771 # Print to stderr so that it shows up red on win/mac. | 877 # Print to stderr so that it shows up red on win/mac. |
| 772 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE | 878 print ACTIVATED_MESSAGE if active else NOT_ACTIVATED_MESSAGE |
| 773 | 879 |
| 774 # Parse, munipulate, and print the gclient solutions. | 880 # Parse, munipulate, and print the gclient solutions. |
| 775 specs = {} | 881 specs = {} |
| 776 exec(options.specs, specs) | 882 exec(options.specs, specs) |
| 777 svn_solutions = specs.get('solutions', []) | 883 svn_solutions = specs.get('solutions', []) |
| 778 git_solutions, svn_root = solutions_to_git(svn_solutions) | 884 git_solutions, svn_root, deps_file = solutions_to_git(svn_solutions) |
| 779 solutions_printer(git_solutions) | 885 solutions_printer(git_solutions) |
| 780 | 886 |
| 781 dir_names = [sln.get('name') for sln in svn_solutions if 'name' in sln] | 887 dir_names = [sln.get('name') for sln in svn_solutions if 'name' in sln] |
| 782 # If we're active now, but the flag file doesn't exist (we weren't active last | 888 # If we're active now, but the flag file doesn't exist (we weren't active last |
| 783 # run) or vice versa, blow away all checkouts. | 889 # run) or vice versa, blow away all checkouts. |
| 784 if bool(active) != bool(check_flag(options.flag_file)): | 890 if bool(active) != bool(check_flag(options.flag_file)): |
| 785 ensure_no_checkout(dir_names, '*') | 891 ensure_no_checkout(dir_names, '*') |
| 786 if options.output_json: | 892 if options.output_json: |
| 787 # Make sure we tell recipes that we didn't run if the script exits here. | 893 # Make sure we tell recipes that we didn't run if the script exits here. |
| 788 emit_json(options.output_json, did_run=active) | 894 emit_json(options.output_json, did_run=active) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 # If either patch_url or issue is passed in, then we need to apply a patch. | 926 # If either patch_url or issue is passed in, then we need to apply a patch. |
| 821 if options.patch_url: | 927 if options.patch_url: |
| 822 # patch_url takes precidence since its only passed in on gcl try/git try. | 928 # patch_url takes precidence since its only passed in on gcl try/git try. |
| 823 apply_issue_svn(options.root, options.patch_url) | 929 apply_issue_svn(options.root, options.patch_url) |
| 824 elif options.issue: | 930 elif options.issue: |
| 825 apply_issue_rietveld(options.issue, options.patchset, options.root, | 931 apply_issue_rietveld(options.issue, options.patchset, options.root, |
| 826 options.rietveld_server, options.revision_mapping, | 932 options.rietveld_server, options.revision_mapping, |
| 827 git_ref) | 933 git_ref) |
| 828 | 934 |
| 829 # Run deps2git if there is a DEPS commit after the last .DEPS.git commit. | 935 # Run deps2git if there is a DEPS commit after the last .DEPS.git commit. |
| 830 ensure_deps2git(options.root, options.shallow) | 936 buildspec_mode = options.root in BUILDSPEC_SOLUTIONS |
| 937 ensure_deps2git(options.root, deps_file, options.shallow, buildspec_mode) | |
| 831 | 938 |
| 832 # Ensure our build/ directory is set up with the correct .gclient file. | 939 # Ensure our build/ directory is set up with the correct .gclient file. |
| 833 gclient_configure(git_solutions, specs.get('target_os', [])) | 940 gclient_configure(git_solutions, specs.get('target_os', [])) |
| 834 | 941 |
| 835 # Let gclient do the DEPS syncing. Also we can get "got revision" data | 942 # Let gclient do the DEPS syncing. Also we can get "got revision" data |
| 836 # from gclient by passing in --output-json. In our case, we can just reuse | 943 # from gclient by passing in --output-json. In our case, we can just reuse |
| 837 # the temp file that | 944 # the temp file that |
| 838 _, gclient_output_file = tempfile.mkstemp(suffix='.json') | 945 _, gclient_output_file = tempfile.mkstemp(suffix='.json') |
| 839 gclient_output = gclient_sync(gclient_output_file) | 946 gclient_output = gclient_sync(gclient_output_file, buildspec_mode) |
| 840 | 947 |
| 841 # If we're fed an svn revision number as --revision, then our got_revision | 948 # If we're fed an svn revision number as --revision, then our got_revision |
| 842 # output should be in svn revs. Otherwise it'll be in git hashes. | 949 # output should be in svn revs. Otherwise it'll be in git hashes. |
| 843 use_svn_rev = (options.revision and options.revision.isdigit() and | 950 use_svn_rev = (options.revision and options.revision.isdigit() and |
| 844 len(options.revision) < 40) | 951 len(options.revision) < 40) |
| 845 # Take care of got_revisions outputs. | 952 # Take care of got_revisions outputs. |
| 846 revision_mapping = get_revision_mapping(svn_root, options.revision_mapping) | 953 revision_mapping = get_revision_mapping(svn_root, options.revision_mapping) |
| 847 got_revisions = parse_got_revision(gclient_output, revision_mapping, | 954 got_revisions = parse_got_revision(gclient_output, revision_mapping, |
| 848 use_svn_rev) | 955 use_svn_rev) |
| 849 | 956 |
| 850 if options.output_json: | 957 if options.output_json: |
| 851 # Tell recipes information such as root, got_revision, etc. | 958 # Tell recipes information such as root, got_revision, etc. |
| 852 emit_json(options.output_json, | 959 emit_json(options.output_json, |
| 853 did_run=True, | 960 did_run=True, |
| 854 root=options.root, | 961 root=options.root, |
| 855 step_text=step_text, | 962 step_text=step_text, |
| 856 properties=got_revisions) | 963 properties=got_revisions) |
| 857 else: | 964 else: |
| 858 # If we're not on recipes, tell annotator about our got_revisions. | 965 # If we're not on recipes, tell annotator about our got_revisions. |
| 859 emit_properties(got_revisions) | 966 emit_properties(got_revisions) |
| 860 | 967 |
| 861 | 968 |
| 862 if __name__ == '__main__': | 969 if __name__ == '__main__': |
| 863 sys.exit(main()) | 970 sys.exit(main()) |
| OLD | NEW |