libv8 6.7.288.46.1 → 7.3.492.27.0beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (408) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +4 -0
  4. data/README.md +2 -0
  5. data/ext/libv8/builder.rb +6 -2
  6. data/lib/libv8/version.rb +1 -1
  7. data/vendor/depot_tools/.gitattributes +1 -0
  8. data/vendor/depot_tools/.gitignore +7 -0
  9. data/vendor/depot_tools/CROS_OWNERS +5 -0
  10. data/vendor/depot_tools/OWNERS +12 -1
  11. data/vendor/depot_tools/PRESUBMIT.py +16 -9
  12. data/vendor/depot_tools/README.md +9 -2
  13. data/vendor/depot_tools/autoninja +14 -6
  14. data/vendor/depot_tools/autoninja.bat +11 -1
  15. data/vendor/depot_tools/autoninja.py +40 -18
  16. data/vendor/depot_tools/bb +12 -0
  17. data/vendor/depot_tools/bb.bat +7 -0
  18. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  19. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  20. data/vendor/depot_tools/bootstrap/win/win_tools.py +2 -1
  21. data/vendor/depot_tools/buildbucket.py +57 -4
  22. data/vendor/depot_tools/cipd +157 -44
  23. data/vendor/depot_tools/cipd.bat +51 -14
  24. data/vendor/depot_tools/cipd.ps1 +104 -42
  25. data/vendor/depot_tools/cipd_client_version +1 -1
  26. data/vendor/depot_tools/cipd_client_version.digests +21 -0
  27. data/vendor/depot_tools/cipd_manifest.txt +19 -6
  28. data/vendor/depot_tools/cipd_manifest.versions +318 -0
  29. data/vendor/depot_tools/clang_format.py +4 -4
  30. data/vendor/depot_tools/cpplint.py +44 -199
  31. data/vendor/depot_tools/dart_format.py +2 -2
  32. data/vendor/depot_tools/detect_host_arch.py +8 -3
  33. data/vendor/depot_tools/download_from_google_storage.py +47 -39
  34. data/vendor/depot_tools/fetch.py +30 -18
  35. data/vendor/depot_tools/fetch_configs/android_internal.py +34 -0
  36. data/vendor/depot_tools/fetch_configs/chromium.py +18 -1
  37. data/vendor/depot_tools/fetch_configs/config_util.py +4 -2
  38. data/vendor/depot_tools/fetch_configs/inspector_protocol.py +40 -0
  39. data/vendor/depot_tools/fetch_configs/node-ci.py +41 -0
  40. data/vendor/depot_tools/fix_encoding.py +3 -3
  41. data/vendor/depot_tools/gclient +1 -1
  42. data/vendor/depot_tools/gclient.py +415 -198
  43. data/vendor/depot_tools/gclient_eval.py +220 -171
  44. data/vendor/depot_tools/gclient_paths.py +142 -0
  45. data/vendor/depot_tools/gclient_scm.py +200 -51
  46. data/vendor/depot_tools/gclient_utils.py +88 -191
  47. data/vendor/depot_tools/gerrit_client.py +13 -0
  48. data/vendor/depot_tools/gerrit_util.py +158 -23
  49. data/vendor/depot_tools/git-nav-upstream +1 -1
  50. data/vendor/depot_tools/git_cache.py +77 -24
  51. data/vendor/depot_tools/git_cl.py +705 -1099
  52. data/vendor/depot_tools/git_common.py +9 -6
  53. data/vendor/depot_tools/git_map_branches.py +19 -2
  54. data/vendor/depot_tools/git_nav_downstream.py +3 -4
  55. data/vendor/depot_tools/git_rebase_update.py +14 -0
  56. data/vendor/depot_tools/git_reparent_branch.py +8 -2
  57. data/vendor/depot_tools/gn.py +38 -3
  58. data/vendor/depot_tools/gsutil.py +8 -3
  59. data/vendor/depot_tools/gsutil.py.bat +15 -0
  60. data/vendor/depot_tools/gsutil.vpython +16 -0
  61. data/vendor/depot_tools/infra/config/OWNERS +0 -1
  62. data/vendor/depot_tools/infra/config/recipes.cfg +3 -2
  63. data/vendor/depot_tools/lucicfg +12 -0
  64. data/vendor/depot_tools/lucicfg.bat +7 -0
  65. data/vendor/depot_tools/man/html/git-map-branches.html +34 -2
  66. data/vendor/depot_tools/man/html/git-new-branch.html +40 -32
  67. data/vendor/depot_tools/man/man1/git-map-branches.1 +24 -5
  68. data/vendor/depot_tools/man/man1/git-new-branch.1 +35 -27
  69. data/vendor/depot_tools/man/src/git-map-branches.demo.1.sh +1 -0
  70. data/vendor/depot_tools/man/src/git-map-branches.txt +10 -0
  71. data/vendor/depot_tools/man/src/git-new-branch.demo.1.sh +9 -4
  72. data/vendor/depot_tools/man/src/git-new-branch.txt +1 -1
  73. data/vendor/depot_tools/metrics.README.md +98 -0
  74. data/vendor/depot_tools/metrics.py +296 -0
  75. data/vendor/depot_tools/metrics_utils.py +303 -0
  76. data/vendor/depot_tools/my_activity.py +91 -29
  77. data/vendor/depot_tools/ninja +1 -1
  78. data/vendor/depot_tools/ninjalog.README.md +64 -0
  79. data/vendor/depot_tools/ninjalog_uploader.py +232 -0
  80. data/vendor/depot_tools/ninjalog_uploader_wrapper.py +116 -0
  81. data/vendor/depot_tools/owners.py +30 -13
  82. data/vendor/depot_tools/owners_finder.py +5 -2
  83. data/vendor/depot_tools/presubmit_canned_checks.py +188 -29
  84. data/vendor/depot_tools/presubmit_support.py +18 -41
  85. data/vendor/depot_tools/pylintrc +23 -19
  86. data/vendor/depot_tools/recipes/OWNERS +2 -0
  87. data/vendor/depot_tools/recipes/README.recipes.md +344 -151
  88. data/vendor/depot_tools/recipes/recipe_modules/bot_update/OWNERS +2 -0
  89. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +2 -16
  90. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +141 -99
  91. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +5 -8
  92. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +5 -8
  93. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +6 -98
  94. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +4 -9
  95. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +45 -5
  96. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +4 -9
  97. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +4 -9
  98. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{tryjob.json → input_commit_with_id_without_repo.json} +6 -11
  99. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{tryjob_empty_revision.json → multiple_patch_refs.json} +8 -9
  100. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json +19 -29
  101. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange.json → refs.json} +4 -9
  102. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +4 -9
  103. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +51 -6
  104. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +50 -6
  105. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +51 -6
  106. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +17 -25
  107. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json +17 -25
  108. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +18 -26
  109. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +18 -26
  110. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +26 -28
  111. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +45 -5
  112. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +17 -25
  113. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +13 -0
  114. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json +13 -152
  115. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +4 -9
  116. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +185 -202
  117. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +52 -157
  118. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +5 -14
  119. data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/ensure_checkout.py +34 -0
  120. data/vendor/depot_tools/recipes/recipe_modules/cipd/api.py +14 -2
  121. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic.json +4 -5
  122. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic_pkg.json +4 -5
  123. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +7 -5
  124. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-many-instances.json +4 -5
  125. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/mac64.json +4 -5
  126. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +9 -3
  127. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +9 -3
  128. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +9 -3
  129. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/win64.json +4 -5
  130. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk arch.json +2 -3
  131. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk bits.json +2 -3
  132. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_32.json +2 -3
  133. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_64.json +2 -3
  134. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_32.json +2 -3
  135. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_64.json +2 -3
  136. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_mips_64.json +2 -3
  137. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/mac_intel_64.json +2 -3
  138. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_32.json +2 -3
  139. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_64.json +2 -3
  140. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +13 -8
  141. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +18 -12
  142. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +18 -12
  143. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +18 -12
  144. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.py +3 -0
  145. data/vendor/depot_tools/recipes/recipe_modules/gclient/__init__.py +1 -0
  146. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +58 -46
  147. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +65 -22
  148. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +20 -21
  149. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +20 -21
  150. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +20 -21
  151. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +20 -21
  152. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +5 -2
  153. data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/patch_project.py +62 -14
  154. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +24 -38
  155. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +56 -50
  156. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +15 -9
  157. data/vendor/depot_tools/recipes/recipe_modules/git/__init__.py +4 -1
  158. data/vendor/depot_tools/recipes/recipe_modules/git/api.py +34 -22
  159. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic.json +5 -6
  160. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +5 -6
  161. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +5 -6
  162. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +5 -6
  163. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_luci.json +222 -0
  164. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +5 -6
  165. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +5 -6
  166. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_tags.json +224 -0
  167. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +10 -6
  168. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +5 -7
  169. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +5 -6
  170. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +5 -6
  171. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +5 -7
  172. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +5 -6
  173. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +10 -5
  174. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +5 -6
  175. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +8 -9
  176. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/platform_win.json +5 -6
  177. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +12 -8
  178. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +5 -6
  179. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +5 -6
  180. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.py +27 -11
  181. data/vendor/depot_tools/recipes/recipe_modules/git_cl/api.py +1 -1
  182. data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.expected/basic.json +12 -13
  183. data/vendor/depot_tools/recipes/recipe_modules/gitiles/__init__.py +5 -0
  184. data/vendor/depot_tools/recipes/recipe_modules/gitiles/api.py +120 -5
  185. data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.expected/basic.json +45 -3
  186. data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.py +25 -0
  187. data/vendor/depot_tools/recipes/recipe_modules/gitiles/resources/gerrit_client.py +56 -4
  188. data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.expected/basic.json +6 -0
  189. data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py +49 -0
  190. data/vendor/depot_tools/recipes/recipe_modules/gsutil/api.py +24 -13
  191. data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.expected/basic.json +13 -14
  192. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/basic.json +2 -3
  193. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_linux.json +2 -3
  194. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_mac.json +2 -3
  195. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_win.json +2 -3
  196. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_linux.json +2 -3
  197. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_mac.json +2 -3
  198. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_win.json +2 -3
  199. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_linux.json +2 -3
  200. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_mac.json +2 -3
  201. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_win.json +2 -3
  202. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/path_config.py +1 -2
  203. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/__init__.py +35 -0
  204. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/api.py +116 -0
  205. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/linux.json +22 -0
  206. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/mac.json +82 -0
  207. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/win.json +22 -0
  208. data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.py +23 -0
  209. data/vendor/depot_tools/recipes/recipe_modules/presubmit/__init__.py +1 -0
  210. data/vendor/depot_tools/recipes/recipe_modules/presubmit/api.py +2 -7
  211. data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.expected/basic.json +7 -6
  212. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +1 -0
  213. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +117 -8
  214. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/basic_tags.json +4 -5
  215. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +7 -4
  216. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +98 -7
  217. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +147 -0
  218. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +8 -5
  219. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +8 -5
  220. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +9 -6
  221. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +9 -6
  222. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +27 -2
  223. data/vendor/depot_tools/recipes/recipe_modules/tryserver/test_api.py +14 -0
  224. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/__init__.py +25 -0
  225. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/api.py +137 -0
  226. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/linux.json +22 -0
  227. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/mac.json +22 -0
  228. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/win.json +107 -0
  229. data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.py +26 -0
  230. data/vendor/depot_tools/recipes/recipes.py +37 -27
  231. data/vendor/depot_tools/recipes/recipes/fetch_end_to_end_test.expected/basic.json +7 -10
  232. data/vendor/depot_tools/repo +34 -8
  233. data/vendor/depot_tools/roll_dep.py +52 -49
  234. data/vendor/depot_tools/scm.py +38 -23
  235. data/vendor/depot_tools/setup_color.py +4 -2
  236. data/vendor/depot_tools/split_cl.py +32 -4
  237. data/vendor/depot_tools/subprocess2.py +22 -4
  238. data/vendor/depot_tools/third_party/httplib2/README.chromium +2 -2
  239. data/vendor/depot_tools/third_party/httplib2/__init__.py +242 -158
  240. data/vendor/depot_tools/third_party/httplib2/cacerts.txt +57 -44
  241. data/vendor/depot_tools/third_party/httplib2/socks.py +15 -5
  242. data/vendor/depot_tools/third_party/logilab/README.chromium +2 -4
  243. data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +2 -1
  244. data/vendor/depot_tools/third_party/logilab/astroid/__init__.py +10 -5
  245. data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +5 -5
  246. data/vendor/depot_tools/third_party/logilab/astroid/arguments.py +233 -0
  247. data/vendor/depot_tools/third_party/logilab/astroid/as_string.py +82 -33
  248. data/vendor/depot_tools/third_party/logilab/astroid/bases.py +137 -153
  249. data/vendor/depot_tools/third_party/logilab/astroid/brain/{builtin_inference.py → brain_builtin_inference.py} +117 -26
  250. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_dateutil.py +15 -0
  251. data/vendor/depot_tools/third_party/logilab/astroid/brain/{py2gi.py → brain_gi.py} +48 -8
  252. data/vendor/depot_tools/third_party/logilab/astroid/brain/{py2mechanize.py → brain_mechanize.py} +0 -0
  253. data/vendor/depot_tools/third_party/logilab/astroid/brain/{pynose.py → brain_nose.py} +4 -1
  254. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_numpy.py +62 -0
  255. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_pytest.py +76 -0
  256. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_qt.py +44 -0
  257. data/vendor/depot_tools/third_party/logilab/astroid/brain/{pysix_moves.py → brain_six.py} +28 -1
  258. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_ssl.py +65 -0
  259. data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_stdlib.py +473 -0
  260. data/vendor/depot_tools/third_party/logilab/astroid/builder.py +104 -81
  261. data/vendor/depot_tools/third_party/logilab/astroid/context.py +81 -0
  262. data/vendor/depot_tools/third_party/logilab/astroid/decorators.py +75 -0
  263. data/vendor/depot_tools/third_party/logilab/astroid/exceptions.py +20 -0
  264. data/vendor/depot_tools/third_party/logilab/astroid/inference.py +137 -183
  265. data/vendor/depot_tools/third_party/logilab/astroid/manager.py +45 -169
  266. data/vendor/depot_tools/third_party/logilab/astroid/mixins.py +37 -14
  267. data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +112 -41
  268. data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +243 -156
  269. data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +35 -22
  270. data/vendor/depot_tools/third_party/logilab/astroid/objects.py +186 -0
  271. data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +157 -102
  272. data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +32 -8
  273. data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +372 -309
  274. data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +652 -420
  275. data/vendor/depot_tools/third_party/logilab/astroid/test_utils.py +4 -21
  276. data/vendor/depot_tools/third_party/logilab/astroid/transforms.py +96 -0
  277. data/vendor/depot_tools/third_party/logilab/astroid/util.py +89 -0
  278. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/LICENSE +19 -0
  279. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/README.chromium +11 -0
  280. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/__init__.py +20 -0
  281. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/cext.c +1421 -0
  282. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/compat.py +9 -0
  283. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/simple.py +246 -0
  284. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/slots.py +414 -0
  285. data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/utils.py +13 -0
  286. data/vendor/depot_tools/third_party/logilab/wrapt/LICENSE +24 -0
  287. data/vendor/depot_tools/third_party/logilab/wrapt/README.chromium +11 -0
  288. data/vendor/depot_tools/third_party/logilab/wrapt/__init__.py +19 -0
  289. data/vendor/depot_tools/third_party/logilab/wrapt/_wrappers.c +2729 -0
  290. data/vendor/depot_tools/third_party/logilab/wrapt/arguments.py +96 -0
  291. data/vendor/depot_tools/third_party/logilab/wrapt/decorators.py +512 -0
  292. data/vendor/depot_tools/third_party/logilab/wrapt/importer.py +228 -0
  293. data/vendor/depot_tools/third_party/logilab/wrapt/wrappers.py +901 -0
  294. data/vendor/depot_tools/third_party/pylint/README.chromium +2 -25
  295. data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +13 -3
  296. data/vendor/depot_tools/third_party/pylint/checkers/__init__.py +1 -2
  297. data/vendor/depot_tools/third_party/pylint/checkers/async.py +82 -0
  298. data/vendor/depot_tools/third_party/pylint/checkers/base.py +893 -119
  299. data/vendor/depot_tools/third_party/pylint/checkers/classes.py +342 -204
  300. data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +51 -34
  301. data/vendor/depot_tools/third_party/pylint/checkers/exceptions.py +84 -47
  302. data/vendor/depot_tools/third_party/pylint/checkers/format.py +55 -30
  303. data/vendor/depot_tools/third_party/pylint/checkers/imports.py +314 -73
  304. data/vendor/depot_tools/third_party/pylint/checkers/logging.py +10 -8
  305. data/vendor/depot_tools/third_party/pylint/checkers/misc.py +2 -1
  306. data/vendor/depot_tools/third_party/pylint/checkers/newstyle.py +45 -48
  307. data/vendor/depot_tools/third_party/pylint/checkers/python3.py +31 -21
  308. data/vendor/depot_tools/third_party/pylint/checkers/raw_metrics.py +3 -3
  309. data/vendor/depot_tools/third_party/pylint/checkers/similar.py +4 -5
  310. data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +24 -10
  311. data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +120 -56
  312. data/vendor/depot_tools/third_party/pylint/checkers/strings.py +38 -35
  313. data/vendor/depot_tools/third_party/pylint/checkers/typecheck.py +485 -138
  314. data/vendor/depot_tools/third_party/pylint/checkers/utils.py +319 -142
  315. data/vendor/depot_tools/third_party/pylint/checkers/variables.py +329 -207
  316. data/vendor/depot_tools/third_party/pylint/config.py +739 -76
  317. data/vendor/depot_tools/third_party/pylint/epylint.py +9 -5
  318. data/vendor/depot_tools/third_party/pylint/extensions/__init__.py +0 -0
  319. data/vendor/depot_tools/third_party/pylint/extensions/check_docs.py +311 -0
  320. data/vendor/depot_tools/third_party/pylint/extensions/check_elif.py +62 -0
  321. data/vendor/depot_tools/third_party/{logilab/common → pylint}/graph.py +30 -133
  322. data/vendor/depot_tools/third_party/pylint/gui.py +2 -2
  323. data/vendor/depot_tools/third_party/pylint/interfaces.py +21 -3
  324. data/vendor/depot_tools/third_party/pylint/lint.py +123 -140
  325. data/vendor/depot_tools/third_party/pylint/pyreverse/diadefslib.py +10 -13
  326. data/vendor/depot_tools/third_party/pylint/pyreverse/diagrams.py +15 -4
  327. data/vendor/depot_tools/third_party/pylint/pyreverse/inspector.py +372 -0
  328. data/vendor/depot_tools/third_party/pylint/pyreverse/main.py +30 -7
  329. data/vendor/depot_tools/third_party/pylint/pyreverse/utils.py +80 -2
  330. data/vendor/depot_tools/third_party/{logilab/common → pylint/pyreverse}/vcgutils.py +19 -37
  331. data/vendor/depot_tools/third_party/pylint/pyreverse/writer.py +3 -4
  332. data/vendor/depot_tools/third_party/pylint/reporters/__init__.py +34 -18
  333. data/vendor/depot_tools/third_party/pylint/reporters/guireporter.py +1 -1
  334. data/vendor/depot_tools/third_party/pylint/reporters/html.py +10 -3
  335. data/vendor/depot_tools/third_party/pylint/reporters/json.py +10 -4
  336. data/vendor/depot_tools/third_party/pylint/reporters/text.py +94 -3
  337. data/vendor/depot_tools/third_party/pylint/reporters/ureports/__init__.py +106 -0
  338. data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/html_writer.py +17 -57
  339. data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/nodes.py +52 -74
  340. data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/text_writer.py +14 -60
  341. data/vendor/depot_tools/third_party/pylint/testutils.py +22 -20
  342. data/vendor/depot_tools/third_party/pylint/utils.py +268 -44
  343. data/vendor/depot_tools/third_party/repo/progress.py +42 -0
  344. data/vendor/depot_tools/update_depot_tools +1 -1
  345. data/vendor/depot_tools/upload_metrics.py +25 -0
  346. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +45 -15
  347. data/vendor/depot_tools/win_toolchain/package_from_installed.py +71 -24
  348. data/vendor/depot_tools/yapf +1 -1
  349. data/vendor/depot_tools/yapf.bat +1 -1
  350. metadata +92 -77
  351. data/vendor/depot_tools/git-crsync +0 -3
  352. data/vendor/depot_tools/infra/config/cq.cfg +0 -32
  353. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json +0 -29
  354. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json +0 -29
  355. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json +0 -105
  356. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/shallow.json +0 -195
  357. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +0 -248
  358. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json +0 -248
  359. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name_no_patch.json +0 -105
  360. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/apply_gerrit.py +0 -33
  361. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +0 -31
  362. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2qt4.py +0 -22
  363. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2stdlib.py +0 -334
  364. data/vendor/depot_tools/third_party/logilab/astroid/inspector.py +0 -273
  365. data/vendor/depot_tools/third_party/logilab/astroid/utils.py +0 -239
  366. data/vendor/depot_tools/third_party/logilab/common/LICENSE.txt +0 -339
  367. data/vendor/depot_tools/third_party/logilab/common/README.chromium +0 -11
  368. data/vendor/depot_tools/third_party/logilab/common/__init__.py +0 -175
  369. data/vendor/depot_tools/third_party/logilab/common/__pkginfo__.py +0 -57
  370. data/vendor/depot_tools/third_party/logilab/common/cache.py +0 -114
  371. data/vendor/depot_tools/third_party/logilab/common/changelog.py +0 -238
  372. data/vendor/depot_tools/third_party/logilab/common/clcommands.py +0 -334
  373. data/vendor/depot_tools/third_party/logilab/common/cli.py +0 -211
  374. data/vendor/depot_tools/third_party/logilab/common/compat.py +0 -78
  375. data/vendor/depot_tools/third_party/logilab/common/configuration.py +0 -1105
  376. data/vendor/depot_tools/third_party/logilab/common/contexts.py +0 -5
  377. data/vendor/depot_tools/third_party/logilab/common/corbautils.py +0 -117
  378. data/vendor/depot_tools/third_party/logilab/common/daemon.py +0 -101
  379. data/vendor/depot_tools/third_party/logilab/common/date.py +0 -335
  380. data/vendor/depot_tools/third_party/logilab/common/dbf.py +0 -231
  381. data/vendor/depot_tools/third_party/logilab/common/debugger.py +0 -214
  382. data/vendor/depot_tools/third_party/logilab/common/decorators.py +0 -281
  383. data/vendor/depot_tools/third_party/logilab/common/deprecation.py +0 -189
  384. data/vendor/depot_tools/third_party/logilab/common/fileutils.py +0 -404
  385. data/vendor/depot_tools/third_party/logilab/common/interface.py +0 -71
  386. data/vendor/depot_tools/third_party/logilab/common/logging_ext.py +0 -195
  387. data/vendor/depot_tools/third_party/logilab/common/modutils.py +0 -702
  388. data/vendor/depot_tools/third_party/logilab/common/optik_ext.py +0 -392
  389. data/vendor/depot_tools/third_party/logilab/common/optparser.py +0 -92
  390. data/vendor/depot_tools/third_party/logilab/common/proc.py +0 -277
  391. data/vendor/depot_tools/third_party/logilab/common/pyro_ext.py +0 -180
  392. data/vendor/depot_tools/third_party/logilab/common/pytest.py +0 -1199
  393. data/vendor/depot_tools/third_party/logilab/common/registry.py +0 -1119
  394. data/vendor/depot_tools/third_party/logilab/common/shellutils.py +0 -462
  395. data/vendor/depot_tools/third_party/logilab/common/sphinx_ext.py +0 -87
  396. data/vendor/depot_tools/third_party/logilab/common/sphinxutils.py +0 -122
  397. data/vendor/depot_tools/third_party/logilab/common/table.py +0 -929
  398. data/vendor/depot_tools/third_party/logilab/common/tasksqueue.py +0 -101
  399. data/vendor/depot_tools/third_party/logilab/common/testlib.py +0 -1392
  400. data/vendor/depot_tools/third_party/logilab/common/textutils.py +0 -537
  401. data/vendor/depot_tools/third_party/logilab/common/tree.py +0 -369
  402. data/vendor/depot_tools/third_party/logilab/common/umessage.py +0 -194
  403. data/vendor/depot_tools/third_party/logilab/common/ureports/__init__.py +0 -172
  404. data/vendor/depot_tools/third_party/logilab/common/ureports/docbook_writer.py +0 -140
  405. data/vendor/depot_tools/third_party/logilab/common/urllib2ext.py +0 -89
  406. data/vendor/depot_tools/third_party/logilab/common/visitor.py +0 -109
  407. data/vendor/depot_tools/third_party/logilab/common/xmlrpcutils.py +0 -131
  408. data/vendor/depot_tools/third_party/logilab/common/xmlutils.py +0 -61
