libv8 6.0.286.54.3 → 6.2.414.42.0beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -3
  3. data/CHANGELOG.md +4 -0
  4. data/Rakefile +3 -3
  5. data/lib/libv8/version.rb +1 -1
  6. data/patches/0001-Build-a-standalone-static-library.patch +4 -4
  7. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +12 -14
  8. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +4 -4
  9. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +4 -4
  10. data/patches/0005-avoid-constructor-inheritance-due-to-compilation-iss.patch +81 -0
  11. data/patches/9001-Arm64-Fix-host-architecture-detection.patch +37 -0
  12. data/vendor/depot_tools/.gitignore +1 -0
  13. data/vendor/depot_tools/OWNERS +0 -1
  14. data/vendor/depot_tools/auth.py +154 -6
  15. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  16. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  17. data/vendor/depot_tools/cipd_bin_setup.sh +12 -2
  18. data/vendor/depot_tools/cipd_manifest.txt +4 -1
  19. data/vendor/depot_tools/fetch.py +2 -0
  20. data/vendor/depot_tools/gclient.py +4 -6
  21. data/vendor/depot_tools/gclient_scm.py +12 -5
  22. data/vendor/depot_tools/gerrit_util.py +23 -1
  23. data/vendor/depot_tools/git_cache.py +59 -23
  24. data/vendor/depot_tools/git_cl.py +114 -43
  25. data/vendor/depot_tools/git_common.py +7 -0
  26. data/vendor/depot_tools/git_rebase_update.py +1 -0
  27. data/vendor/depot_tools/git_upstream_diff.py +12 -5
  28. data/vendor/depot_tools/gsutil.py +10 -0
  29. data/vendor/depot_tools/infra/config/OWNERS +0 -1
  30. data/vendor/depot_tools/infra/config/cq.cfg +6 -5
  31. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  32. data/vendor/depot_tools/mac_toolchain +12 -0
  33. data/vendor/depot_tools/man/html/git-upstream-diff.html +10 -6
  34. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +18 -7
  35. data/vendor/depot_tools/man/src/git-upstream-diff.txt +8 -5
  36. data/vendor/depot_tools/owners.py +9 -2
  37. data/vendor/depot_tools/presubmit_canned_checks.py +122 -0
  38. data/vendor/depot_tools/presubmit_support.py +57 -4
  39. data/vendor/depot_tools/recipes/OWNERS +0 -1
  40. data/vendor/depot_tools/recipes/README.recipes.md +20 -17
  41. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +1 -1
  42. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +15 -4
  43. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +23 -0
  44. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +46 -0
  45. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json +23 -0
  46. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +46 -0
  47. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +22 -0
  48. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +46 -0
  49. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +46 -0
  50. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json +46 -0
  51. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +46 -0
  52. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json +46 -0
  53. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json +46 -0
  54. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json +46 -0
  55. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +46 -0
  56. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +46 -0
  57. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +46 -0
  58. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +4 -45
  59. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +23 -0
  60. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +23 -0
  61. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +46 -0
  62. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +46 -0
  63. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +46 -0
  64. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json +46 -0
  65. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +46 -0
  66. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +46 -0
  67. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +46 -0
  68. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +46 -0
  69. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json +194 -0
  70. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name_no_patch.json +105 -0
  71. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +46 -0
  72. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +12 -2
  73. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +226 -149
  74. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +16 -5
  75. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +1 -2
  76. data/vendor/depot_tools/recipes/recipes/fetch_end_to_end_test.expected/basic.json +11 -0
  77. data/vendor/depot_tools/rietveld.py +1 -1
  78. data/vendor/depot_tools/roll_dep.py +4 -1
  79. data/vendor/depot_tools/split_cl.py +3 -0
  80. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -1
  81. data/vendor/depot_tools/third_party/mock/LICENSE.txt +26 -0
  82. data/vendor/depot_tools/third_party/mock/README.chromium +24 -0
  83. data/vendor/depot_tools/third_party/mock/__init__.py +2366 -0
  84. data/vendor/depot_tools/watchlists.py +12 -5
  85. metadata +12 -5
  86. data/patches/0005-Fix-GCC-7-build-errors.patch +0 -147
