libv8 6.3.292.48.1 → 6.7.288.46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +10 -34
  3. data/CHANGELOG.md +16 -0
  4. data/README.md +9 -63
  5. data/Rakefile +2 -2
  6. data/ext/libv8/builder.rb +22 -87
  7. data/ext/libv8/extconf.rb +1 -1
  8. data/ext/libv8/paths.rb +5 -18
  9. data/lib/libv8/version.rb +1 -1
  10. data/spec/location_spec.rb +1 -2
  11. data/spec/spec_helper.rb +0 -1
  12. data/vendor/depot_tools/.gitattributes +1 -2
  13. data/vendor/depot_tools/OWNERS +0 -1
  14. data/vendor/depot_tools/PRESUBMIT.py +11 -6
  15. data/vendor/depot_tools/README.md +0 -1
  16. data/vendor/depot_tools/WATCHLISTS +0 -6
  17. data/vendor/depot_tools/auth.py +129 -87
  18. data/vendor/depot_tools/autoninja +11 -1
  19. data/vendor/depot_tools/autoninja.bat +7 -1
  20. data/vendor/depot_tools/autoninja.py +14 -6
  21. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/cipd +23 -2
  24. data/vendor/depot_tools/cipd.bat +2 -2
  25. data/vendor/depot_tools/cipd_client_version +1 -1
  26. data/vendor/depot_tools/cipd_manifest.txt +17 -7
  27. data/vendor/depot_tools/cit.py +7 -6
  28. data/vendor/depot_tools/cpplint.py +195 -35
  29. data/vendor/depot_tools/detect_host_arch.py +51 -0
  30. data/vendor/depot_tools/download_from_google_storage.py +85 -26
  31. data/vendor/depot_tools/fetch.py +11 -6
  32. data/vendor/depot_tools/fetch_configs/chromium.py +0 -1
  33. data/vendor/depot_tools/fetch_configs/goma_client.py +41 -0
  34. data/vendor/depot_tools/fetch_configs/infra.py +0 -1
  35. data/vendor/depot_tools/fetch_configs/infra_internal.py +0 -1
  36. data/vendor/depot_tools/gclient-new-workdir.py +4 -0
  37. data/vendor/depot_tools/gclient.py +732 -476
  38. data/vendor/depot_tools/gclient_eval.py +569 -58
  39. data/vendor/depot_tools/gclient_scm.py +258 -46
  40. data/vendor/depot_tools/gclient_utils.py +17 -1
  41. data/vendor/depot_tools/gerrit_util.py +46 -13
  42. data/vendor/depot_tools/git_cache.py +0 -2
  43. data/vendor/depot_tools/git_cl.py +176 -335
  44. data/vendor/depot_tools/git_common.py +19 -16
  45. data/vendor/depot_tools/git_footers.py +19 -5
  46. data/vendor/depot_tools/git_hyper_blame.py +9 -3
  47. data/vendor/depot_tools/git_new_branch.py +15 -3
  48. data/vendor/depot_tools/git_upstream_diff.py +7 -2
  49. data/vendor/depot_tools/gsutil.py +1 -1
  50. data/vendor/depot_tools/infra/config/cq.cfg +1 -2
  51. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  52. data/vendor/depot_tools/luci-auth +13 -0
  53. data/vendor/depot_tools/luci-auth.bat +8 -0
  54. data/vendor/depot_tools/man/html/depot_tools.html +0 -8
  55. data/vendor/depot_tools/man/html/git-upstream-diff.html +20 -3
  56. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +27 -6
  57. data/vendor/depot_tools/man/man7/depot_tools.7 +0 -5
  58. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +2 -2
  59. data/vendor/depot_tools/man/src/git-upstream-diff.txt +21 -3
  60. data/vendor/depot_tools/man/src/make_docs.sh +6 -0
  61. data/vendor/depot_tools/my_activity.py +283 -93
  62. data/vendor/depot_tools/owners.py +9 -4
  63. data/vendor/depot_tools/owners_finder.py +7 -3
  64. data/vendor/depot_tools/post_build_ninja_summary.py +322 -0
  65. data/vendor/depot_tools/presubmit_canned_checks.py +91 -106
  66. data/vendor/depot_tools/presubmit_support.py +219 -157
  67. data/vendor/depot_tools/prpc +13 -0
  68. data/vendor/depot_tools/prpc.bat +8 -0
  69. data/vendor/depot_tools/recipes/OWNERS +3 -1
  70. data/vendor/depot_tools/recipes/README.recipes.md +70 -111
  71. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +12 -5
  72. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +36 -68
  73. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +0 -8
  74. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_json.json → no_apply_patch_on_gclient.json} +64 -10
  75. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{no_shallow.json → shallow.json} +1 -1
  76. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +0 -8
  77. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +0 -8
  78. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +0 -6
  79. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +0 -7
  80. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +0 -6
  81. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +44 -0
  82. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_buildbot.json → tryjob_gerrit_branch_heads.json} +51 -5
  83. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +0 -8
  84. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +48 -8
  85. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +19 -26
  86. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +193 -155
  87. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +9 -0
  88. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +2 -7
  89. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +31 -5
  90. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +37 -19
  91. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +37 -19
  92. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +37 -19
  93. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +37 -23
  94. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +4 -0
  95. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +40 -8
  96. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +3 -3
  97. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +6 -3
  98. data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +0 -1
  99. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +0 -1
  100. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +7 -56
  101. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +0 -1
  102. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +15 -16
  103. data/vendor/depot_tools/recipes/recipes.py +4 -2
  104. data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +12 -0
  105. data/vendor/depot_tools/roll_dep.py +35 -37
  106. data/vendor/depot_tools/support/chromite_wrapper +1 -1
  107. data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +3 -3
  108. data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +2 -2
  109. data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +86 -0
  110. data/vendor/depot_tools/third_party/logilab/astroid/bases.py +53 -66
  111. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +31 -31
  112. data/vendor/depot_tools/third_party/logilab/astroid/brain/pynose.py +39 -16
  113. data/vendor/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py +225 -189
  114. data/vendor/depot_tools/third_party/logilab/astroid/inference.py +45 -41
  115. data/vendor/depot_tools/third_party/logilab/astroid/manager.py +1 -0
  116. data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +2 -2
  117. data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +3 -2
  118. data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +1 -0
  119. data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +57 -3
  120. data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +1 -1
  121. data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +21 -1
  122. data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +58 -33
  123. data/vendor/depot_tools/third_party/pylint/README.chromium +2 -2
  124. data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +3 -3
  125. data/vendor/depot_tools/third_party/pylint/checkers/base.py +6 -18
  126. data/vendor/depot_tools/third_party/pylint/checkers/classes.py +64 -63
  127. data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +25 -57
  128. data/vendor/depot_tools/third_party/pylint/checkers/format.py +14 -10
  129. data/vendor/depot_tools/third_party/pylint/checkers/python3.py +142 -37
  130. data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +10 -1
  131. data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +50 -7
  132. data/vendor/depot_tools/third_party/pylint/checkers/strings.py +1 -1
  133. data/vendor/depot_tools/third_party/pylint/epylint.py +2 -1
  134. data/vendor/depot_tools/third_party/pylint/gui.py +1 -1
  135. data/vendor/depot_tools/third_party/pylint/lint.py +88 -23
  136. data/vendor/depot_tools/third_party/pylint/reporters/html.py +37 -5
  137. data/vendor/depot_tools/third_party/pylint/testutils.py +1 -1
  138. data/vendor/depot_tools/third_party/pylint/utils.py +5 -0
  139. data/vendor/depot_tools/vpython +31 -1
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +35 -2
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +0 -15
  142. data/vendor/depot_tools/yapf +17 -0
  143. data/vendor/depot_tools/{apply_issue.bat → yapf.bat} +2 -2
  144. metadata +16 -58
  145. data/ext/libv8/compiler.rb +0 -39
  146. data/ext/libv8/compiler/apple_llvm.rb +0 -22
  147. data/ext/libv8/compiler/clang.rb +0 -22
  148. data/ext/libv8/compiler/gcc.rb +0 -22
  149. data/ext/libv8/compiler/generic_compiler.rb +0 -66
  150. data/ext/libv8/make.rb +0 -13
  151. data/ext/libv8/patcher.rb +0 -21
  152. data/patches/0001-Build-a-standalone-static-library.patch +0 -26
  153. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +0 -85
  154. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +0 -25
  155. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +0 -25
  156. data/patches/0005-Remove-TryInstallOptimizedCode.patch +0 -321
  157. data/patches/mingw-generate-makefiles.sh +0 -97
  158. data/spec/compiler/apple_llvm_spec.rb +0 -37
  159. data/spec/compiler/clang_spec.rb +0 -37
  160. data/spec/compiler/gcc_spec.rb +0 -37
  161. data/spec/compiler/generic_compiler_spec.rb +0 -50
  162. data/spec/compiler_spec.rb +0 -45
  163. data/spec/support/compiler_helpers.rb +0 -47
  164. data/vendor/depot_tools/apply_issue +0 -8
  165. data/vendor/depot_tools/apply_issue.py +0 -315
  166. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +0 -815
  167. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +0 -80
  168. data/vendor/depot_tools/man/src/_git-cherry-pick-upload_desc.helper.txt +0 -1
  169. data/vendor/depot_tools/man/src/git-cherry-pick-upload.demo.1.sh +0 -17
  170. data/vendor/depot_tools/man/src/git-cherry-pick-upload.txt +0 -35
  171. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2.json +0 -8
  172. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +0 -196
  173. data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -6
  174. data/vendor/depot_tools/recipes/recipe_modules/rietveld/api.py +0 -97
  175. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +0 -8
  176. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +0 -30
  177. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +0 -27
  178. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.py +0 -38
  179. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +0 -69
  180. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +0 -69
  181. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -2
  182. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +0 -2
  183. data/vendor/depot_tools/third_party/cq_client/README.md +0 -59
  184. data/vendor/depot_tools/third_party/cq_client/__init__.py +0 -3
  185. data/vendor/depot_tools/third_party/cq_client/v1/__init__.py +0 -3
  186. data/vendor/depot_tools/third_party/cq_client/v1/cq.pb.go +0 -810
  187. data/vendor/depot_tools/third_party/cq_client/v1/cq.proto +0 -281
  188. data/vendor/depot_tools/third_party/cq_client/v1/cq_pb2.py +0 -794
  189. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_both.cfg +0 -71
  190. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_gerrit.cfg +0 -58
  191. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_rietveld.cfg +0 -60
  192. data/vendor/depot_tools/third_party/cq_client/v2/__init__.py +0 -3
  193. data/vendor/depot_tools/third_party/cq_client/v2/cq.pb.go +0 -792
  194. data/vendor/depot_tools/third_party/cq_client/v2/cq.proto +0 -270
  195. data/vendor/depot_tools/third_party/cq_client/v2/cq_pb2.py +0 -841