@@ -4,6 +4,8 @@
4
4
 
5
5
  """This module holds utilities which make writing configs easier."""
6
6
 
7
+ from __future__ import print_function
8
+
7
9
  import json
8
10
 
9
11
 
@@ -29,7 +31,7 @@ class Config(object):
29
31
  methods = {'fetch': self.fetch_spec,
30
32
  'root': self.expected_root}
31
33
  if len(argv) <= 1 or argv[1] not in methods:
32
- print 'Must specify a a fetch/root action'
34
+ print('Must specify a a fetch/root action')
33
35
  return 1
34
36
 
35
37
  def looks_like_arg(arg):
@@ -37,7 +39,7 @@ class Config(object):
37
39
 
38
40
  bad_parms = [x for x in argv[2:] if not looks_like_arg(x)]
39
41
  if bad_parms:
40
- print 'Got bad arguments %s' % bad_parms
42
+ print('Got bad arguments %s' % bad_parms)
41
43
  return 1
42
44
 
43
45
  method = methods[argv[1]]
@@ -0,0 +1,40 @@
1
+ # Copyright (c) 2018 The Chromium Authors. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style license that can be
3
+ # found in the LICENSE file.
4
+
5
+ import sys
6
+
7
+ import config_util # pylint: disable=import-error
8
+
9
+
10
+ # This class doesn't need an __init__ method, so we disable the warning
11
+ # pylint: disable=no-init
12
+ class InspectorProtocol(config_util.Config):
13
+ @staticmethod
14
+ def fetch_spec(props):
15
+ url = 'https://chromium.googlesource.com/deps/inspector_protocol.git'
16
+ solution = {
17
+ 'name': 'src',
18
+ 'url': url,
19
+ 'managed': False,
20
+ 'custom_deps': {},
21
+ }
22
+ spec = {
23
+ 'solutions': [solution],
24
+ }
25
+ return {
26
+ 'type': 'gclient_git',
27
+ 'gclient_git_spec': spec,
28
+ }
29
+
30
+ @staticmethod
31
+ def expected_root(_props):
32
+ return 'src'
33
+
34
+
35
+ def main(argv=None):
36
+ return InspectorProtocol().handle_args(argv)
37
+
38
+
39
+ if __name__ == '__main__':
40
+ sys.exit(main(sys.argv))
@@ -0,0 +1,41 @@
1
+ # Copyright 2019 The Chromium Authors. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style license that can be
3
+ # found in the LICENSE file.
4
+
5
+ import sys
6
+
7
+ import config_util # pylint: disable=import-error
8
+
9
+
10
+ # This class doesn't need an __init__ method, so we disable the warning
11
+ # pylint: disable=no-init
12
+ class NodeCI(config_util.Config):
13
+ """Basic Config class for node-ci."""
14
+
15
+ @staticmethod
16
+ def fetch_spec(props):
17
+ url = 'https://chromium.googlesource.com/v8/node-ci.git'
18
+ return {
19
+ 'type': 'gclient_git',
20
+ 'gclient_git_spec': {
21
+ 'solutions': [{
22
+ 'name' : 'node-ci',
23
+ 'url' : url,
24
+ 'deps_file' : 'DEPS',
25
+ 'managed' : False,
26
+ 'custom_deps' : {},
27
+ }],
28
+ },
29
+ }
30
+
31
+ @staticmethod
32
+ def expected_root(_props):
33
+ return 'node-ci'
34
+
35
+
36
+ def main(argv=None):
37
+ return NodeCI().handle_args(argv)
38
+
39
+
40
+ if __name__ == '__main__':
41
+ sys.exit(main(sys.argv))
@@ -95,8 +95,8 @@ def fix_win_sys_argv(encoding):
95
95
  argc = c_int(0)