@@ -6,6 +6,7 @@ DEPS = [
6
6
  'bot_update',
7
7
  'gclient',
8
8
  'gerrit',
9
+ 'recipe_engine/json',
9
10
  'recipe_engine/path',
10
11
  'recipe_engine/platform',
11
12
  'recipe_engine/properties',
@@ -49,6 +50,7 @@ def RunSteps(api):
49
50
  gerrit_no_reset = True if api.properties.get('gerrit_no_reset') else False
50
51
  gerrit_no_rebase_patch_ref = bool(
51
52
  api.properties.get('gerrit_no_rebase_patch_ref'))
53
+ manifest_name = api.properties.get('manifest_name')
52
54
 
53
55
  if api.properties.get('test_apply_gerrit_ref'):
54
56
  prop2arg = {
@@ -79,7 +81,8 @@ def RunSteps(api):
79
81
  suffix=suffix,
80
82
  gerrit_no_reset=gerrit_no_reset,
81
83
  gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref,
82
- disable_syntax_validation=True)
84
+ disable_syntax_validation=True,
85
+ manifest_name=manifest_name)
83
86
  if patch:
84
87
  api.bot_update.deapply_patch(bot_update_step)
85
88
 
@@ -89,6 +92,13 @@ def GenTests(api):
89
92
  patch=False,
90
93
  revision='abc'
91
94
  )