@@ -1,4 +1,48 @@
1
1
  [
2
+ {
3
+ "cmd": [
4
+ "python",
5
+ "-u",
6
+ "RECIPE_PACKAGE_REPO[depot_tools]/gerrit_client.py",
7
+ "changes",
8
+ "--host",
9
+ "https://chromium-review.googlesource.com",
10
+ "--json_file",
11
+ "/path/to/tmp/json",
12
+ "--limit",
13
+ "1",
14
+ "-p",
15
+ "change=456789"
16
+ ],
17
+ "env": {
18
+ "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
19
+ },
20
+ "infra_step": true,
21
+ "name": "gerrit get_patch_destination_branch",
22
+ "~followup_annotations": [
23
+ "@@@STEP_LOG_LINE@json.output@[@@@",
24
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
25
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"91827\", @@@",
26
+ "@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
27
+ "@@@STEP_LOG_LINE@json.output@ \"change_id\": \"Ideadbeef\", @@@",
28
+ "@@@STEP_LOG_LINE@json.output@ \"created\": \"2017-01-30 13:11:20.000000000\", @@@",
29
+ "@@@STEP_LOG_LINE@json.output@ \"has_review_started\": false, @@@",
30
+ "@@@STEP_LOG_LINE@json.output@ \"project\": \"chromium/src\", @@@",
31
+ "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
32
+ "@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
33
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"1\", @@@",
34
+ "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
35
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"Change commit message\"@@@",
36
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
37
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
38
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
39
+ "@@@STEP_LOG_LINE@json.output@ \"status\": \"NEW\", @@@",
40
+ "@@@STEP_LOG_LINE@json.output@ \"subject\": \"Change title\"@@@",
41
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
42
+ "@@@STEP_LOG_LINE@json.output@]@@@",
43
+ "@@@STEP_LOG_END@json.output@@@"
44
+ ]
45
+ },
2
46
  {
3
47
  "cmd": [
4
48
  "python",
@@ -1,4 +1,48 @@
1
1
  [
2
+ {
3
+ "cmd": [
4
+ "python",
5
+ "-u",
6
+ "RECIPE_PACKAGE_REPO[depot_tools]/gerrit_client.py",
7
+ "changes",
8
+ "--host",
9
+ "https://chromium-review.googlesource.com",
10
+ "--json_file",
11
+ "/path/to/tmp/json",
12
+ "--limit",
13
+ "1",
14
+ "-p",
15
+ "change=338811"
16
+ ],
17
+ "env": {
18
+ "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
19
+ },
20
+ "infra_step": true,
21
+ "name": "gerrit get_patch_destination_branch",
22
+ "~followup_annotations": [
23
+ "@@@STEP_LOG_LINE@json.output@[@@@",
24
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
25
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"91827\", @@@",
26
+ "@@@STEP_LOG_LINE@json.output@ \"branch\": \"refs/branch-heads/67\", @@@",
27
+ "@@@STEP_LOG_LINE@json.output@ \"change_id\": \"Ideadbeef\", @@@",
28
+ "@@@STEP_LOG_LINE@json.output@ \"created\": \"2017-01-30 13:11:20.000000000\", @@@",
29
+ "@@@STEP_LOG_LINE@json.output@ \"has_review_started\": false, @@@",
30
+ "@@@STEP_LOG_LINE@json.output@ \"project\": \"chromium/src\", @@@",
31
+ "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
32
+ "@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
33
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"1\", @@@",
34
+ "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
35
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"Change commit message\"@@@",
36
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
37
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
38
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
39
+ "@@@STEP_LOG_LINE@json.output@ \"status\": \"NEW\", @@@",
40
+ "@@@STEP_LOG_LINE@json.output@ \"subject\": \"Change title\"@@@",
41
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
42
+ "@@@STEP_LOG_LINE@json.output@]@@@",
43
+ "@@@STEP_LOG_END@json.output@@@"
44
+ ]
45
+ },
2
46
  {
3
47
  "cmd": [
4
48
  "python",
@@ -14,14 +58,16 @@
14
58
  "[GIT_CACHE]",
15
59
  "--cleanup-dir",
16
60
  "[CLEANUP]/bot_update",
17
- "--apply_issue_email_file",
18
- "[BUILD]/site_config/.rietveld_client_email",
19
- "--apply_issue_key_file",
20
- "[BUILD]/site_config/.rietveld_secret_key",
61
+ "--gerrit_repo",
62
+ "https://chromium.googlesource.com/chromium/src",
63
+ "--gerrit_ref",
64
+ "refs/changes/11/338811/3",
21
65
  "--output_json",
22
66
  "/path/to/tmp/json",
23
67
  "--revision",
24
- "src@HEAD",
68
+ "src@refs/branch-heads/67",
69
+ "--refs",
70
+ "refs/branch-heads/67",
25
71
  "--disable-syntax-validation"
26
72
  ],
27
73
  "env_prefixes": {
@@ -14,12 +14,6 @@
14
14
  "[GIT_CACHE]",
15
15
  "--cleanup-dir",
16
16
  "[CLEANUP]/bot_update",
17
- "--issue",
18
- "12345",
19
- "--patchset",
20
- "654321",
21
- "--rietveld_server",
22
- "https://rietveld.example.com/",
23
17
  "--output_json",
24
18
  "/path/to/tmp/json",
25
19
  "--revision",
@@ -121,8 +115,6 @@
121
115
  "[GIT_CACHE]",
122
116
  "--cleanup-dir",
123
117
  "[CLEANUP]/bot_update",
124
- "--rietveld_server",
125
- "https://rietveld.example.com/",
126
118
  "--output_json",
127
119
  "/path/to/tmp/json",
128
120
  "--revision",
@@ -1,4 +1,48 @@
1
1
  [
2
+ {
3
+ "cmd": [
4
+ "python",
5
+ "-u",
6
+ "RECIPE_PACKAGE_REPO[depot_tools]/gerrit_client.py",
7
+ "changes",
8
+ "--host",
9
+ "https://chromium-review.googlesource.com",
10
+ "--json_file",
11
+ "/path/to/tmp/json",
12
+ "--limit",
13
+ "1",
14
+ "-p",
15
+ "change=456789"
16
+ ],
17
+ "env": {
18
+ "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"
19
+ },
20
+ "infra_step": true,
21
+ "name": "gerrit get_patch_destination_branch",
22
+ "~followup_annotations": [
23
+ "@@@STEP_LOG_LINE@json.output@[@@@",
24
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
25
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"91827\", @@@",
26
+ "@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\", @@@",
27
+ "@@@STEP_LOG_LINE@json.output@ \"change_id\": \"Ideadbeef\", @@@",
28
+ "@@@STEP_LOG_LINE@json.output@ \"created\": \"2017-01-30 13:11:20.000000000\", @@@",
29
+ "@@@STEP_LOG_LINE@json.output@ \"has_review_started\": false, @@@",
30
+ "@@@STEP_LOG_LINE@json.output@ \"project\": \"chromium/src\", @@@",
31
+ "@@@STEP_LOG_LINE@json.output@ \"revisions\": {@@@",
32
+ "@@@STEP_LOG_LINE@json.output@ \"184ebe53805e102605d11f6b143486d15c23a09c\": {@@@",
33
+ "@@@STEP_LOG_LINE@json.output@ \"_number\": \"1\", @@@",
34
+ "@@@STEP_LOG_LINE@json.output@ \"commit\": {@@@",
35
+ "@@@STEP_LOG_LINE@json.output@ \"message\": \"Change commit message\"@@@",
36
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
37
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
38
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
39
+ "@@@STEP_LOG_LINE@json.output@ \"status\": \"NEW\", @@@",
40
+ "@@@STEP_LOG_LINE@json.output@ \"subject\": \"Change title\"@@@",
41
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
42
+ "@@@STEP_LOG_LINE@json.output@]@@@",
43
+ "@@@STEP_LOG_END@json.output@@@"
44
+ ]
45
+ },
2
46
  {
3
47
  "cmd": [
4
48
  "python",
@@ -14,12 +58,10 @@
14
58
  "[GIT_CACHE]",
15
59
  "--cleanup-dir",
16
60
  "[CLEANUP]/bot_update",
17
- "--issue",
18
- "12853011",
19
- "--patchset",
20
- "1",
21
- "--rietveld_server",
22
- "https://codereview.chromium.org",
61
+ "--gerrit_repo",
62
+ "https://chromium.googlesource.com/chromium/src",
63
+ "--gerrit_ref",
64
+ "refs/changes/89/456789/12",
23
65
  "--output_json",
24
66
  "/path/to/tmp/json",
25
67
  "--revision",
@@ -121,8 +163,6 @@
121
163
  "[GIT_CACHE]",
122
164
  "--cleanup-dir",
123
165
  "[CLEANUP]/bot_update",
124
- "--rietveld_server",
125
- "https://codereview.chromium.org",
126
166
  "--output_json",
127
167
  "/path/to/tmp/json",
128
168
  "--revision",
@@ -40,12 +40,10 @@ def RunSteps(api):
40
40
 
41
41
  patch = api.properties.get('patch', True)
42
42
  clobber = True if api.properties.get('clobber') else False
43
- no_shallow = True if api.properties.get('no_shallow') else False
43
+ no_shallow = True if api.properties.get('no_shallow', 1) else False
44
44
  with_branch_heads = api.properties.get('with_branch_heads', False)
45
45
  with_tags = api.properties.get('with_tags', False)
46
46
  refs = api.properties.get('refs', [])
47
- oauth2 = api.properties.get('oauth2', False)
48
- oauth2_json = api.properties.get('oauth2_json', False)
49
47
  root_solution_revision = api.properties.get('root_solution_revision')
50
48
  suffix = api.properties.get('suffix')
51
49
  gerrit_no_reset = True if api.properties.get('gerrit_no_reset') else False
@@ -75,8 +73,7 @@ def RunSteps(api):
75
73
  patch=patch,
76
74
  with_branch_heads=with_branch_heads,
77
75
  with_tags=with_tags,
78
- refs=refs, patch_oauth2=oauth2,
79
- oauth2_json=oauth2_json,
76
+ refs=refs,
80
77
  clobber=clobber,
81
78
  root_solution_revision=root_solution_revision,
82
79
  suffix=suffix,
@@ -134,25 +131,6 @@ def GenTests(api):
134
131
  yield api.test('trychange') + api.properties(
135
132
  refs=['+refs/change/1/2/333'],
136
133
  )
137
- yield api.test('trychange_oauth2') + api.properties(
138
- oauth2=True,
139
- )
140
- yield api.test('trychange_oauth2_buildbot') + api.properties(
141
- path_config='buildbot',
142
- oauth2=True,
143
- )
144
- yield api.test('trychange_oauth2_json') + api.properties(
145
- mastername='tryserver.chromium.linux',
146
- buildername='linux_rel',
147
- slavename='totallyaslave-c4',
148
- oauth2_json=True,
149
- )
150
- yield api.test('trychange_oauth2_json_win') + api.properties(
151
- mastername='tryserver.chromium.win',
152
- buildername='win_rel',
153
- slavename='totallyaslave-c4',
154
- oauth2_json=True,
155
- ) + api.platform('win', 64)
156
134
  yield api.test('tryjob_fail') + api.properties(
157
135
  issue=12345,
158
136
  patchset=654321,
@@ -170,8 +148,8 @@ def GenTests(api):
170
148
  rietveld='https://rietveld.example.com/',
171
149
  fail_patch='download'
172
150
  ) + api.step_data('bot_update', retcode=87)
173
- yield api.test('no_shallow') + api.properties(
174
- no_shallow=1
151
+ yield api.test('shallow') + api.properties(
152
+ no_shallow=0
175
153
  )
176
154
  yield api.test('clobber') + api.properties(
177
155
  clobber=1
@@ -215,6 +193,13 @@ def GenTests(api):
215
193
  patch_issue=338811,
216
194
  patch_set=3,
217
195
  )
196
+ yield api.test('no_apply_patch_on_gclient') + api.properties.tryserver(
197
+ gerrit_project='angle/angle',
198
+ patch_issue=338811,
199
+ patch_set=3,
200
+ ) + api.bot_update.properties(
201
+ apply_patch_on_gclient=False,
202
+ )
218
203
  yield api.test('tryjob_gerrit_v8') + api.properties.tryserver(
219
204
  gerrit_project='v8/v8',
220
205
  patch_issue=338811,
@@ -237,6 +222,14 @@ def GenTests(api):
237
222
  'gerrit get_patch_destination_branch',
238
223
  api.gerrit.get_one_change_response_data(branch='experimental/feature'),
239
224
  )
225
+ yield api.test('tryjob_gerrit_branch_heads') + api.properties.tryserver(
226
+ gerrit_project='chromium/src',
227
+ patch_issue=338811,
228
+ patch_set=3,
229
+ ) + api.step_data(
230
+ 'gerrit get_patch_destination_branch',
231
+ api.gerrit.get_one_change_response_data(branch='refs/branch-heads/67'),
232
+ )
240
233
  yield api.test('tryjob_gerrit_angle_deprecated') + api.properties.tryserver(
241
234
  patch_project='angle/angle',
242
235
  gerrit='https://chromium-review.googlesource.com',
@@ -7,6 +7,7 @@
7
7
 
8
8
  import cStringIO
9
9
  import codecs
10
+ from contextlib import contextmanager
10
11
  import copy
11
12
  import ctypes
12
13
  import json
@@ -41,6 +42,9 @@ CHROMIUM_SRC_URL = CHROMIUM_GIT_HOST + '/chromium/src.git'
41
42
  BRANCH_HEADS_REFSPEC = '+refs/branch-heads/*'
42
43
  TAGS_REFSPEC = '+refs/tags/*'
43
44
 
45
+ # Regular expression to match sha1 git revision.
46
+ COMMIT_HASH_RE = re.compile(r'[0-9a-f]{5,40}', re.IGNORECASE)
47
+
44
48
  # Regular expression that matches a single commit footer line.
45
49
  COMMIT_FOOTER_ENTRY_RE = re.compile(r'([^:]+):\s*(.*)')
46
50
 
@@ -51,6 +55,9 @@ COMMIT_ORIGINAL_POSITION_FOOTER_KEY = 'Cr-Original-Commit-Position'
51
55
  # Regular expression to parse gclient's revinfo entries.
52
56
  REVINFO_RE = re.compile(r'^([^:]+):\s+([^@]+)@(.+)$')
53
57
 
58
+ # Regular expression to match gclient's patch error message.
59
+ PATCH_ERROR_RE = re.compile('Failed to apply .* @ .* to .* at .*')
60
+
54
61
  # Copied from scripts/recipes/chromium.py.
55
62
  GOT_REVISION_MAPPINGS = {
56
63
  CHROMIUM_SRC_URL: {
@@ -70,6 +77,7 @@ GCLIENT_TEMPLATE = """solutions = %(solutions)s
70
77
  cache_dir = r%(cache_dir)s
71
78
  %(target_os)s
72
79
  %(target_os_only)s
80
+ %(target_cpu)s
73
81
  """
74
82
 
75
83
 
@@ -142,7 +150,7 @@ def call(*args, **kwargs): # pragma: no cover
142
150
  kwargs['stdin'] = subprocess.PIPE
143
151
  out = cStringIO.StringIO()
144
152
  new_env = kwargs.get('env', {})
145
- env = copy.copy(os.environ)
153
+ env = os.environ.copy()
146
154
  env.update(new_env)
147
155
  kwargs['env'] = env
148
156
 
@@ -209,12 +217,14 @@ def git(*args, **kwargs): # pragma: no cover
209
217
  return call(*cmd, **kwargs)
210
218
 
211
219
 
212
- def get_gclient_spec(solutions, target_os, target_os_only, git_cache_dir):
220
+ def get_gclient_spec(solutions, target_os, target_os_only, target_cpu,
221
+ git_cache_dir):
213
222
  return GCLIENT_TEMPLATE % {
214
223
  'solutions': pprint.pformat(solutions, indent=4),
215
224
  'cache_dir': '"%s"' % git_cache_dir,
216
225
  'target_os': ('\ntarget_os=%s' % target_os) if target_os else '',
217
- 'target_os_only': '\ntarget_os_only=%s' % target_os_only
226
+ 'target_os_only': '\ntarget_os_only=%s' % target_os_only,
227
+ 'target_cpu': ('\ntarget_cpu=%s' % target_cpu) if target_cpu else ''
218
228
  }
219
229
 
220
230
 
@@ -314,16 +324,36 @@ def call_gclient(*args, **kwargs):
314
324
  return call(*cmd, **kwargs)
315
325
 
316
326
 
317
- def gclient_configure(solutions, target_os, target_os_only, git_cache_dir):
327
+ def gclient_configure(solutions, target_os, target_os_only, target_cpu,
328
+ git_cache_dir):
318
329
  """Should do the same thing as gclient --spec='...'."""
319
330
  with codecs.open('.gclient', mode='w', encoding='utf-8') as f:
320
331
  f.write(get_gclient_spec(
321
- solutions, target_os, target_os_only, git_cache_dir))
332
+ solutions, target_os, target_os_only, target_cpu, git_cache_dir))
333
+
334
+
335
+ @contextmanager
336
+ def git_config_if_not_set(key, value):
337
+ """Set git config for key equal to value if key was not set.
338
+
339
+ If key was not set, unset it once we're done."""
340
+ should_unset = True
341
+ try:
342
+ git('config', '--global', key)
343
+ should_unset = False
344
+ except SubprocessFailed as e:
345
+ git('config', '--global', key, value)
346
+ try:
347
+ yield
348
+ finally:
349
+ if should_unset:
350
+ git('config', '--global', '--unset', key)
322
351
 
323
352
 
324
353
  def gclient_sync(
325
354
  with_branch_heads, with_tags, shallow, revisions, break_repo_locks,
326
- disable_syntax_validation):
355
+ disable_syntax_validation, gerrit_repo, gerrit_ref, gerrit_reset,
356
+ gerrit_rebase_patch_ref, apply_patch_on_gclient):
327
357
  # We just need to allocate a filename.
328
358
  fd, gclient_output_file = tempfile.mkstemp(suffix='.json')
329
359
  os.close(fd)
@@ -346,9 +376,22 @@ def gclient_sync(
346
376
  revision = 'origin/master'
347
377
  args.extend(['--revision', '%s@%s' % (name, revision)])
348
378
 
379
+ if apply_patch_on_gclient and gerrit_repo and gerrit_ref:
380
+ # TODO(ehmaldonado): Merge gerrit_repo and gerrit_ref into a patch-ref flag
381
+ # and add support for passing multiple patch refs.
382
+ args.extend(['--patch-ref', gerrit_repo + '@' + gerrit_ref])
383
+ if not gerrit_reset:
384
+ args.append('--no-reset-patch-ref')
385
+ if not gerrit_rebase_patch_ref:
386
+ args.append('--no-rebase-patch-ref')
387
+
349
388
  try:
350
389
  call_gclient(*args)
351
390
  except SubprocessFailed as e:
391
+ # If gclient sync is handling patching, parse the output for a patch error
392
+ # message.
393
+ if apply_patch_on_gclient and PATCH_ERROR_RE.search(e.output):
394
+ raise PatchFailed(e.message, e.code, e.output)
352
395
  # Throw a GclientSyncFailed exception so we can catch this independently.
353
396
  raise GclientSyncFailed(e.message, e.code, e.output)
354
397
  else:
@@ -414,7 +457,7 @@ def create_manifest(gclient_output, patch_root, gerrit_ref):
414
457
  the directory -> repo:revision mapping.
415
458
  * Gerrit Patch info which contains info about patched revisions.
416
459
 
417
- We normalize the URLs such that if they are googlesource.com urls, they:
460
+ We normalize the URLs using the normalize_git_url function.
418
461
  """
419
462
  manifest = {
420
463
  'version': 0, # Currently the only valid version is 0.
@@ -424,19 +467,16 @@ def create_manifest(gclient_output, patch_root, gerrit_ref):
424
467
  patch_root = patch_root.strip('/') # Normalize directory names.
425
468
  for directory, info in gclient_output.get('solutions', {}).iteritems():
426
469
  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
470
  # The format of the url is "https://repo.url/blah.git@abcdefabcdef" or
433
471
  # 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:
472
+ url = info.get('url') or ''
473
+ repo, _, url_revision = url.partition('@')
474
+ repo = normalize_git_url(repo)
475
+ # There are two places to get the revision from, we do it in this order:
476
+ # 1. In the "revision" field
477
+ # 2. At the end of the URL, after @
478
+ revision = info.get('revision') or url_revision
479
+ if repo and revision:
440
480
  dirs[directory] = {
441
481
  'git_checkout': {
442
482
  'repo_url': repo,
@@ -523,6 +563,15 @@ def _get_target_branch_and_revision(solution_name, git_url, revisions):
523
563
  return 'master', configured
524
564
 
525
565
 
566
+ def get_target_pin(solution_name, git_url, revisions):
567
+ """Returns revision to be checked out if it is pinned, else None."""
568
+ _, revision = _get_target_branch_and_revision(
569
+ solution_name, git_url, revisions)
570
+ if COMMIT_HASH_RE.match(revision):
571
+ return revision
572
+ return None
573
+
574
+
526
575
  def force_solution_revision(solution_name, git_url, revisions, cwd):
527
576
  branch, revision = _get_target_branch_and_revision(
528
577
  solution_name, git_url, revisions)
@@ -543,6 +592,18 @@ def force_solution_revision(solution_name, git_url, revisions, cwd):
543
592
  git('checkout', '--force', treeish, '--', cwd=cwd)
544
593
 
545
594
 
595
+ def _has_in_git_cache(revision_sha1, git_cache_dir, url):
596
+ """Returns whether given revision_sha1 is contained in cache of a given repo.
597
+ """
598
+ try:
599
+ mirror_dir = git(
600
+ 'cache', 'exists', '--quiet', '--cache-dir', git_cache_dir, url).strip()
601
+ git('cat-file', '-e', revision_sha1, cwd=mirror_dir)
602
+ return True
603
+ except SubprocessFailed:
604
+ return False
605
+
606
+
546
607
  def is_broken_repo_dir(repo_dir):
547
608
  # Treat absence of 'config' as a signal of a partially deleted repo.
548
609
  return not path.exists(os.path.join(repo_dir, '.git', 'config'))
@@ -606,20 +667,54 @@ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir,
606
667
  for ref in refs:
607
668
  populate_cmd.extend(['--ref', ref])
608
669
 
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.
670
+ env = {}
671
+ if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL:
672
+ # This is for performance investigation of `git fetch` in chromium/src.
673
+ env = {
674
+ 'GIT_TRACE': 'true',
675
+ 'GIT_TRACE_PERFORMANCE': 'true',
676
+ }
611
677
 
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()
678
+ # Step 1: populate/refresh cache, if necessary.
679
+ pin = get_target_pin(name, url, revisions)
680
+ if not pin:
681
+ # Refresh only once.
682
+ git(*populate_cmd, env=env)
683
+ elif _has_in_git_cache(pin, git_cache_dir, url):
684
+ # No need to fetch at all, because we already have needed revision.
685
+ pass
686
+ else:
687
+ # We may need to retry a bit due to eventual consinstency in replication of
688
+ # git servers.
689
+ soft_deadline = time.time() + 60
690
+ attempt = 0
691
+ while True:
692
+ attempt += 1
693
+ # TODO(tandrii): propagate the pin to git server per recommendation of
694
+ # maintainers of *.googlesource.com (workaround git server replication
695
+ # lag).
696
+ git(*populate_cmd, env=env)
697
+ if _has_in_git_cache(pin, git_cache_dir, url):
698
+ break
699
+ overrun = time.time() - soft_deadline
700
+ # Only kick in deadline after second attempt to ensure we retry at least
701
+ # once after initial fetch from not-yet-replicated server.
702
+ if attempt >= 2 and overrun > 0:
703
+ print 'Ran %s seconds past deadline. Aborting.' % (overrun,)
704
+ # TODO(tandrii): raise exception immediately here, instead of doing
705
+ # useless step 2 trying to fetch something that we know doesn't exist
706
+ # in cache **after production data gives us confidence to do so**.
707
+ break
708
+
709
+ sleep_secs = min(60, 2**attempt)
710
+ print 'waiting %s seconds and trying to fetch again...' % sleep_secs
711
+ time.sleep(sleep_secs)
622
712
 
713
+ # Step 2: populate a checkout from local cache. All operations are local.
714
+ mirror_dir = git(
715
+ 'cache', 'exists', '--quiet', '--cache-dir', git_cache_dir, url).strip()
716
+ first_try = True
717
+ while True:
623
718
  try:
624
719
  # If repo deletion was aborted midway, it may have left .git in broken
625
720
  # state.
@@ -631,7 +726,9 @@ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir,
631
726
  if not path.isdir(sln_dir):
632
727
  git('clone', '--no-checkout', '--local', '--shared', mirror_dir,
633
728
  sln_dir)
729
+ _git_disable_gc(sln_dir)
634
730
  else:
731
+ _git_disable_gc(sln_dir)
635
732
  git('remote', 'set-url', 'origin', mirror_dir, cwd=sln_dir)
636
733
  git('fetch', 'origin', cwd=sln_dir)
637
734
  for ref in refs:
@@ -650,20 +747,17 @@ def _git_checkout(sln, sln_dir, revisions, shallow, refs, git_cache_dir,
650
747
  except SubprocessFailed as e:
651
748
  # Exited abnormally, theres probably something wrong.
652
749
  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
750
+ if first_try:
751
+ first_try = False
752
+ # Lets wipe the checkout and try again.
753
+ remove(sln_dir, cleanup_dir)
754
+ else:
659
755
  raise
660
756
 
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)
757
+ def _git_disable_gc(cwd):
758
+ git('config', 'gc.auto', '0', cwd=cwd)
759
+ git('config', 'gc.autodetach', '0', cwd=cwd)
760
+ git('config', 'gc.autopacklimit', '0', cwd=cwd)
667
761
 
668
762
 
669
763
  def _download(url):
@@ -676,46 +770,6 @@ def _download(url):
676
770
  raise
677
771
 
678
772
 
679
- def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
680
- email_file, key_file, oauth2_file,
681
- whitelist=None, blacklist=None):
682
- apply_issue_bin = ('apply_issue.bat' if sys.platform.startswith('win')
683
- else 'apply_issue')
684
- cmd = [apply_issue_bin,
685
- # The patch will be applied on top of this directory.
686
- '--root_dir', root,
687
- # Tell apply_issue how to fetch the patch.
688
- '--issue', issue,
689
- '--server', server,
690
- # Always run apply_issue.py, otherwise it would see update.flag
691
- # and then bail out.
692
- '--force',
693
- # Don't run gclient sync when it sees a DEPS change.
694
- '--ignore_deps',
695
- ]
696
- # Use an oauth key or json file if specified.
697
- if oauth2_file:
698
- cmd.extend(['--auth-refresh-token-json', oauth2_file])
699
- elif email_file and key_file:
700
- cmd.extend(['--email-file', email_file, '--private-key-file', key_file])
701
- else:
702
- cmd.append('--no-auth')
703
-
704
- if patchset:
705
- cmd.extend(['--patchset', patchset])
706
- if whitelist:
707
- for item in whitelist:
708
- cmd.extend(['--whitelist', item])
709
- elif blacklist:
710
- for item in blacklist:
711
- cmd.extend(['--blacklist', item])
712
-
713
- # Only try once, since subsequent failures hide the real failure.
714
- try:
715
- call(*cmd)
716
- except SubprocessFailed as e:
717
- raise PatchFailed(e.message, e.code, e.output)
718
-
719
773
  def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset,
720
774
  gerrit_rebase_patch_ref):
721
775
  gerrit_repo = gerrit_repo or 'origin'
@@ -725,7 +779,7 @@ def apply_gerrit_ref(gerrit_repo, gerrit_ref, root, gerrit_reset,
725
779
  print '===Applying gerrit ref==='
726
780
  print 'Repo is %r @ %r, ref is %r, root is %r' % (
727
781
  gerrit_repo, base_rev, gerrit_ref, root)
728
- # TODO(tandrii): move the fix below to common rietveld/gerrit codepath.
782
+ # TODO(tandrii): move the fix below to common gerrit codepath.
729
783
  # Speculative fix: prior bot_update run with Rietveld patch may leave git
730
784
  # index with unmerged paths. bot_update calls 'checkout --force xyz' thus
731
785
  # ignoring such paths, but potentially never cleaning them up. The following
@@ -827,44 +881,37 @@ def emit_json(out_file, did_run, gclient_output=None, **kwargs):
827
881
 
828
882
 
829
883
  def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
830
- patch_root, issue, patchset, rietveld_server, gerrit_repo,
831
- gerrit_ref, gerrit_rebase_patch_ref, revision_mapping,
832
- apply_issue_email_file, apply_issue_key_file,
833
- apply_issue_oauth2_file, shallow, refs, git_cache_dir,
834
- cleanup_dir, gerrit_reset, disable_syntax_validation):
884
+ target_cpu, patch_root, gerrit_repo, gerrit_ref,
885
+ gerrit_rebase_patch_ref, shallow, refs, git_cache_dir,
886
+ cleanup_dir, gerrit_reset, disable_syntax_validation,
887
+ apply_patch_on_gclient):
835
888
  # Get a checkout of each solution, without DEPS or hooks.
836
889
  # Calling git directly because there is no way to run Gclient without
837
890
  # invoking DEPS.
838
891
  print 'Fetching Git checkout'
839
892
 
840
- git_ref = git_checkouts(solutions, revisions, shallow, refs, git_cache_dir,
841
- cleanup_dir)
893
+ git_checkouts(solutions, revisions, shallow, refs, git_cache_dir, cleanup_dir)
842
894
 
843
- print '===Processing patch solutions==='
844
- already_patched = []
845
- patch_root = patch_root or ''
846
895
  applied_gerrit_patch = False
847
- print 'Patch root is %r' % patch_root
848
- for solution in solutions:
849
- print 'Processing solution %r' % solution['name']
850
- if (patch_root == solution['name'] or
851
- solution['name'].startswith(patch_root + '/')):
852
- relative_root = solution['name'][len(patch_root) + 1:]
853
- target = '/'.join([relative_root, 'DEPS']).lstrip('/')
854
- print ' relative root is %r, target is %r' % (relative_root, target)
855
- if issue:
856
- apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
857
- revision_mapping, git_ref, apply_issue_email_file,
858
- apply_issue_key_file, apply_issue_oauth2_file,
859
- whitelist=[target])
860
- already_patched.append(target)
861
- elif gerrit_ref:
862
- apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset,
863
- gerrit_rebase_patch_ref)
864
- applied_gerrit_patch = True
896
+ if not apply_patch_on_gclient:
897
+ print '===Processing patch solutions==='
898
+ patch_root = patch_root or ''
899
+ print 'Patch root is %r' % patch_root
900
+ for solution in solutions:
901
+ print 'Processing solution %r' % solution['name']
902
+ if (patch_root == solution['name'] or
903
+ solution['name'].startswith(patch_root + '/')):
904
+ relative_root = solution['name'][len(patch_root) + 1:]
905
+ target = '/'.join([relative_root, 'DEPS']).lstrip('/')
906
+ print ' relative root is %r, target is %r' % (relative_root, target)
907
+ if gerrit_ref:
908
+ apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset,
909
+ gerrit_rebase_patch_ref)
910
+ applied_gerrit_patch = True
865
911
 
866
912
  # Ensure our build/ directory is set up with the correct .gclient file.
867
- gclient_configure(solutions, target_os, target_os_only, git_cache_dir)
913
+ gclient_configure(solutions, target_os, target_os_only, target_cpu,
914
+ git_cache_dir)
868
915
 
869
916
  # Windows sometimes has trouble deleting files. This can make git commands
870
917
  # that rely on locks fail.
@@ -879,16 +926,24 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
879
926
  # This forces gclient to always treat solutions deps as unmanaged.
880
927
  for solution_name in list(solution_dirs):
881
928
  gc_revisions[solution_name] = 'unmanaged'
882
- # Let gclient do the DEPS syncing.
883
- # The branch-head refspec is a special case because its possible Chrome
884
- # src, which contains the branch-head refspecs, is DEPSed in.
885
- gclient_output = gclient_sync(
886
- BRANCH_HEADS_REFSPEC in refs,
887
- TAGS_REFSPEC in refs,
888
- shallow,
889
- gc_revisions,
890
- break_repo_locks,
891
- disable_syntax_validation)
929
+
930
+ with git_config_if_not_set('user.name', 'chrome-bot'):
931
+ with git_config_if_not_set('user.email', 'chrome-bot@chromium.org'):
932
+ # Let gclient do the DEPS syncing.
933
+ # The branch-head refspec is a special case because its possible Chrome
934
+ # src, which contains the branch-head refspecs, is DEPSed in.
935
+ gclient_output = gclient_sync(
936
+ BRANCH_HEADS_REFSPEC in refs,
937
+ TAGS_REFSPEC in refs,
938
+ shallow,
939
+ gc_revisions,
940
+ break_repo_locks,
941
+ disable_syntax_validation,
942
+ gerrit_repo,
943
+ gerrit_ref,
944
+ gerrit_reset,
945
+ gerrit_rebase_patch_ref,
946
+ apply_patch_on_gclient)
892
947
 
893
948
  # Now that gclient_sync has finished, we should revert any .DEPS.git so that
894
949
  # presubmit doesn't complain about it being modified.
@@ -896,12 +951,7 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
896
951
  git('checkout', 'HEAD', '--', '.DEPS.git', cwd=first_sln)
897
952
 
898
953
  # Apply the rest of the patch here (sans DEPS)
899
- if issue:
900
- apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
901
- revision_mapping, git_ref, apply_issue_email_file,
902
- apply_issue_key_file, apply_issue_oauth2_file,
903
- blacklist=already_patched)
904
- elif gerrit_ref and not applied_gerrit_patch:
954
+ if gerrit_ref and not applied_gerrit_patch and not apply_patch_on_gclient:
905
955
  # If gerrit_ref was for solution's main repository, it has already been
906
956
  # applied above. This chunk is executed only for patches to DEPS-ed in
907
957
  # git repositories.
@@ -911,7 +961,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
911
961
  # Reset the deps_file point in the solutions so that hooks get run properly.
912
962
  for sln in solutions:
913
963
  sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS')
914
- gclient_configure(solutions, target_os, target_os_only, git_cache_dir)
964
+ gclient_configure(solutions, target_os, target_os_only, target_cpu,
965
+ git_cache_dir)
915
966
 
916
967
  return gclient_output
917
968
 
@@ -960,23 +1011,9 @@ def parse_revisions(revisions, root):
960
1011
  def parse_args():
961
1012
  parse = optparse.OptionParser()
962
1013
 
963
- parse.add_option('--issue', help='Issue number to patch from.')
964
- parse.add_option('--patchset',
965
- help='Patchset from issue to patch from, if applicable.')
966
- parse.add_option('--apply_issue_email_file',
967
- help='--email-file option passthrough for apply_patch.py.')
968
- parse.add_option('--apply_issue_key_file',
969
- help='--private-key-file option passthrough for '
970
- 'apply_patch.py.')
971
- parse.add_option('--apply_issue_oauth2_file',
972
- help='--auth-refresh-token-json option passthrough for '
973
- 'apply_patch.py.')
974
1014
  parse.add_option('--root', dest='patch_root',
975
1015
  help='DEPRECATED: Use --patch_root.')
976
1016
  parse.add_option('--patch_root', help='Directory to patch on top of.')
977
- parse.add_option('--rietveld_server',
978
- default='codereview.chromium.org',
979
- help='Rietveld server.')
980
1017
  parse.add_option('--gerrit_repo',
981
1018
  help='Gerrit repository to pull the ref from.')
982
1019
  parse.add_option('--gerrit_ref', help='Gerrit ref to apply.')
@@ -1001,9 +1038,9 @@ def parse_args():
1001
1038
  help='Delete checkout first, always')
1002
1039
  parse.add_option('--output_json',
1003
1040
  help='Output JSON information into a specified file')
1004
- parse.add_option('--no_shallow', action='store_true',
1005
- help='Bypass disk detection and never shallow clone. '
1006
- 'Does not override the --shallow flag')
1041
+ parse.add_option('--maybe_shallow', action='store_true',
1042
+ help='Enables turning on shallow mode if total disk '
1043
+ 'space is low.')
1007
1044
  parse.add_option('--refs', action='append',
1008
1045
  help='Also fetch this refspec for the main solution(s). '
1009
1046
  'Eg. +refs/branch-heads/*')
@@ -1020,6 +1057,10 @@ def parse_args():
1020
1057
  parse.add_option(
1021
1058
  '--disable-syntax-validation', action='store_true',
1022
1059
  help='Disable validation of .gclient and DEPS syntax.')
1060
+ parse.add_option('--no-apply-patch-on-gclient',
1061
+ dest='apply_patch_on_gclient', action='store_false',
1062
+ default=True,
1063
+ help='Patch the gerrit ref in gclient instead of here.')
1023
1064
 
1024
1065
  options, args = parse.parse_args()
1025
1066
 
@@ -1085,7 +1126,7 @@ def prepare(options, git_slns, active):
1085
1126
  total_disk_space_gb,
1086
1127
  percent_used)
1087
1128
  shallow = (total_disk_space < SHALLOW_CLONE_THRESHOLD
1088
- and not options.no_shallow)
1129
+ and options.maybe_shallow)
1089
1130
 
1090
1131
  # The first solution is where the primary DEPS file resides.
1091
1132
  first_sln = dir_names[0]
@@ -1119,18 +1160,14 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
1119
1160
  target_os=specs.get('target_os', []),
1120
1161
  target_os_only=specs.get('target_os_only', False),
1121
1162
 
1163
+ # Also, target cpu variables for gclient.
1164
+ target_cpu=specs.get('target_cpu', []),
1165
+
1122
1166
  # Then, pass in information about how to patch.
1123
1167
  patch_root=options.patch_root,
1124
- issue=options.issue,
1125
- patchset=options.patchset,
1126
- rietveld_server=options.rietveld_server,
1127
1168
  gerrit_repo=options.gerrit_repo,
1128
1169
  gerrit_ref=options.gerrit_ref,
1129
1170
  gerrit_rebase_patch_ref=not options.gerrit_no_rebase_patch_ref,
1130
- revision_mapping=options.revision_mapping,
1131
- apply_issue_email_file=options.apply_issue_email_file,
1132
- apply_issue_key_file=options.apply_issue_key_file,
1133
- apply_issue_oauth2_file=options.apply_issue_oauth2_file,
1134
1171
 
1135
1172
  # Finally, extra configurations such as shallowness of the clone.
1136
1173
  shallow=shallow,
@@ -1138,7 +1175,8 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
1138
1175
  git_cache_dir=options.git_cache_dir,
1139
1176
  cleanup_dir=options.cleanup_dir,
1140
1177
  gerrit_reset=not options.gerrit_no_reset,
1141
- disable_syntax_validation=options.disable_syntax_validation)
1178
+ disable_syntax_validation=options.disable_syntax_validation,
1179
+ apply_patch_on_gclient=options.apply_patch_on_gclient)
1142
1180
  gclient_output = ensure_checkout(**checkout_parameters)
1143
1181
  except GclientSyncFailed:
1144
1182
  print 'We failed gclient sync, lets delete the checkout and retry.'