96
96
  argv_unicode = CommandLineToArgvW(GetCommandLineW(), byref(argc))
97
97
  argv = [
98
- argv_unicode[i].encode(encoding, 'replace')
99
- for i in xrange(0, argc.value)]
98
+ argv_unicode[i].encode(encoding, 'replace') for i in range(0, argc.value)
99
+ ]
100
100
 
101
101
  if not hasattr(sys, 'frozen'):
102
102
  # If this is an executable produced by py2exe or bbfreeze, then it
@@ -107,7 +107,7 @@ def fix_win_sys_argv(encoding):
107
107
  # Also skip option arguments to the Python interpreter.
108
108
  while len(argv) > 0:
109
109
  arg = argv[0]
110
- if not arg.startswith(u'-') or arg == u'-':
110
+ if not arg.startswith(b'-') or arg == b'-':
111
111
  break
112
112
  argv = argv[1:]
113
113
  if arg == u'-m':
@@ -5,7 +5,7 @@
5
5
 
6
6
  base_dir=$(dirname "$0")
7
7
 
8
- if [[ "#grep#fetch#cleanup#diff#" != *"#$1#"* ]]; then
8
+ if [[ "#grep#fetch#cleanup#diff#setdep#" != *"#$1#"* ]]; then
9
9
  "$base_dir"/update_depot_tools "$@"
10
10
  case $? in
11
11
  123)
@@ -96,20 +96,40 @@ import pprint
96
96
  import re
97
97
  import sys
98
98
  import time
99
- import urlparse
99
+
100
+ try:
101
+ import urlparse
102
+ except ImportError: # For Py3 compatibility
103
+ import urllib.parse as urlparse
100
104
 
101
105
  import detect_host_arch
102
106
  import fix_encoding
103
107
  import gclient_eval
104
108
  import gclient_scm
109
+ import gclient_paths
105
110
  import gclient_utils
106
111
  import git_cache
112
+ import metrics
113
+ import metrics_utils
107
114
  from third_party.repo.progress import Progress
108
115
  import subcommand
109
116
  import subprocess2
110
117
  import setup_color
111
118
 
112
119
 
120
+ # TODO(crbug.com/953884): Remove this when python3 migration is done.
121
+ try:
122
+ basestring
123
+ except NameError:
124
+ # pylint: disable=redefined-builtin
125
+ basestring = str
126
+
127
+
128
+ # Singleton object to represent an unset cache_dir (as opposed to a disabled
129
+ # one, e.g. if a spec explicitly says `cache_dir = None`.)
130
+ UNSET_CACHE_DIR = object()
131
+
132
+
113
133
  class GNException(Exception):
114
134
  pass
115
135
 
@@ -127,7 +147,7 @@ def ToGNString(value, allow_dicts = True):
127
147
  value.replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$') + \
128
148
  '"'
129
149
 
130
- if isinstance(value, unicode):
150
+ if sys.version_info.major == 2 and isinstance(value, unicode):
131
151
  return ToGNString(value.encode('utf-8'))
132
152
 
133
153
  if isinstance(value, bool):
@@ -144,7 +164,7 @@ class Hook(object):
144
164
  """Descriptor of command ran before/after sync or on demand."""
145
165
 
146
166
  def __init__(self, action, pattern=None, name=None, cwd=None, condition=None,
147
- variables=None, verbose=False):
167
+ variables=None, verbose=False, cwd_base=None):
148
168
  """Constructor.
149
169
 
150
170
  Arguments:
@@ -162,9 +182,11 @@ class Hook(object):
162
182
  self._condition = condition
163
183
  self._variables = variables
164
184
  self._verbose = verbose
185
+ self._cwd_base = cwd_base
165
186
 
166
187
  @staticmethod
167
- def from_dict(d, variables=None, verbose=False, conditions=None):
188
+ def from_dict(d, variables=None, verbose=False, conditions=None,
189
+ cwd_base=None):
168
190
  """Creates a Hook instance from a dict like in the DEPS file."""
169
191
  # Merge any local and inherited conditions.
170
192
  gclient_eval.UpdateCondition(d, 'and', conditions)
@@ -176,7 +198,8 @@ class Hook(object):
176
198
  d.get('condition'),
177
199
  variables=variables,
178
200
  # Always print the header if not printing to a TTY.
179
- verbose=verbose or not setup_color.IS_TTY)
201
+ verbose=verbose or not setup_color.IS_TTY,
202
+ cwd_base=cwd_base)
180
203
 
181
204
  @property
182
205
  def action(self):
@@ -194,6 +217,13 @@ class Hook(object):
194
217
  def condition(self):
195
218
  return self._condition
196
219
 
220
+ @property
221
+ def effective_cwd(self):
222
+ cwd = self._cwd_base
223
+ if self._cwd:
224
+ cwd = os.path.join(cwd, self._cwd)
225
+ return cwd
226
+
197
227
  def matches(self, file_list):
198
228
  """Returns true if the pattern matches any of files in the list."""
199
229
  if not self._pattern:
@@ -201,7 +231,7 @@ class Hook(object):
201
231
  pattern = re.compile(self._pattern)
202
232
  return bool([f for f in file_list if pattern.search(f)])
203
233
 
204
- def run(self, root):
234
+ def run(self):
205
235
  """Executes the hook's command (provided the condition is met)."""
206
236
  if (self._condition and
207
237
  not gclient_eval.EvaluateCondition(self._condition, self._variables)):
@@ -217,13 +247,10 @@ class Hook(object):
217
247
  elif cmd[0] == 'vpython' and _detect_host_os() == 'win':
218
248
  cmd[0] += '.bat'
219
249
 
220
- cwd = root
221
- if self._cwd:
222
- cwd = os.path.join(cwd, self._cwd)
223
250
  try:
224
251
  start_time = time.time()
225
252
  gclient_utils.CheckCallAndFilterAndHeader(
226
- cmd, cwd=cwd, always=self._verbose)
253
+ cmd, cwd=self.effective_cwd, always=self._verbose)
227
254
  except (gclient_utils.Error, subprocess2.CalledProcessError) as e:
228
255
  # Use a discrete exit status code of 2 to indicate that a hook action
229
256
  # failed. Users of this script may wish to treat hook action failures
@@ -527,7 +554,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
527
554
  self.name)
528
555
  if not self.should_process:
529
556
  # Return early, no need to set requirements.
530
- return True
557
+ return not any(d.name == self.name for d in self.root.subtree(True))
531
558
 
532
559
  # This require a full tree traversal with locks.
533
560
  siblings = [d for d in self.root.subtree(False) if d.name == self.name]
@@ -557,7 +584,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
557
584
 
558
585
  # If a line is in custom_deps, but not in the solution, we want to append
559
586
  # this line to the solution.
560
- for dep_name, dep_info in self.custom_deps.iteritems():
587
+ for dep_name, dep_info in self.custom_deps.items():
561
588
  if dep_name not in deps:
562
589
  deps[dep_name] = {'url': dep_info, 'dep_type': 'git'}
563
590
 
@@ -586,7 +613,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
586
613
  def _deps_to_objects(self, deps, use_relative_paths):
587
614
  """Convert a deps dict to a dict of Dependency objects."""
588
615
  deps_to_add = []
589
- for name, dep_value in deps.iteritems():
616
+ for name, dep_value in deps.items():
590
617
  should_process = self.should_process
591
618
  if dep_value is None:
592
619
  continue
@@ -598,13 +625,13 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
598
625
  should_process = should_process and gclient_eval.EvaluateCondition(
599
626
  condition, self.get_vars())
600
627
 
628
+ # The following option is only set by the 'revinfo' command.
629
+ if self._get_option('ignore_dep_type', None) == dep_type:
630
+ continue
631
+
601
632
  if dep_type == 'cipd':
602
633
  cipd_root = self.GetCipdRoot()
603
634
  for package in dep_value.get('packages', []):
604
- if 'version' in package:
605
- # Matches version to vars value.
606
- version = package['version']
607
- package['version'] = version
608
635
  deps_to_add.append(
609
636
  CipdDependency(
610
637
  parent=self,
@@ -667,7 +694,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
667
694
  try:
668
695
  local_scope = gclient_eval.Parse(
669
696
  deps_content, self._get_option('validate_syntax', False),
670
- filepath, self.get_vars())
697
+ filepath, self.get_vars(), self.get_builtin_vars())
671
698
  except SyntaxError as e:
672
699
  gclient_utils.SyntaxErrorToError(filepath, e)
673
700
 
@@ -694,7 +721,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
694
721
 
695
722
  self._vars = local_scope.get('vars', {})
696
723
  if self.parent:
697
- for key, value in self.parent.get_vars().iteritems():
724
+ for key, value in self.parent.get_vars().items():
698
725
  if key in self._vars:
699
726
  self._vars[key] = value
700
727
  # Since we heavily post-process things, freeze ones which should
@@ -731,7 +758,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
731
758
  if rel_prefix:
732
759
  logging.warning('Updating recursedeps by prepending %s.', rel_prefix)
733
760
  rel_deps = {}
734
- for depname, options in self.recursedeps.iteritems():
761
+ for depname, options in self.recursedeps.items():
735
762
  rel_deps[
736
763
  os.path.normpath(os.path.join(rel_prefix, depname))] = options
737
764
  self.recursedeps = rel_deps
@@ -748,6 +775,18 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
748
775
  deps_to_add = self._deps_to_objects(
749
776
  self._postprocess_deps(deps, rel_prefix), use_relative_paths)
750
777
 
778
+ # compute which working directory should be used for hooks
779
+ use_relative_hooks = local_scope.get('use_relative_hooks', False)
780
+ hooks_cwd = self.root.root_dir
781
+ if use_relative_hooks:
782
+ if not use_relative_paths:
783
+ raise gclient_utils.Error(
784
+ 'ParseDepsFile(%s): use_relative_hooks must be used with '
785
+ 'use_relative_paths' % self.name)
786
+ hooks_cwd = os.path.join(hooks_cwd, self.name)
787
+ logging.warning('Updating hook base working directory to %s.',
788
+ hooks_cwd)
789
+
751
790
  # override named sets of hooks by the custom hooks
752
791
  hooks_to_run = []
753
792
  hook_names_to_suppress = [c.get('name', '') for c in self.custom_hooks]
@@ -763,11 +802,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
763
802
  if self.should_recurse:
764
803
  self._pre_deps_hooks = [
765
804
  Hook.from_dict(hook, variables=self.get_vars(), verbose=True,
766
- conditions=self.condition)
805
+ conditions=self.condition, cwd_base=hooks_cwd)
767
806
  for hook in local_scope.get('pre_deps_hooks', [])
768
807
  ]
769
808
 
770
- self.add_dependencies_and_close(deps_to_add, hooks_to_run)
809
+ self.add_dependencies_and_close(deps_to_add, hooks_to_run,
810
+ hooks_cwd=hooks_cwd)
771
811
  logging.info('ParseDepsFile(%s) done' % self.name)
772
812
 
773
813
  def _get_option(self, attr, default):
@@ -776,20 +816,23 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
776
816
  obj = obj.parent
777
817
  return getattr(obj._options, attr, default)
778
818
 
779
- def add_dependencies_and_close(self, deps_to_add, hooks):
819
+ def add_dependencies_and_close(self, deps_to_add, hooks, hooks_cwd=None):
780
820
  """Adds the dependencies, hooks and mark the parsing as done."""
821
+ if hooks_cwd == None:
822
+ hooks_cwd = self.root.root_dir
823
+
781
824
  for dep in deps_to_add:
782
825
  if dep.verify_validity():
783
826
  self.add_dependency(dep)
784
827
  self._mark_as_parsed([
785
828
  Hook.from_dict(
786
829
  h, variables=self.get_vars(), verbose=self.root._options.verbose,
787
- conditions=self.condition)
830
+ conditions=self.condition, cwd_base=hooks_cwd)
788
831
  for h in hooks
789
832
  ])
790
833
 
791
834
  def findDepsFromNotAllowedHosts(self):
792
- """Returns a list of depenecies from not allowed hosts.
835
+ """Returns a list of dependencies from not allowed hosts.
793
836
 
794
837
  If allowed_hosts is not set, allows all hosts and returns empty list.
795
838
  """
@@ -841,7 +884,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
841
884
  # Arguments number differs from overridden method
842
885
  # pylint: disable=arguments-differ
843
886
  def run(self, revision_overrides, command, args, work_queue, options,
844
- patch_refs):
887
+ patch_refs, target_branches):
845
888
  """Runs |command| then parse the DEPS file."""
846
889
  logging.info('Dependency(%s).run()' % self.name)
847
890
  assert self._file_list == []
@@ -868,9 +911,11 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
868
911
 
869
912
  patch_repo = self.url.split('@')[0]
870
913
  patch_ref = patch_refs.pop(self.FuzzyMatchUrl(patch_refs), None)
914
+ target_branch = target_branches.pop(
915
+ self.FuzzyMatchUrl(target_branches), None)
871
916
  if command == 'update' and patch_ref is not None:
872
- self._used_scm.apply_patch_ref(patch_repo, patch_ref, options,
873
- file_list)
917
+ self._used_scm.apply_patch_ref(patch_repo, patch_ref, target_branch,
918
+ options, file_list)
874
919
 
875
920
  if file_list:
876
921
  file_list = [os.path.join(self.name, f.strip()) for f in file_list]
@@ -1012,7 +1057,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
1012
1057
  for hook in hooks:
1013
1058
  if progress:
1014
1059
  progress.update(extra=hook.name or '')
1015
- hook.run(self.root.root_dir)
1060
+ hook.run()
1016
1061
  if progress:
1017
1062
  progress.end()
1018
1063
 
@@ -1025,7 +1070,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
1025
1070
  assert not s.processed
1026
1071
  self._pre_deps_hooks_ran = True
1027
1072
  for hook in self.pre_deps_hooks:
1028
- hook.run(self.root.root_dir)
1073
+ hook.run()
1029
1074
 
1030
1075
  def GetCipdRoot(self):
1031
1076
  if self.root is self:
@@ -1160,11 +1205,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
1160
1205
  d = d.parent
1161
1206
  return tuple(out)
1162
1207
 
1163
- def get_vars(self):
1164
- """Returns a dictionary of effective variable values
1165
- (DEPS file contents with applied custom_vars overrides)."""
1166
- # Provide some built-in variables.
1167
- result = {
1208
+ def get_builtin_vars(self):
1209
+ return {
1168
1210
  'checkout_android': 'android' in self.target_os,
1169
1211
  'checkout_chromeos': 'chromeos' in self.target_os,
1170
1212
  'checkout_fuchsia': 'fuchsia' in self.target_os,
@@ -1178,20 +1220,28 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
1178
1220
  'checkout_arm64': 'arm64' in self.target_cpu,
1179
1221
  'checkout_x86': 'x86' in self.target_cpu,
1180
1222
  'checkout_mips': 'mips' in self.target_cpu,
1223
+ 'checkout_mips64': 'mips64' in self.target_cpu,
1181
1224
  'checkout_ppc': 'ppc' in self.target_cpu,
1182
1225
  'checkout_s390': 's390' in self.target_cpu,
1183
1226
  'checkout_x64': 'x64' in self.target_cpu,
1184
1227
  'host_cpu': detect_host_arch.HostArch(),
1185
1228
  }
1186
- # Variable precedence:
1187
- # - built-in
1229
+
1230
+ def get_vars(self):
1231
+ """Returns a dictionary of effective variable values
1232
+ (DEPS file contents with applied custom_vars overrides)."""
1233
+ # Variable precedence (last has highest):
1188
1234
  # - DEPS vars
1189
1235
  # - parents, from first to last
1236
+ # - built-in
1190
1237
  # - custom_vars overrides
1238
+ result = {}
1191
1239
  result.update(self._vars)
1192
1240
  if self.parent:
1193
1241
  parent_vars = self.parent.get_vars()
1194
1242
  result.update(parent_vars)
1243
+ # Provide some built-in variables.
1244
+ result.update(self.get_builtin_vars())
1195
1245
  result.update(self.custom_vars or {})
1196
1246
  return result
1197
1247
 
@@ -1243,6 +1293,7 @@ class GClient(GitDependency):
1243
1293
  "android": "android",
1244
1294
  "ios": "ios",
1245
1295
  "fuchsia": "fuchsia",
1296
+ "chromeos": "chromeos",
1246
1297
  }
1247
1298
 
1248
1299
  DEFAULT_CLIENT_FILE_TEXT = ("""\
@@ -1256,9 +1307,13 @@ solutions = [
1256
1307
  "custom_vars": %(custom_vars)r,
1257
1308
  },
1258
1309
  ]
1310
+ """)
1311
+
1312
+ DEFAULT_CLIENT_CACHE_DIR_TEXT = ("""\
1259
1313
  cache_dir = %(cache_dir)r
1260
1314
  """)
1261
1315
 
1316
+
1262
1317
  DEFAULT_SNAPSHOT_FILE_TEXT = ("""\
1263
1318
  # Snapshot generated with gclient revinfo --snapshot
1264
1319
  solutions = %(solution_list)s