95
+ yield api.test('with_manifest_name_no_patch') + api.properties(
96
+ manifest_name='checkout',
97
+ patch=False
98
+ )
99
+ yield api.test('with_manifest_name') + api.properties(
100
+ manifest_name='checkout'
101
+ )
92
102
  yield api.test('buildbot') + api.properties(
93
103
  path_config='buildbot',
94
104
  patch=False,
@@ -142,7 +152,7 @@ def GenTests(api):
142
152
  issue=12345,
143
153
  patchset=654321,
144
154
  rietveld='https://rietveld.example.com/',
145
- ) + api.step_data('bot_update', retcode=1)
155
+ ) + api.step_data('bot_update', api.json.invalid(None), retcode=1)
146
156
  yield api.test('tryjob_fail_patch') + api.properties(
147
157
  issue=12345,
148
158
  patchset=654321,
@@ -29,7 +29,6 @@ import os.path as path
29
29
  # How many bytes at a time to read from pipes.
30
30
  BUF_SIZE = 256
31
31
 
32
-
33
32
  # Define a bunch of directory paths.
34
33
  # Relative to this script's filesystem path.
35
34
  THIS_DIR = path.dirname(path.abspath(__file__))
@@ -52,7 +51,6 @@ COMMIT_ORIGINAL_POSITION_FOOTER_KEY = 'Cr-Original-Commit-Position'
52
51
  # Regular expression to parse gclient's revinfo entries.
53
52
  REVINFO_RE = re.compile(r'^([^:]+):\s+([^@]+)@(.+)$')
54
53
 
55
-
56
54
  # Copied from scripts/recipes/chromium.py.
57
55
  GOT_REVISION_MAPPINGS = {
58
56
  CHROMIUM_SRC_URL: {
@@ -152,7 +150,7 @@ def call(*args, **kwargs): # pragma: no cover
152
150
  print '===Injecting Environment Variables==='
153
151
  for k, v in sorted(new_env.items()):
154
152
  print '%s: %s' % (k, v)
155
- print '===Running %s===' % (' '.join(args),)
153
+ print '===Running %s ===' % (' '.join(args),)
156
154
  print 'In directory: %s' % cwd
157
155
  start_time = time.time()
158
156
  proc = subprocess.Popen(args, **kwargs)
@@ -185,13 +183,13 @@ def call(*args, **kwargs): # pragma: no cover
185
183
  elapsed_time = ((time.time() - start_time) / 60.0)
186
184
  outval = out.getvalue()
187
185
  if code:
188
- print '===Failed in %.1f mins===' % elapsed_time
186
+ print '===Failed in %.1f mins of %s ===' % (elapsed_time, ' '.join(args))
189
187
  print
190
188
  raise SubprocessFailed('%s failed with code %d in %s.' %
191
189
  (' '.join(args), code, cwd),
192
190
  code, outval)
193
191
 
194
- print '===Succeeded in %.1f mins===' % elapsed_time
192
+ print '===Succeeded in %.1f mins of %s ===' % (elapsed_time, ' '.join(args))
195
193
  print
196
194
  return outval
197
195
 
@@ -364,7 +362,32 @@ def gclient_revinfo():
364
362
  return call_gclient('revinfo', '-a') or ''
365
363
 
366
364
 
367
- def create_manifest():
365
+ def normalize_git_url(url):
366
+ """Normalize a git url to be consistent.
367
+
368
+ This recognizes urls to the googlesoruce.com domain. It ensures that
369
+ the url:
370
+ * Do not end in .git
371
+ * Do not contain /a/ in their path.
372
+ """
373
+ try:
374
+ p = urlparse.urlparse(url)
375
+ except Exception:
376
+ # Not a url, just return it back.
377
+ return url
378
+ if not p.netloc.endswith('.googlesource.com'):
379
+ # Not a googlesource.com URL, can't normalize this, just return as is.
380
+ return url
381
+ upath = p.path
382
+ if upath.startswith('/a'):
383
+ upath = upath[len('/a'):]
384
+ if upath.endswith('.git'):
385
+ upath = upath[:-len('.git')]
386
+ return 'https://%s%s' % (p.netloc, upath)
387
+
388
+
389
+ # TODO(hinoka): Remove this once all downstream recipes stop using this format.
390
+ def create_manifest_old():
368
391
  manifest = {}
369
392
  output = gclient_revinfo()
370
393
  for line in output.strip().splitlines():
@@ -379,6 +402,54 @@ def create_manifest():
379
402
  return manifest
380
403
 
381
404
 
405
+ # TODO(hinoka): Include patch revision.
406
+ def create_manifest(gclient_output, patch_root, gerrit_ref):
407
+ """Return the JSONPB equivilent of the source manifest proto.
408
+
409
+ The source manifest proto is defined here:
410
+ https://chromium.googlesource.com/infra/luci/recipes-py/+/master/recipe_engine/source_manifest.proto
411
+
412
+ This is based off of:
413
+ * The gclient_output (from calling gclient.py --output-json) which contains
414
+ the directory -> repo:revision mapping.
415
+ * Gerrit Patch info which contains info about patched revisions.
416
+
417
+ We normalize the URLs such that if they are googlesource.com urls, they:
418
+ """
419
+ manifest = {
420
+ 'version': 0, # Currently the only valid version is 0.
421
+ }
422
+ dirs = {}
423
+ if patch_root:
424
+ patch_root = patch_root.strip('/') # Normalize directory names.
425
+ for directory, info in gclient_output.get('solutions', {}).iteritems():
426
+ directory = directory.strip('/') # Normalize the directory name.
427
+ # There are two places to the the revision from, we do it in this order:
428
+ # 1. In the "revision" field
429
+ # 2. At the end of the URL, after @
430
+ repo = ''
431
+ revision = info.get('revision', '')
432
+ # The format of the url is "https://repo.url/blah.git@abcdefabcdef" or
433
+ # just "https://repo.url/blah.git"
434
+ url_split = info.get('url', '').split('@')
435
+ if not revision and len(url_split) == 2:
436
+ revision = url_split[1]
437
+ if url_split:
438
+ repo = normalize_git_url(url_split[0])
439
+ if repo:
440
+ dirs[directory] = {
441
+ 'git_checkout': {
442
+ 'repo_url': repo,
443
+ 'revision': revision,
444
+ }
445
+ }
446
+ if patch_root == directory:
447
+ dirs[directory]['git_checkout']['patch_fetch_ref'] = gerrit_ref
448
+
449
+ manifest['directories'] = dirs
450
+ return manifest
451
+
452
+
382
453
  def get_commit_message_footer_map(message):
383
454
  """Returns: (dict) A dictionary of commit message footer entries.
384
455
  """
@@ -436,24 +507,27 @@ def get_total_disk_space():
436
507
  return (total, free)
437
508
 
438
509
 
439
- def get_target_revision(folder_name, git_url, revisions):
440
- normalized_name = folder_name.strip('/')
510
+ def _get_target_branch_and_revision(solution_name, git_url, revisions):
511
+ normalized_name = solution_name.strip('/')
441
512
  if normalized_name in revisions:
442
- return revisions[normalized_name]
443
- if git_url in revisions:
444
- return revisions[git_url]
445
- return None
446
-
513
+ configured = revisions[normalized_name]
514
+ elif git_url in revisions:
515
+ configured = revisions[git_url]
516
+ else:
517
+ return 'master', 'HEAD'
447
518
 
448
- def force_revision(folder_name, revision):
449
- split_revision = revision.split(':', 1)
450
- branch = 'master'
451
- if len(split_revision) == 2:
519
+ parts = configured.split(':', 1)
520
+ if len(parts) == 2:
452
521
  # Support for "branch:revision" syntax.
453
- branch, revision = split_revision
522
+ return parts
523
+ return 'master', configured
454
524
 
525
+
526
+ def force_solution_revision(solution_name, git_url, revisions, cwd):
527
+ branch, revision = _get_target_branch_and_revision(
528
+ solution_name, git_url, revisions)
455
529
  if revision and revision.upper() != 'HEAD':
456
- git('checkout', '--force', revision, cwd=folder_name)
530
+ treeish = revision
457
531
  else:
458
532
  # TODO(machenbach): This won't work with branch-heads, as Gerrit's
459
533
  # destination branch would be e.g. refs/branch-heads/123. But here
@@ -461,8 +535,12 @@ def force_revision(folder_name, revision):
461
535
  # This will also not work if somebody passes a local refspec like
462
536
  # refs/heads/master. It needs to translate to refs/remotes/origin/master
463
537
  # first. See also https://crbug.com/740456 .
464
- ref = branch if branch.startswith('refs/') else 'origin/%s' % branch
465
- git('checkout', '--force', ref, cwd=folder_name)
538
+ treeish = branch if branch.startswith('refs/') else 'origin/%s' % branch
539
+
540
+ # Note that -- argument is necessary to ensure that git treats `treeish`
541
+ # argument as revision or ref, and not as a file/directory which happens to
542
+ # have the exact same name.
543
+ git('checkout', '--force', treeish, '--', cwd=cwd)
466
544
 
467
545
 
468
546
  def is_broken_repo_dir(repo_dir):
@@ -470,124 +548,122 @@ def is_broken_repo_dir(repo_dir):
470
548
  return not path.exists(os.path.join(repo_dir, '.git', 'config'))
471
549
 
472
550
 
473
- def _maybe_break_locks(checkout_path):
551
+ def _maybe_break_locks(checkout_path, tries=3):
474
552
  """This removes all .lock files from this repo's .git directory.
475
553
 
476
554
  In particular, this will cleanup index.lock files, as well as ref lock
477
555
  files.
478
556
  """
479
- git_dir = os.path.join(checkout_path, '.git')
480
- for dirpath, _, filenames in os.walk(git_dir):
481
- for filename in filenames:
482
- if filename.endswith('.lock'):
483
- to_break = os.path.join(dirpath, filename)
484
- print 'breaking lock: %s' % to_break
485
- try:
486
- os.remove(to_break)
487
- except OSError as ex:
488
- print 'FAILED to break lock: %s: %s' % (to_break, ex)
489
- raise
557
+ def attempt():
558
+ git_dir = os.path.join(checkout_path, '.git')
559
+ for dirpath, _, filenames in os.walk(git_dir):
560
+ for filename in filenames:
561
+ if filename.endswith('.lock'):
562
+ to_break = os.path.join(dirpath, filename)
563
+ print 'breaking lock: %s' % to_break
564
+ try:
565
+ os.remove(to_break)
566
+ except OSError as ex:
567
+ print 'FAILED to break lock: %s: %s' % (to_break, ex)
568
+ raise
569
+
570
+ for _ in xrange(tries):
571
+ try:
572
+ attempt()
573
+ return
574
+ except Exception:
575
+ pass
576
+
490
577
 
491
578
 
492
- def git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
493
- cleanup_dir):
579
+ def git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
580
+ cleanup_dir):
494
581
  build_dir = os.getcwd()
495
- # Before we do anything, break all git_cache locks.
496
- if path.isdir(git_cache_dir):
497
- git('cache', 'unlock', '-vv', '--force', '--all',
498
- '--cache-dir', git_cache_dir)
499
- for item in os.listdir(git_cache_dir):
500
- filename = os.path.join(git_cache_dir, item)
501
- if item.endswith('.lock'):
502
- raise Exception('%s exists after cache unlock' % filename)
503
582
  first_solution = True
504
583
  for sln in solutions:
505
- # Just in case we're hitting a different git server than the one from
506
- # which the target revision was polled, we retry some.
507
- done = False
508
-
509
- # One minute (5 tries with exp. backoff). We retry at least once regardless
510
- # of deadline in case initial fetch takes longer than the deadline but does
511
- # not contain the required revision.
512
- deadline = time.time() + 60
513
- tries = 0
514
- while not done:
515
- name = sln['name']
516
- url = sln['url']
517
- if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL:
518
- # Experiments show there's little to be gained from
519
- # a shallow clone of src.
520
- shallow = False
521
- sln_dir = path.join(build_dir, name)
522
- s = ['--shallow'] if shallow else []
523
- populate_cmd = (['cache', 'populate', '--ignore_locks', '-v',
524
- '--cache-dir', git_cache_dir] + s + [url])
525
- for ref in refs:
526
- populate_cmd.extend(['--ref', ref])
527
- git(*populate_cmd)
528
- mirror_dir = git(
529
- 'cache', 'exists', '--quiet',
530
- '--cache-dir', git_cache_dir, url).strip()
531
- clone_cmd = (
532
- 'clone', '--no-checkout', '--local', '--shared', mirror_dir, sln_dir)
584
+ sln_dir = path.join(build_dir, sln['name'])
585
+ _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir,
586
+ cleanup_dir)
587
+ if first_solution:
588
+ git_ref = git('log', '--format=%H', '--max-count=1',
589
+ cwd=path.join(build_dir, sln['name'])
590
+ ).strip()
591
+ first_solution = False
592
+ return git_ref
533
593
 
534
- try:
535
- # If repo deletion was aborted midway, it may have left .git in broken
536
- # state.
537
- if path.exists(sln_dir) and is_broken_repo_dir(sln_dir):
538
- print 'Git repo %s appears to be broken, removing it' % sln_dir
539
- remove(sln_dir, cleanup_dir)
540
-
541
- # Use "tries=1", since we retry manually in this loop.
542
- if not path.isdir(sln_dir):
543
- git(*clone_cmd)
544
- else:
545
- git('remote', 'set-url', 'origin', mirror_dir, cwd=sln_dir)
546
- git('fetch', 'origin', cwd=sln_dir)
547
- for ref in refs:
548
- refspec = '%s:%s' % (ref, ref.lstrip('+'))
549
- git('fetch', 'origin', refspec, cwd=sln_dir)
550
-
551
- # Windows sometimes has trouble deleting files.
552
- # This can make git commands that rely on locks fail.
553
- # Try a few times in case Windows has trouble again (and again).
554
- if sys.platform.startswith('win'):
555
- tries = 3
556
- while tries:
557
- try:
558
- _maybe_break_locks(sln_dir)
559
- break
560
- except Exception:
561
- tries -= 1
562
-
563
- revision = get_target_revision(name, url, revisions) or 'HEAD'
564
- force_revision(sln_dir, revision)
565
- done = True
566
- except SubprocessFailed as e:
567
- # Exited abnormally, theres probably something wrong.
568
- print 'Something failed: %s.' % str(e)
569
-
570
- # Only kick in deadline after trying once, in case the revision hasn't
571
- # yet propagated.
572
- if tries >= 1 and time.time() > deadline:
573
- overrun = time.time() - deadline
574
- print 'Ran %s seconds past deadline. Aborting.' % overrun
575
- raise
576
594
 
577
- # Lets wipe the checkout and try again.
578
- tries += 1
579
- sleep_secs = 2**tries
580
- print 'waiting %s seconds and trying again...' % sleep_secs
581
- time.sleep(sleep_secs)
595
+ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir,
596
+ cleanup_dir):
597
+ name = sln['name']
598
+ url = sln['url']
599
+ if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL:
600
+ # Experiments show there's little to be gained from
601
+ # a shallow clone of src.
602
+ shallow = False
603
+ s = ['--shallow'] if shallow else []
604
+ populate_cmd = (['cache', 'populate', '--ignore_locks', '-v',
605
+ '--cache-dir', git_cache_dir] + s + [url])
606
+ for ref in refs:
607
+ populate_cmd.extend(['--ref', ref])
608
+
609
+ # Just in case we're hitting a different git server than the one from
610
+ # which the target revision was polled, we retry some.
611
+
612
+ # One minute (5 tries with exp. backoff). We retry at least once regardless
613
+ # of deadline in case initial fetch takes longer than the deadline but does
614
+ # not contain the required revision.
615
+ deadline = time.time() + 60
616
+ tries = 0
617
+ while True:
618
+ git(*populate_cmd)
619
+ mirror_dir = git(
620
+ 'cache', 'exists', '--quiet',
621
+ '--cache-dir', git_cache_dir, url).strip()
622
+
623
+ try:
624
+ # If repo deletion was aborted midway, it may have left .git in broken
625
+ # state.
626
+ if path.exists(sln_dir) and is_broken_repo_dir(sln_dir):
627
+ print 'Git repo %s appears to be broken, removing it' % sln_dir
582
628
  remove(sln_dir, cleanup_dir)
583
629
 
584
- git('clean', '-dff', cwd=sln_dir)
630
+ # Use "tries=1", since we retry manually in this loop.
631
+ if not path.isdir(sln_dir):
632
+ git('clone', '--no-checkout', '--local', '--shared', mirror_dir,
633
+ sln_dir)
634
+ else:
635
+ git('remote', 'set-url', 'origin', mirror_dir, cwd=sln_dir)
636
+ git('fetch', 'origin', cwd=sln_dir)
637
+ for ref in refs:
638
+ refspec = '%s:%s' % (ref, ref.lstrip('+'))
639
+ git('fetch', 'origin', refspec, cwd=sln_dir)
640
+
641
+ # Windows sometimes has trouble deleting files.
642
+ # This can make git commands that rely on locks fail.
643
+ # Try a few times in case Windows has trouble again (and again).
644
+ if sys.platform.startswith('win'):
645
+ _maybe_break_locks(sln_dir, tries=3)
646
+
647
+ force_solution_revision(name, url, revisions, sln_dir)
648
+ git('clean', '-dff', cwd=sln_dir)
649
+ return
650
+ except SubprocessFailed as e:
651
+ # Exited abnormally, theres probably something wrong.
652
+ print 'Something failed: %s.' % str(e)
653
+
654
+ # Only kick in deadline after trying once, in case the revision hasn't
655
+ # yet propagated.
656
+ if tries >= 1 and time.time() > deadline:
657
+ overrun = time.time() - deadline
658
+ print 'Ran %s seconds past deadline. Aborting.' % overrun
659
+ raise
585
660
 
586
- if first_solution:
587
- git_ref = git('log', '--format=%H', '--max-count=1',
588
- cwd=sln_dir).strip()
589
- first_solution = False
590
- return git_ref
661
+ # Lets wipe the checkout and try again.
662
+ tries += 1
663
+ sleep_secs = 2**tries
664
+ print 'waiting %s seconds and trying again...' % sleep_secs
665
+ time.sleep(sleep_secs)
666
+ remove(sln_dir, cleanup_dir)
591
667
 
592
668
 
593
669
  def _download(url):
@@ -761,8 +837,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
761
837
  # invoking DEPS.
762
838
  print 'Fetching Git checkout'
763
839
 
764
- git_ref = git_checkout(solutions, revisions, shallow, refs, git_cache_dir,
765
- cleanup_dir)
840
+ git_ref = git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
841
+ cleanup_dir)
766
842
 
767
843
  print '===Processing patch solutions==='
768
844
  already_patched = []
@@ -953,6 +1029,9 @@ def parse_args():
953
1029
  with open(options.spec_path, 'r') as fd:
954
1030
  options.specs = fd.read()
955
1031
 
1032
+ if not options.output_json:
1033
+ parse.error('--output_json is required')
1034
+
956
1035
  if not options.git_cache_dir:
957
1036
  parse.error('--git-cache-dir is required')
958
1037
 
@@ -1005,8 +1084,6 @@ def prepare(options, git_slns, active):
1005
1084
  step_text = '[%dGB/%dGB used (%d%%)]' % (used_disk_space_gb,
1006
1085
  total_disk_space_gb,
1007
1086
  percent_used)
1008
- if not options.output_json:
1009
- print '@@@STEP_TEXT@%s@@@' % step_text
1010
1087
  shallow = (total_disk_space < SHALLOW_CLONE_THRESHOLD
1011
1088
  and not options.no_shallow)
1012
1089
 
@@ -1068,17 +1145,16 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
1068
1145
  ensure_no_checkout(dir_names, options.cleanup_dir)
1069
1146
  gclient_output = ensure_checkout(**checkout_parameters)
1070
1147
  except PatchFailed as e:
1071
- if options.output_json:
1072
- # Tell recipes information such as root, got_revision, etc.
1073
- emit_json(options.output_json,
1074
- did_run=True,
1075
- root=first_sln,
1076
- patch_apply_return_code=e.code,
1077
- patch_root=options.patch_root,
1078
- patch_failure=True,
1079
- failed_patch_body=e.output,
1080
- step_text='%s PATCH FAILED' % step_text,
1081
- fixed_revisions=revisions)
1148
+ # Tell recipes information such as root, got_revision, etc.
1149
+ emit_json(options.output_json,
1150
+ did_run=True,
1151
+ root=first_sln,
1152
+ patch_apply_return_code=e.code,
1153
+ patch_root=options.patch_root,
1154
+ patch_failure=True,
1155
+ failed_patch_body=e.output,
1156
+ step_text='%s PATCH FAILED' % step_text,
1157
+ fixed_revisions=revisions)
1082
1158
  raise
1083
1159
 
1084
1160
  # Take care of got_revisions outputs.
@@ -1101,16 +1177,17 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
1101
1177
  got_revisions = { 'got_revision': 'BOT_UPDATE_NO_REV_FOUND' }
1102
1178
  #raise Exception('No got_revision(s) found in gclient output')
1103
1179
 
1104
- if options.output_json:
1105
- # Tell recipes information such as root, got_revision, etc.
1106
- emit_json(options.output_json,
1107
- did_run=True,
1108
- root=first_sln,
1109
- patch_root=options.patch_root,
1110
- step_text=step_text,
1111
- fixed_revisions=revisions,
1112
- properties=got_revisions,
1113
- manifest=create_manifest())
1180
+ # Tell recipes information such as root, got_revision, etc.
1181
+ emit_json(options.output_json,
1182
+ did_run=True,
1183
+ root=first_sln,
1184
+ patch_root=options.patch_root,
1185
+ step_text=step_text,
1186
+ fixed_revisions=revisions,
1187
+ properties=got_revisions,
1188
+ manifest=create_manifest_old(),
1189
+ source_manifest=create_manifest(
1190
+ gclient_output, options.patch_root, options.gerrit_ref))
1114
1191
 
1115
1192
 
1116
1193
  def print_debug_info():