@@ -1310,7 +1365,8 @@ solutions = %(solution_list)s
1310
1365
  mirror.exists())
1311
1366
  else:
1312
1367
  mirror_string = 'not used'
1313
- raise gclient_utils.Error('''
1368
+ raise gclient_utils.Error(
1369
+ '''
1314
1370
  Your .gclient file seems to be broken. The requested URL is different from what
1315
1371
  is actually checked out in %(checkout_path)s.
1316
1372
 
@@ -1326,7 +1382,7 @@ it or fix the checkout.
1326
1382
  ''' % {'checkout_path': os.path.join(self.root_dir, dep.name),
1327
1383
  'expected_url': dep.url,
1328
1384
  'expected_scm': dep.GetScmName(),
1329
- 'mirror_string' : mirror_string,
1385
+ 'mirror_string': mirror_string,
1330
1386
  'actual_url': actual_url,
1331
1387
  'actual_scm': dep.GetScmName()})
1332
1388
 
@@ -1353,13 +1409,13 @@ it or fix the checkout.
1353
1409
  else:
1354
1410
  self._enforced_cpu = tuple(set(self._enforced_cpu).union(target_cpu))
1355
1411
 
1356
- cache_dir = config_dict.get('cache_dir', self._options.cache_dir)
1357
- if cache_dir:
1358
- cache_dir = os.path.join(self.root_dir, cache_dir)
1359
- cache_dir = os.path.abspath(cache_dir)
1412
+ cache_dir = config_dict.get('cache_dir', UNSET_CACHE_DIR)
1413
+ if cache_dir is not UNSET_CACHE_DIR:
1414
+ if cache_dir:
1415
+ cache_dir = os.path.join(self.root_dir, cache_dir)
1416
+ cache_dir = os.path.abspath(cache_dir)
1360
1417
 
1361
- gclient_scm.GitWrapper.cache_dir = cache_dir
1362
- git_cache.Mirror.SetCachePath(cache_dir)
1418
+ git_cache.Mirror.SetCachePath(cache_dir)
1363
1419
 
1364
1420
  if not target_os and config_dict.get('target_os_only', False):
1365
1421
  raise gclient_utils.Error('Can\'t use target_os_only if target_os is '
@@ -1389,6 +1445,15 @@ it or fix the checkout.
1389
1445
  except KeyError:
1390
1446
  raise gclient_utils.Error('Invalid .gclient file. Solution is '
1391
1447
  'incomplete: %s' % s)
1448
+ metrics.collector.add(
1449
+ 'project_urls',
1450
+ [
1451
+ dep.url if not dep.url.endswith('.git') else dep.url[:-len('.git')]
1452
+ for dep in deps_to_add
1453
+ if dep.FuzzyMatchUrl(metrics_utils.KNOWN_PROJECT_URLS)
1454
+ ]
1455
+ )
1456
+
1392
1457
  self.add_dependencies_and_close(deps_to_add, config_dict.get('hooks', []))
1393
1458
  logging.info('SetConfig() done')
1394
1459
 
@@ -1408,7 +1473,7 @@ it or fix the checkout.
1408
1473
  if options.verbose:
1409
1474
  print('Looking for %s starting from %s\n' % (
1410
1475
  options.config_filename, os.getcwd()))
1411
- path = gclient_utils.FindGclientRoot(os.getcwd(), options.config_filename)
1476
+ path = gclient_paths.FindGclientRoot(os.getcwd(), options.config_filename)
1412
1477
  if not path:
1413
1478
  if options.verbose:
1414
1479
  print('Couldn\'t find configuration file.')
@@ -1431,15 +1496,22 @@ it or fix the checkout.
1431
1496
  return client
1432
1497
 
1433
1498
  def SetDefaultConfig(self, solution_name, deps_file, solution_url,
1434
- managed=True, cache_dir=None, custom_vars=None):
1435
- self.SetConfig(self.DEFAULT_CLIENT_FILE_TEXT % {
1499
+ managed=True, cache_dir=UNSET_CACHE_DIR,
1500
+ custom_vars=None):
1501
+ text = self.DEFAULT_CLIENT_FILE_TEXT
1502
+ format_dict = {
1436
1503
  'solution_name': solution_name,
1437
1504
  'solution_url': solution_url,
1438
1505
  'deps_file': deps_file,
1439
1506
  'managed': managed,
1440
- 'cache_dir': cache_dir,
1441
1507
  'custom_vars': custom_vars or {},
1442
- })
1508
+ }
1509
+
1510
+ if cache_dir is not UNSET_CACHE_DIR:
1511
+ text += self.DEFAULT_CLIENT_CACHE_DIR_TEXT
1512
+ format_dict['cache_dir'] = cache_dir
1513
+
1514
+ self.SetConfig(text % format_dict)
1443
1515
 
1444
1516
  def _SaveEntries(self):
1445
1517
  """Creates a .gclient_entries file to record the list of unique checkouts.
@@ -1492,19 +1564,134 @@ it or fix the checkout.
1492
1564
  index += 1
1493
1565
  return revision_overrides
1494
1566
 
1495
- def _EnforcePatchRefs(self):
1567
+ def _EnforcePatchRefsAndBranches(self):
1496
1568
  """Checks for patch refs."""
1497
1569
  patch_refs = {}
1570
+ target_branches = {}
1498
1571
  if not self._options.patch_refs:
1499
- return patch_refs
1572
+ return patch_refs, target_branches
1500
1573
  for given_patch_ref in self._options.patch_refs:
1501
1574
  patch_repo, _, patch_ref = given_patch_ref.partition('@')
1502
1575
  if not patch_repo or not patch_ref:
1503
1576
  raise gclient_utils.Error(
1504
1577
  'Wrong revision format: %s should be of the form '
1505
- 'patch_repo@patch_ref.' % given_patch_ref)
1578
+ 'patch_repo@[target_branch:]patch_ref.' % given_patch_ref)
1579
+ if ':' in patch_ref:
1580
+ target_branch, _, patch_ref = patch_ref.partition(':')
1581
+ target_branches[patch_repo] = target_branch
1506
1582
  patch_refs[patch_repo] = patch_ref
1507
- return patch_refs
1583
+ return patch_refs, target_branches
1584
+
1585
+ def _RemoveUnversionedGitDirs(self):
1586
+ """Remove directories that are no longer part of the checkout.
1587
+
1588
+ Notify the user if there is an orphaned entry in their working copy.
1589
+ Only delete the directory if there are no changes in it, and
1590
+ delete_unversioned_trees is set to true.
1591
+ """
1592
+
1593
+ entries = [i.name for i in self.root.subtree(False) if i.url]
1594
+ full_entries = [os.path.join(self.root_dir, e.replace('/', os.path.sep))
1595
+ for e in entries]
1596
+
1597
+ for entry, prev_url in self._ReadEntries().items():
1598
+ if not prev_url:
1599
+ # entry must have been overridden via .gclient custom_deps
1600
+ continue
1601
+ # Fix path separator on Windows.
1602
+ entry_fixed = entry.replace('/', os.path.sep)
1603
+ e_dir = os.path.join(self.root_dir, entry_fixed)
1604
+ # Use entry and not entry_fixed there.
1605
+ if (entry not in entries and
1606
+ (not any(path.startswith(entry + '/') for path in entries)) and
1607
+ os.path.exists(e_dir)):
1608
+ # The entry has been removed from DEPS.
1609
+ scm = gclient_scm.GitWrapper(
1610
+ prev_url, self.root_dir, entry_fixed, self.outbuf)
1611
+
1612
+ # Check to see if this directory is now part of a higher-up checkout.
1613
+ scm_root = None
1614
+ try:
1615
+ scm_root = gclient_scm.scm.GIT.GetCheckoutRoot(scm.checkout_path)
1616
+ except subprocess2.CalledProcessError:
1617
+ pass
1618
+ if not scm_root:
1619
+ logging.warning('Could not find checkout root for %s. Unable to '
1620
+ 'determine whether it is part of a higher-level '
1621
+ 'checkout, so not removing.' % entry)
1622
+ continue
1623
+
1624
+ # This is to handle the case of third_party/WebKit migrating from
1625
+ # being a DEPS entry to being part of the main project.
1626
+ # If the subproject is a Git project, we need to remove its .git
1627
+ # folder. Otherwise git operations on that folder will have different
1628
+ # effects depending on the current working directory.
1629
+ if os.path.abspath(scm_root) == os.path.abspath(e_dir):
1630
+ e_par_dir = os.path.join(e_dir, os.pardir)
1631
+ if gclient_scm.scm.GIT.IsInsideWorkTree(e_par_dir):
1632
+ par_scm_root = gclient_scm.scm.GIT.GetCheckoutRoot(e_par_dir)
1633
+ # rel_e_dir : relative path of entry w.r.t. its parent repo.
1634
+ rel_e_dir = os.path.relpath(e_dir, par_scm_root)
1635
+ if gclient_scm.scm.GIT.IsDirectoryVersioned(
1636
+ par_scm_root, rel_e_dir):
1637
+ save_dir = scm.GetGitBackupDirPath()
1638
+ # Remove any eventual stale backup dir for the same project.
1639
+ if os.path.exists(save_dir):
1640
+ gclient_utils.rmtree(save_dir)
1641
+ os.rename(os.path.join(e_dir, '.git'), save_dir)
1642
+ # When switching between the two states (entry/ is a subproject
1643
+ # -> entry/ is part of the outer project), it is very likely
1644
+ # that some files are changed in the checkout, unless we are
1645
+ # jumping *exactly* across the commit which changed just DEPS.
1646
+ # In such case we want to cleanup any eventual stale files
1647
+ # (coming from the old subproject) in order to end up with a
1648
+ # clean checkout.
1649
+ gclient_scm.scm.GIT.CleanupDir(par_scm_root, rel_e_dir)
1650
+ assert not os.path.exists(os.path.join(e_dir, '.git'))
1651
+ print(('\nWARNING: \'%s\' has been moved from DEPS to a higher '
1652
+ 'level checkout. The git folder containing all the local'
1653
+ ' branches has been saved to %s.\n'
1654
+ 'If you don\'t care about its state you can safely '
1655
+ 'remove that folder to free up space.') %
1656
+ (entry, save_dir))
1657
+ continue
1658
+
1659
+ if scm_root in full_entries:
1660
+ logging.info('%s is part of a higher level checkout, not removing',
1661
+ scm.GetCheckoutRoot())
1662
+ continue
1663
+
1664
+ file_list = []
1665
+ scm.status(self._options, [], file_list)
1666
+ modified_files = file_list != []
1667
+ if (not self._options.delete_unversioned_trees or
1668
+ (modified_files and not self._options.force)):
1669
+ # There are modified files in this entry. Keep warning until
1670
+ # removed.
1671
+ self.add_dependency(
1672
+ GitDependency(
1673
+ parent=self,
1674
+ name=entry,
1675
+ url=prev_url,
1676
+ managed=False,
1677
+ custom_deps={},
1678
+ custom_vars={},
1679
+ custom_hooks=[],
1680
+ deps_file=None,
1681
+ should_process=True,
1682
+ should_recurse=False,
1683
+ relative=None,
1684
+ condition=None))
1685
+ print(('\nWARNING: \'%s\' is no longer part of this client.\n'
1686
+ 'It is recommended that you manually remove it or use '
1687
+ '\'gclient sync -D\' next time.') % entry_fixed)
1688
+ else:
1689
+ # Delete the entry
1690
+ print('\n________ deleting \'%s\' in \'%s\'' % (
1691
+ entry_fixed, self.root_dir))
1692
+ gclient_utils.rmtree(e_dir)
1693
+ # record the current list of entries for next time
1694
+ self._SaveEntries()
1508
1695
 
1509
1696
  def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
1510
1697
  """Runs a command on each dependency in a client and its dependencies.
@@ -1518,6 +1705,7 @@ it or fix the checkout.
1518
1705
 
1519
1706
  revision_overrides = {}
1520
1707
  patch_refs = {}
1708
+ target_branches = {}
1521
1709
  # It's unnecessary to check for revision overrides for 'recurse'.
1522
1710
  # Save a few seconds by not calling _EnforceRevisions() in that case.
1523
1711
  if command not in ('diff', 'recurse', 'runhooks', 'status', 'revert',
@@ -1526,7 +1714,7 @@ it or fix the checkout.
1526
1714
  revision_overrides = self._EnforceRevisions()
1527
1715
 
1528
1716
  if command == 'update':
1529
- patch_refs = self._EnforcePatchRefs()
1717
+ patch_refs, target_branches = self._EnforcePatchRefsAndBranches()
1530
1718
  # Disable progress for non-tty stdout.
1531
1719
  should_show_progress = (
1532
1720
  setup_color.IS_TTY and not self._options.verbose and progress)
@@ -1543,7 +1731,7 @@ it or fix the checkout.
1543
1731
  if s.should_process:
1544
1732
  work_queue.enqueue(s)
1545
1733
  work_queue.flush(revision_overrides, command, args, options=self._options,
1546
- patch_refs=patch_refs)
1734
+ patch_refs=patch_refs, target_branches=target_branches)
1547
1735
 
1548
1736
  if revision_overrides:
1549
1737
  print('Please fix your script, having invalid --revision flags will soon '
@@ -1556,9 +1744,6 @@ it or fix the checkout.
1556
1744
  patch_repo + '@' + patch_ref
1557
1745
  for patch_repo, patch_ref in patch_refs.iteritems())))
1558
1746
 
1559
- if self._cipd_root:
1560
- self._cipd_root.run(command)
1561
-
1562
1747
  # Once all the dependencies have been processed, it's now safe to write
1563
1748
  # out the gn_args_file and run the hooks.
1564
1749
  if command == 'update':
@@ -1569,103 +1754,20 @@ it or fix the checkout.
1569
1754
  if gn_args_dep and gn_args_dep.HasGNArgsFile():
1570
1755
  gn_args_dep.WriteGNArgsFile()
1571
1756
 
1757
+ self._RemoveUnversionedGitDirs()
1758
+
1759
+ # Sync CIPD dependencies once removed deps are deleted. In case a git
1760
+ # dependency was moved to CIPD, we want to remove the old git directory
1761
+ # first and then sync the CIPD dep.
1762
+ if self._cipd_root:
1763
+ self._cipd_root.run(command)
1764
+
1572
1765
  if not self._options.nohooks:
1573
1766
  if should_show_progress:
1574
1767
  pm = Progress('Running hooks', 1)
1575
1768
  self.RunHooksRecursively(self._options, pm)
1576
1769
 
1577
- if command == 'update':
1578
- # Notify the user if there is an orphaned entry in their working copy.
1579
- # Only delete the directory if there are no changes in it, and
1580
- # delete_unversioned_trees is set to true.
1581
- entries = [i.name for i in self.root.subtree(False) if i.url]
1582
- full_entries = [os.path.join(self.root_dir, e.replace('/', os.path.sep))
1583
- for e in entries]
1584
-
1585
- for entry, prev_url in self._ReadEntries().iteritems():
1586
- if not prev_url:
1587
- # entry must have been overridden via .gclient custom_deps
1588
- continue
1589
- # Fix path separator on Windows.
1590
- entry_fixed = entry.replace('/', os.path.sep)
1591
- e_dir = os.path.join(self.root_dir, entry_fixed)
1592
- # Use entry and not entry_fixed there.
1593
- if (entry not in entries and
1594
- (not any(path.startswith(entry + '/') for path in entries)) and
1595
- os.path.exists(e_dir)):
1596
- # The entry has been removed from DEPS.
1597
- scm = gclient_scm.GitWrapper(
1598
- prev_url, self.root_dir, entry_fixed, self.outbuf)
1599
-
1600
- # Check to see if this directory is now part of a higher-up checkout.
1601
- scm_root = None
1602
- try:
1603
- scm_root = gclient_scm.scm.GIT.GetCheckoutRoot(scm.checkout_path)
1604
- except subprocess2.CalledProcessError:
1605
- pass
1606
- if not scm_root:
1607
- logging.warning('Could not find checkout root for %s. Unable to '
1608
- 'determine whether it is part of a higher-level '
1609
- 'checkout, so not removing.' % entry)
1610
- continue
1611
-
1612
- # This is to handle the case of third_party/WebKit migrating from
1613
- # being a DEPS entry to being part of the main project.
1614
- # If the subproject is a Git project, we need to remove its .git
1615
- # folder. Otherwise git operations on that folder will have different
1616
- # effects depending on the current working directory.
1617
- if os.path.abspath(scm_root) == os.path.abspath(e_dir):
1618
- e_par_dir = os.path.join(e_dir, os.pardir)
1619
- if gclient_scm.scm.GIT.IsInsideWorkTree(e_par_dir):
1620
- par_scm_root = gclient_scm.scm.GIT.GetCheckoutRoot(e_par_dir)
1621
- # rel_e_dir : relative path of entry w.r.t. its parent repo.
1622
- rel_e_dir = os.path.relpath(e_dir, par_scm_root)
1623
- if gclient_scm.scm.GIT.IsDirectoryVersioned(
1624
- par_scm_root, rel_e_dir):
1625
- save_dir = scm.GetGitBackupDirPath()
1626
- # Remove any eventual stale backup dir for the same project.
1627
- if os.path.exists(save_dir):
1628
- gclient_utils.rmtree(save_dir)
1629
- os.rename(os.path.join(e_dir, '.git'), save_dir)
1630
- # When switching between the two states (entry/ is a subproject
1631
- # -> entry/ is part of the outer project), it is very likely
1632
- # that some files are changed in the checkout, unless we are
1633
- # jumping *exactly* across the commit which changed just DEPS.
1634
- # In such case we want to cleanup any eventual stale files
1635
- # (coming from the old subproject) in order to end up with a
1636
- # clean checkout.
1637
- gclient_scm.scm.GIT.CleanupDir(par_scm_root, rel_e_dir)
1638
- assert not os.path.exists(os.path.join(e_dir, '.git'))
1639
- print(('\nWARNING: \'%s\' has been moved from DEPS to a higher '
1640
- 'level checkout. The git folder containing all the local'
1641
- ' branches has been saved to %s.\n'
1642
- 'If you don\'t care about its state you can safely '
1643
- 'remove that folder to free up space.') %
1644
- (entry, save_dir))
1645
- continue
1646
-
1647
- if scm_root in full_entries:
1648
- logging.info('%s is part of a higher level checkout, not removing',
1649
- scm.GetCheckoutRoot())
1650
- continue
1651
-
1652
- file_list = []
1653
- scm.status(self._options, [], file_list)
1654
- modified_files = file_list != []
1655
- if (not self._options.delete_unversioned_trees or
1656
- (modified_files and not self._options.force)):
1657
- # There are modified files in this entry. Keep warning until
1658
- # removed.
1659
- print(('\nWARNING: \'%s\' is no longer part of this client. '
1660
- 'It is recommended that you manually remove it.\n') %
1661
- entry_fixed)
1662
- else:
1663
- # Delete the entry
1664
- print('\n________ deleting \'%s\' in \'%s\'' % (
1665
- entry_fixed, self.root_dir))
1666
- gclient_utils.rmtree(e_dir)
1667
- # record the current list of entries for next time
1668
- self._SaveEntries()
1770
+
1669
1771
  return 0
1670
1772
 
1671
1773
  def PrintRevInfo(self):
@@ -1677,7 +1779,8 @@ it or fix the checkout.
1677
1779
  for s in self.dependencies:
1678
1780
  if s.should_process:
1679
1781
  work_queue.enqueue(s)
1680
- work_queue.flush({}, None, [], options=self._options, patch_refs=None)
1782
+ work_queue.flush({}, None, [], options=self._options, patch_refs=None,
1783
+ target_branches=None)
1681
1784
 
1682
1785
  def ShouldPrintRevision(dep):
1683
1786
  return (not self._options.filter
@@ -1802,10 +1905,6 @@ class CipdDependency(Dependency):
1802
1905
  should_recurse=False,
1803
1906
  relative=relative,
1804
1907
  condition=condition)
1805
- if relative:
1806
- # TODO(jbudorick): Implement relative if necessary.
1807
- raise gclient_utils.Error(
1808
- 'Relative CIPD dependencies are not currently supported.')
1809
1908
  self._cipd_package = None
1810
1909
  self._cipd_root = cipd_root
1811
1910
  # CIPD wants /-separated paths, even on Windows.
@@ -1817,14 +1916,15 @@ class CipdDependency(Dependency):
1817
1916
 
1818
1917
  #override
1819
1918
  def run(self, revision_overrides, command, args, work_queue, options,
1820
- patch_refs):
1919
+ patch_refs, target_branches):
1821
1920
  """Runs |command| then parse the DEPS file."""
1822
1921
  logging.info('CipdDependency(%s).run()' % self.name)
1823
1922
  if not self.should_process:
1824
1923
  return
1825
1924
  self._CreatePackageIfNecessary()
1826
1925
  super(CipdDependency, self).run(revision_overrides, command, args,
1827
- work_queue, options, patch_refs)
1926
+ work_queue, options, patch_refs,
1927
+ target_branches)
1828
1928
 
1829
1929
  def _CreatePackageIfNecessary(self):
1830
1930
  # We lazily create the CIPD package to make sure that only packages
@@ -1857,8 +1957,14 @@ class CipdDependency(Dependency):
1857
1957
  self.url, self.root.root_dir, self.name, self.outbuf, out_cb,
1858
1958
  root=self._cipd_root, package=self._cipd_package)
1859
1959
 
1960
+ def hierarchy(self, include_url=False):
1961
+ return self.parent.hierarchy(include_url) + ' -> ' + self._cipd_subdir
1962
+
1860
1963
  def ToLines(self):
1861
1964
  """Return a list of lines representing this in a DEPS file."""
1965
+ def escape_cipd_var(package):
1966
+ return package.replace('{', '{{').replace('}', '}}')
1967
+
1862
1968
  s = []
1863
1969
  self._CreatePackageIfNecessary()
1864
1970
  if self._cipd_package.authority_for_subdir:
@@ -1874,7 +1980,7 @@ class CipdDependency(Dependency):
1874
1980
  cmp=lambda x, y: cmp(x.name, y.name)):
1875
1981
  s.extend([
1876
1982
  ' {',
1877
- ' "package": "%s",' % p.name,
1983
+ ' "package": "%s",' % escape_cipd_var(p.name),
1878
1984
  ' "version": "%s",' % p.version,
1879
1985
  ' },',
1880
1986
  ])
@@ -1893,6 +1999,7 @@ class CipdDependency(Dependency):
1893
1999
 
1894
2000
 
1895
2001
  @subcommand.usage('[command] [args ...]')
2002
+ @metrics.collector.collect_metrics('gclient recurse')
1896
2003
  def CMDrecurse(parser, args):
1897
2004
  """Operates [command args ...] on all the dependencies.
1898
2005
 
@@ -1937,6 +2044,7 @@ def CMDrecurse(parser, args):
1937
2044
 
1938
2045
 
1939
2046
  @subcommand.usage('[args ...]')
2047
+ @metrics.collector.collect_metrics('gclient fetch')
1940
2048
  def CMDfetch(parser, args):
1941
2049
  """Fetches upstream commits for all modules.
1942
2050
 
@@ -2073,7 +2181,9 @@ class Flattener(object):
2073
2181
  for key, value in dep._vars.iteritems():
2074
2182
  # Make sure there are no conflicting variables. It is fine however
2075
2183
  # to use same variable name, as long as the value is consistent.
2076
- assert key not in self._vars or self._vars[key][1] == value
2184
+ assert key not in self._vars or self._vars[key][1] == value, (
2185
+ "dep:%s key:%s value:%s != %s" % (
2186
+ dep.name, key, value, self._vars[key][1]))
2077
2187
  self._vars[key] = (hierarchy, value)
2078
2188
  # Override explicit custom variables.
2079
2189
  for key, value in dep.custom_vars.iteritems():
@@ -2100,6 +2210,7 @@ class Flattener(object):
2100
2210
  self._flatten_dep(d)
2101
2211
 
2102
2212
 
2213
+ @metrics.collector.collect_metrics('gclient flatten')
2103
2214
  def CMDflatten(parser, args):
2104
2215
  """Flattens the solutions into a single DEPS file."""
2105
2216
  parser.add_option('--output-deps', help='Path to the output DEPS file')
@@ -2211,9 +2322,10 @@ def _HooksToLines(name, hooks):
2211
2322
  s.append(' "pattern": "%s",' % hook.pattern)
2212
2323
  if hook.condition is not None:
2213
2324
  s.append(' "condition": %r,' % hook.condition)
2325
+ # Flattened hooks need to be written relative to the root gclient dir
2326
+ cwd = os.path.relpath(os.path.normpath(hook.effective_cwd))
2214
2327
  s.extend(
2215
- # Hooks run in the parent directory of their dep.
2216
- [' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] +
2328
+ [' "cwd": "%s",' % cwd] +
2217
2329
  [' "action": ['] +
2218
2330
  [' "%s",' % arg for arg in hook.action] +
2219
2331
  [' ]', ' },', '']
@@ -2240,9 +2352,10 @@ def _HooksOsToLines(hooks_os):
2240
2352
  s.append(' "pattern": "%s",' % hook.pattern)
2241
2353
  if hook.condition is not None:
2242
2354
  s.append(' "condition": %r,' % hook.condition)
2355
+ # Flattened hooks need to be written relative to the root gclient dir
2356
+ cwd = os.path.relpath(os.path.normpath(hook.effective_cwd))
2243
2357
  s.extend(
2244
- # Hooks run in the parent directory of their dep.
2245
- [' "cwd": "%s",' % os.path.normpath(os.path.dirname(dep.name))] +
2358
+ [' "cwd": "%s",' % cwd] +
2246
2359
  [' "action": ['] +
2247
2360
  [' "%s",' % arg for arg in hook.action] +
2248
2361
  [' ]', ' },', '']
@@ -2268,6 +2381,7 @@ def _VarsToLines(variables):
2268
2381
  return s
2269
2382
 
2270
2383
 
2384
+ @metrics.collector.collect_metrics('gclient grep')
2271
2385
  def CMDgrep(parser, args):
2272
2386
  """Greps through git repos managed by gclient.
2273
2387
 
@@ -2297,6 +2411,7 @@ def CMDgrep(parser, args):
2297
2411
  'git', 'grep', '--null', '--color=Always'] + args)
2298
2412
 
2299
2413
 
2414
+ @metrics.collector.collect_metrics('gclient root')
2300
2415
  def CMDroot(parser, args):
2301
2416
  """Outputs the solution root (or current dir if there isn't one)."""
2302
2417
  (options, args) = parser.parse_args(args)
@@ -2308,6 +2423,7 @@ def CMDroot(parser, args):
2308
2423
 
2309
2424
 
2310
2425
  @subcommand.usage('[url]')
2426
+ @metrics.collector.collect_metrics('gclient config')
2311
2427
  def CMDconfig(parser, args):
2312
2428
  """Creates a .gclient file in the current directory.
2313
2429
 
@@ -2335,6 +2451,11 @@ def CMDconfig(parser, args):
2335
2451
  'to have the main solution untouched by gclient '
2336
2452
  '(gclient will check out unmanaged dependencies but '
2337
2453
  'will never sync them)')
2454
+ parser.add_option('--cache-dir', default=UNSET_CACHE_DIR,
2455
+ help='Cache all git repos into this dir and do shared '
2456
+ 'clones from the cache, instead of cloning directly '
2457
+ 'from the remote. Pass "None" to disable cache, even '
2458
+ 'if globally enabled due to $GIT_CACHE_PATH.')
2338
2459
  parser.add_option('--custom-var', action='append', dest='custom_vars',
2339
2460
  default=[],
2340
2461
  help='overrides variables; key=value syntax')
@@ -2346,6 +2467,10 @@ def CMDconfig(parser, args):
2346
2467
  (not options.spec and not args)):
2347
2468
  parser.error('Inconsistent arguments. Use either --spec or one or 2 args')
2348
2469
 
2470
+ if (options.cache_dir is not UNSET_CACHE_DIR
2471
+ and options.cache_dir.lower() == 'none'):
2472
+ options.cache_dir = None
2473
+
2349
2474
  custom_vars = {}
2350
2475
  for arg in options.custom_vars:
2351
2476
  kv = arg.split('=', 1)
@@ -2384,6 +2509,7 @@ def CMDconfig(parser, args):
2384
2509
  gclient pack > patch.txt
2385
2510
  generate simple patch for configured client and dependences
2386
2511
  """)
2512
+ @metrics.collector.collect_metrics('gclient pack')
2387
2513
  def CMDpack(parser, args):
2388
2514
  """Generates a patch which can be applied at the root of the tree.
2389
2515
 
@@ -2408,6 +2534,7 @@ def CMDpack(parser, args):
2408
2534
  return client.RunOnDeps('pack', args)
2409
2535
 
2410
2536
 
2537
+ @metrics.collector.collect_metrics('gclient status')
2411
2538
  def CMDstatus(parser, args):
2412
2539
  """Shows modification status for every dependencies."""
2413
2540
  parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
@@ -2448,6 +2575,7 @@ os_deps, etc.)
2448
2575
  }
2449
2576
  }
2450
2577
  """)
2578
+ @metrics.collector.collect_metrics('gclient sync')
2451
2579
  def CMDsync(parser, args):
2452
2580
  """Checkout/update all modules."""
2453
2581
  parser.add_option('-f', '--force', action='store_true',
@@ -2468,13 +2596,21 @@ def CMDsync(parser, args):
2468
2596
  'work even if the src@ part is skipped.')
2469
2597
  parser.add_option('--patch-ref', action='append',
2470
2598
  dest='patch_refs', metavar='GERRIT_REF', default=[],
2471
- help='Patches the given reference with the format dep@ref. '
2472
- 'For dep, you can specify URLs as well as paths, with '
2473
- 'URLs taking preference. The reference will be '
2474
- 'applied to the necessary path, will be rebased on '
2475
- 'top what the dep was synced to, and then will do a '
2476
- 'soft reset. Use --no-rebase-patch-ref and '
2477
- '--reset-patch-ref to disable this behavior.')
2599
+ help='Patches the given reference with the format '
2600
+ 'dep@[target-ref:]patch-ref. '
2601
+ 'For |dep|, you can specify URLs as well as paths, '
2602
+ 'with URLs taking preference. '
2603
+ '|patch-ref| will be applied to |dep|, rebased on top '
2604
+ 'of what |dep| was synced to, and a soft reset will '
2605
+ 'be done. Use --no-rebase-patch-ref and '
2606
+ '--no-reset-patch-ref to disable this behavior. '
2607
+ '|target-ref| is the target branch against which a '
2608
+ 'patch was created, it is used to determine which '
2609
+ 'commits from the |patch-ref| actually constitute a '
2610
+ 'patch. If not given, we will iterate over all remote '
2611
+ 'branches and select one that contains the revision '
2612
+ '|dep| is synced at. '
2613
+ 'WARNING: |target-ref| will be mandatory soon.')
2478
2614
  parser.add_option('--with_branch_heads', action='store_true',
2479
2615
  help='Clone git "branch_heads" refspecs in addition to '
2480
2616
  'the default refspecs. This adds about 1/2GB to a '
@@ -2565,14 +2701,11 @@ def CMDsync(parser, args):
2565
2701
  slns = {}
2566
2702
  for d in client.subtree(True):
2567
2703
  normed = d.name.replace('\\', '/').rstrip('/') + '/'
2568
- if normed in slns and not d.should_process:
2569
- # If an unprocessed dependency would override an existing dependency,
2570
- # ignore it.
2571
- continue
2572
2704
  slns[normed] = {
2573
2705
  'revision': d.got_revision,
2574
2706
  'scm': d.used_scm.name if d.used_scm else None,
2575
2707
  'url': str(d.url) if d.url else None,
2708
+ 'was_processed': d.should_process,
2576
2709
  }
2577
2710
  with open(options.output_json, 'wb') as f:
2578
2711
  json.dump({'solutions': slns}, f)
@@ -2582,6 +2715,7 @@ def CMDsync(parser, args):
2582
2715
  CMDupdate = CMDsync
2583
2716
 
2584
2717
 
2718
+ @metrics.collector.collect_metrics('gclient validate')
2585
2719
  def CMDvalidate(parser, args):
2586
2720
  """Validates the .gclient and DEPS syntax."""
2587
2721
  options, args = parser.parse_args(args)
@@ -2595,6 +2729,7 @@ def CMDvalidate(parser, args):
2595
2729
  return rv
2596
2730
 
2597
2731
 
2732
+ @metrics.collector.collect_metrics('gclient diff')
2598
2733
  def CMDdiff(parser, args):
2599
2734
  """Displays local diff for every dependencies."""
2600
2735
  parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
@@ -2610,6 +2745,7 @@ def CMDdiff(parser, args):
2610
2745
  return client.RunOnDeps('diff', args)
2611
2746
 
2612
2747
 
2748
+ @metrics.collector.collect_metrics('gclient revert')
2613
2749
  def CMDrevert(parser, args):
2614
2750
  """Reverts all modifications in every dependencies.
2615
2751
 
@@ -2642,6 +2778,7 @@ def CMDrevert(parser, args):
2642
2778
  return client.RunOnDeps('revert', args)
2643
2779
 
2644
2780
 
2781
+ @metrics.collector.collect_metrics('gclient runhooks')
2645
2782
  def CMDrunhooks(parser, args):
2646
2783
  """Runs hooks for files that have been modified in the local working copy."""
2647
2784
  parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
@@ -2661,6 +2798,7 @@ def CMDrunhooks(parser, args):
2661
2798
  return client.RunOnDeps('runhooks', args)
2662
2799
 
2663
2800
 
2801
+ @metrics.collector.collect_metrics('gclient revinfo')
2664
2802
  def CMDrevinfo(parser, args):
2665
2803
  """Outputs revision info mapping for the client and its dependencies.
2666
2804
 
@@ -2686,6 +2824,8 @@ def CMDrevinfo(parser, args):
2686
2824
  parser.add_option('--output-json',
2687
2825
  help='Output a json document to this path containing '
2688
2826
  'information about the revisions.')
2827
+ parser.add_option('--ignore-dep-type', choices=['git', 'cipd'],
2828
+ help='Specify to skip processing of a certain type of dep.')
2689
2829
  (options, args) = parser.parse_args(args)
2690
2830
  client = GClient.LoadCurrentConfig(options)
2691
2831
  if not client:
@@ -2694,13 +2834,14 @@ def CMDrevinfo(parser, args):
2694
2834
  return 0
2695
2835
 
2696
2836
 
2837
+ @metrics.collector.collect_metrics('gclient getdep')
2697
2838
  def CMDgetdep(parser, args):
2698
2839
  """Gets revision information and variable values from a DEPS file."""
2699
2840
  parser.add_option('--var', action='append',
2700
2841
  dest='vars', metavar='VAR', default=[],
2701
2842
  help='Gets the value of a given variable.')
2702
2843
  parser.add_option('-r', '--revision', action='append',
2703
- dest='revisions', metavar='DEP', default=[],
2844
+ dest='getdep_revisions', metavar='DEP', default=[],
2704
2845
  help='Gets the revision/version for the given dependency. '
2705
2846
  'If it is a git dependency, dep must be a path. If it '
2706
2847
  'is a CIPD dependency, dep must be of the form '
@@ -2717,12 +2858,21 @@ def CMDgetdep(parser, args):
2717
2858
  'DEPS file %s does not exist.' % options.deps_file)
2718
2859
  with open(options.deps_file) as f:
2719
2860
  contents = f.read()
2720
- local_scope = gclient_eval.Exec(contents, options.deps_file)
2861
+ client = GClient.LoadCurrentConfig(options)
2862
+ if client is not None:
2863
+ builtin_vars = client.get_builtin_vars()
2864
+ else:
2865
+ logging.warn(
2866
+ 'Couldn\'t find a valid gclient config. Will attempt to parse the DEPS '
2867
+ 'file without support for built-in variables.')
2868
+ builtin_vars = None
2869
+ local_scope = gclient_eval.Exec(contents, options.deps_file,
2870
+ builtin_vars=builtin_vars)
2721
2871
 
2722
2872
  for var in options.vars:
2723
2873
  print(gclient_eval.GetVar(local_scope, var))
2724
2874
 
2725
- for name in options.revisions:
2875
+ for name in options.getdep_revisions:
2726
2876
  if ':' in name:
2727
2877
  name, _, package = name.partition(':')
2728
2878
  if not name or not package:
@@ -2734,6 +2884,7 @@ def CMDgetdep(parser, args):
2734
2884
  print(gclient_eval.GetRevision(local_scope, name))
2735
2885
 
2736
2886
 
2887
+ @metrics.collector.collect_metrics('gclient setdep')
2737
2888
  def CMDsetdep(parser, args):
2738
2889
  """Modifies dependency revisions and variable values in a DEPS file"""
2739
2890
  parser.add_option('--var', action='append',
@@ -2741,7 +2892,7 @@ def CMDsetdep(parser, args):
2741
2892
  help='Sets a variable to the given value with the format '
2742
2893
  'name=value.')
2743
2894
  parser.add_option('-r', '--revision', action='append',
2744
- dest='revisions', metavar='DEP@REV', default=[],
2895
+ dest='setdep_revisions', metavar='DEP@REV', default=[],
2745
2896
  help='Sets the revision/version for the dependency with '
2746
2897
  'the format dep@rev. If it is a git dependency, dep '
2747
2898
  'must be a path and rev must be a git hash or '
@@ -2757,7 +2908,7 @@ def CMDsetdep(parser, args):
2757
2908
  (options, args) = parser.parse_args(args)
2758
2909
  if args:
2759
2910
  parser.error('Unused arguments: "%s"' % '" "'.join(args))
2760
- if not options.revisions and not options.vars:
2911
+ if not options.setdep_revisions and not options.vars:
2761
2912
  parser.error(
2762
2913
  'You must specify at least one variable or revision to modify.')
2763
2914
 
@@ -2766,7 +2917,18 @@ def CMDsetdep(parser, args):
2766
2917
  'DEPS file %s does not exist.' % options.deps_file)
2767
2918
  with open(options.deps_file) as f:
2768
2919
  contents = f.read()
2769
- local_scope = gclient_eval.Exec(contents, options.deps_file)
2920
+
2921
+ client = GClient.LoadCurrentConfig(options)
2922
+ if client is not None:
2923
+ builtin_vars = client.get_builtin_vars()
2924
+ else:
2925
+ logging.warn(
2926
+ 'Couldn\'t find a valid gclient config. Will attempt to parse the DEPS '
2927
+ 'file without support for built-in variables.')
2928
+ builtin_vars = None
2929
+
2930
+ local_scope = gclient_eval.Exec(contents, options.deps_file,
2931
+ builtin_vars=builtin_vars)
2770
2932
 
2771
2933
  for var in options.vars:
2772
2934
  name, _, value = var.partition('=')
@@ -2778,7 +2940,7 @@ def CMDsetdep(parser, args):
2778
2940
  else:
2779
2941
  gclient_eval.AddVar(local_scope, name, value)
2780
2942
 
2781
- for revision in options.revisions:
2943
+ for revision in options.setdep_revisions:
2782
2944
  name, _, value = revision.partition('@')
2783
2945
  if not name or not value:
2784
2946
  parser.error(
@@ -2797,6 +2959,7 @@ def CMDsetdep(parser, args):
2797
2959
  f.write(gclient_eval.RenderDEPSFile(local_scope))
2798
2960
 
2799
2961
 
2962
+ @metrics.collector.collect_metrics('gclient verify')
2800
2963
  def CMDverify(parser, args):
2801
2964
  """Verifies the DEPS file deps are only from allowed_hosts."""
2802
2965
  (options, args) = parser.parse_args(args)
@@ -2818,6 +2981,36 @@ def CMDverify(parser, args):
2818
2981
  'dependencies from disallowed hosts; check your DEPS file.')
2819
2982
  return 0
2820
2983
 
2984
+
2985
+ @subcommand.epilog("""For more information on what metrics are we collecting and
2986
+ why, please read metrics.README.md or visit https://bit.ly/2ufRS4p""")
2987
+ @metrics.collector.collect_metrics('gclient metrics')
2988
+ def CMDmetrics(parser, args):
2989
+ """Reports, and optionally modifies, the status of metric collection."""
2990
+ parser.add_option('--opt-in', action='store_true', dest='enable_metrics',
2991
+ help='Opt-in to metrics collection.',
2992
+ default=None)
2993
+ parser.add_option('--opt-out', action='store_false', dest='enable_metrics',
2994
+ help='Opt-out of metrics collection.')
2995
+ options, args = parser.parse_args(args)
2996
+ if args:
2997
+ parser.error('Unused arguments: "%s"' % '" "'.join(args))
2998
+ if not metrics.collector.config.is_googler:
2999
+ print("You're not a Googler. Metrics collection is disabled for you.")
3000
+ return 0
3001
+
3002
+ if options.enable_metrics is not None:
3003
+ metrics.collector.config.opted_in = options.enable_metrics
3004
+
3005
+ if metrics.collector.config.opted_in is None:
3006
+ print("You haven't opted in or out of metrics collection.")
3007
+ elif metrics.collector.config.opted_in:
3008
+ print("You have opted in. Thanks!")
3009
+ else:
3010
+ print("You have opted out. Please consider opting in.")
3011
+ return 0
3012
+
3013
+
2821
3014
  class OptionParser(optparse.OptionParser):
2822
3015
  gclientfile_default = os.environ.get('GCLIENT_FILE', '.gclient')
2823
3016
 
@@ -2846,19 +3039,25 @@ class OptionParser(optparse.OptionParser):
2846
3039
  '--spec',
2847
3040
  help='create a gclient file containing the provided string. Due to '
2848
3041
  'Cygwin/Python brokenness, it can\'t contain any newlines.')
2849
- self.add_option(
2850
- '--cache-dir',
2851
- help='(git only) Cache all git repos into this dir and do '
2852
- 'shared clones from the cache, instead of cloning '
2853
- 'directly from the remote. (experimental)',
2854
- default=os.environ.get('GCLIENT_CACHE_DIR'))
2855
3042
  self.add_option(
2856
3043
  '--no-nag-max', default=False, action='store_true',
2857
3044
  help='Ignored for backwards compatibility.')
2858
3045
 
2859
- def parse_args(self, args=None, values=None):
3046
+ def parse_args(self, args=None, _values=None):
2860
3047
  """Integrates standard options processing."""
2861
- options, args = optparse.OptionParser.parse_args(self, args, values)
3048
+ # Create an optparse.Values object that will store only the actual passed
3049
+ # options, without the defaults.
3050
+ actual_options = optparse.Values()
3051
+ _, args = optparse.OptionParser.parse_args(self, args, actual_options)
3052
+ # Create an optparse.Values object with the default options.
3053
+ options = optparse.Values(self.get_default_values().__dict__)
3054
+ # Update it with the options passed by the user.
3055
+ options._update_careful(actual_options.__dict__)
3056
+ # Store the options passed by the user in an _actual_options attribute.
3057
+ # We store only the keys, and not the values, since the values can contain
3058
+ # arbitrary information, which might be PII.
3059
+ metrics.collector.add('arguments', actual_options.__dict__.keys())
3060
+
2862
3061
  levels = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
2863
3062
  logging.basicConfig(
2864
3063
  level=levels[min(options.verbose, len(levels) - 1)],
@@ -2899,19 +3098,40 @@ def disable_buffering():
2899
3098
  sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout)
2900
3099
 
2901
3100
 
2902
- def main(argv):
2903
- """Doesn't parse the arguments here, just find the right subcommand to
2904
- execute."""
3101
+ def path_contains_tilde():
3102
+ for element in os.environ['PATH'].split(os.pathsep):
3103
+ if element.startswith('~/'):
3104
+ return True
3105
+ return False
3106
+
3107
+
3108
+ def can_run_gclient_and_helpers():
2905
3109
  if sys.hexversion < 0x02060000:
2906
3110
  print(
2907
3111
  '\nYour python version %s is unsupported, please upgrade.\n' %
2908
3112
  sys.version.split(' ', 1)[0],
2909
3113
  file=sys.stderr)
2910
- return 2
3114
+ return False
2911
3115
  if not sys.executable:
2912
3116
  print(
2913
3117
  '\nPython cannot find the location of it\'s own executable.\n',
2914
3118
  file=sys.stderr)
3119
+ return False
3120
+ if path_contains_tilde():
3121
+ print(
3122
+ '\nYour PATH contains a literal "~", which works in some shells ' +
3123
+ 'but will break when python tries to run subprocesses. ' +
3124
+ 'Replace the "~" with $HOME.\n' +
3125
+ 'See https://crbug.com/952865.\n',
3126
+ file=sys.stderr)
3127
+ return False
3128
+ return True
3129
+
3130
+
3131
+ def main(argv):
3132
+ """Doesn't parse the arguments here, just find the right subcommand to
3133
+ execute."""
3134
+ if not can_run_gclient_and_helpers():
2915
3135
  return 2
2916
3136
  fix_encoding.fix_encoding()
2917
3137
  disable_buffering()
@@ -2931,10 +3151,7 @@ def main(argv):
2931
3151
 
2932
3152
 
2933
3153
  if '__main__' == __name__:
2934
- try:
3154
+ with metrics.collector.print_notice_and_exit():
2935
3155
  sys.exit(main(sys.argv[1:]))
2936
- except KeyboardInterrupt:
2937
- sys.stderr.write('interrupted\n')
2938
- sys.exit(1)
2939
3156
 
2940
3157
  # vim: ts=2:sw=2:tw=80:et: