libv8 4.5.95.5 → 5.0.71.48.0beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +45 -19
- data/CHANGELOG.md +14 -0
- data/README.md +30 -15
- data/Rakefile +7 -6
- data/ext/libv8/arch.rb +5 -4
- data/ext/libv8/builder.rb +25 -19
- data/ext/libv8/compiler.rb +6 -33
- data/ext/libv8/location.rb +7 -8
- data/lib/libv8/version.rb +1 -1
- data/libv8.gemspec +1 -1
- data/patches/build-standalone-static-library.patch +14 -0
- data/patches/disable-building-tests.patch +48 -10
- data/patches/fPIC-for-static.patch +3 -3
- data/release/x86-linux/Vagrantfile +8 -4
- data/release/x86_64-freebsd10/Vagrantfile +86 -0
- data/release/x86_64-linux/Vagrantfile +8 -4
- data/spec/compiler_spec.rb +5 -29
- data/spec/support/compiler_helpers.rb +2 -4
- data/vendor/depot_tools/.gitignore +15 -3
- data/vendor/depot_tools/OWNERS +2 -2
- data/vendor/depot_tools/PRESUBMIT.py +4 -2
- data/vendor/depot_tools/WATCHLISTS +6 -0
- data/vendor/depot_tools/apply_issue.py +70 -38
- data/vendor/depot_tools/bootstrap/win/README.md +66 -0
- data/vendor/depot_tools/bootstrap/win/git-bash.template.sh +12 -0
- data/vendor/depot_tools/bootstrap/win/git.template.bat +5 -0
- data/vendor/depot_tools/bootstrap/win/profile.d.python.sh +20 -0
- data/vendor/depot_tools/bootstrap/win/win_tools.bat +96 -45
- data/vendor/depot_tools/breakpad.py +6 -141
- data/vendor/depot_tools/buildbucket.py +45 -31
- data/vendor/depot_tools/cbuildbot +1 -0
- data/vendor/depot_tools/checkout.py +2 -1
- data/vendor/depot_tools/chrome_set_ver +1 -0
- data/vendor/depot_tools/cit +8 -0
- data/vendor/depot_tools/cit.bat +11 -0
- data/vendor/depot_tools/cit.py +120 -0
- data/vendor/depot_tools/codereview.settings +0 -2
- data/vendor/depot_tools/commit_queue +1 -5
- data/vendor/depot_tools/commit_queue.bat +1 -4
- data/vendor/depot_tools/commit_queue.py +78 -29
- data/vendor/depot_tools/cpplint.py +22 -14
- data/vendor/depot_tools/cros +1 -0
- data/vendor/depot_tools/cros_sdk +1 -0
- data/vendor/depot_tools/depot-tools-auth.py +3 -3
- data/vendor/depot_tools/download_from_google_storage.py +101 -21
- data/vendor/depot_tools/drover.py +2 -3
- data/vendor/depot_tools/fetch.py +31 -27
- data/vendor/depot_tools/{recipes → fetch_configs}/android.py +4 -4
- data/vendor/depot_tools/fetch_configs/breakpad.py +45 -0
- data/vendor/depot_tools/{recipes → fetch_configs}/chromium.py +3 -3
- data/vendor/depot_tools/{recipes/recipe_util.py → fetch_configs/config_util.py} +3 -3
- data/vendor/depot_tools/fetch_configs/crashpad.py +41 -0
- data/vendor/depot_tools/{recipes → fetch_configs}/dart.py +3 -3
- data/vendor/depot_tools/{recipes/pdfium.py → fetch_configs/dartino.py} +14 -13
- data/vendor/depot_tools/{recipes → fetch_configs}/dartium.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/depot_tools.py +3 -3
- data/vendor/depot_tools/fetch_configs/gyp.py +42 -0
- data/vendor/depot_tools/{recipes → fetch_configs}/infra.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/infra_internal.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/ios.py +4 -4
- data/vendor/depot_tools/{recipes → fetch_configs}/mojo.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/nacl.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/naclports.py +3 -3
- data/vendor/depot_tools/fetch_configs/pdfium.py +40 -0
- data/vendor/depot_tools/{recipes → fetch_configs}/skia.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/skia_buildbot.py +3 -3
- data/vendor/depot_tools/fetch_configs/syzygy.py +41 -0
- data/vendor/depot_tools/{recipes → fetch_configs}/v8.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/webrtc.py +3 -3
- data/vendor/depot_tools/{recipes → fetch_configs}/webrtc_android.py +4 -4
- data/vendor/depot_tools/{recipes → fetch_configs}/webrtc_ios.py +4 -4
- data/vendor/depot_tools/fix_encoding.py +6 -6
- data/vendor/depot_tools/gcl.py +11 -21
- data/vendor/depot_tools/gclient +10 -0
- data/vendor/depot_tools/gclient-new-workdir.py +7 -38
- data/vendor/depot_tools/gclient.bat +2 -2
- data/vendor/depot_tools/gclient.py +85 -65
- data/vendor/depot_tools/gclient_scm.py +83 -10
- data/vendor/depot_tools/gclient_utils.py +5 -1
- data/vendor/depot_tools/gerrit_util.py +243 -26
- data/vendor/depot_tools/git-auto-svn +1 -1
- data/vendor/depot_tools/git-cache +1 -1
- data/vendor/depot_tools/git-cherry-pick-upload +1 -1
- data/vendor/depot_tools/git-cl +1 -1
- data/vendor/depot_tools/git-drover +6 -0
- data/vendor/depot_tools/git-find-releases +6 -0
- data/vendor/depot_tools/git-footers +1 -1
- data/vendor/depot_tools/git-freeze +1 -1
- data/vendor/depot_tools/git-gs +1 -1
- data/vendor/depot_tools/git-hyper-blame +6 -0
- data/vendor/depot_tools/git-map +1 -1
- data/vendor/depot_tools/git-map-branches +1 -1
- data/vendor/depot_tools/git-mark-merge-base +1 -1
- data/vendor/depot_tools/git-nav-downstream +1 -1
- data/vendor/depot_tools/git-new-branch +1 -1
- data/vendor/depot_tools/git-number +1 -1
- data/vendor/depot_tools/git-rebase-update +1 -1
- data/vendor/depot_tools/git-rename-branch +1 -1
- data/vendor/depot_tools/git-reparent-branch +1 -1
- data/vendor/depot_tools/git-retry +1 -1
- data/vendor/depot_tools/git-squash-branch +1 -1
- data/vendor/depot_tools/git-thaw +1 -1
- data/vendor/depot_tools/git-try +1 -1
- data/vendor/depot_tools/git-upstream-diff +1 -1
- data/vendor/depot_tools/git_auto_svn.py +24 -6
- data/vendor/depot_tools/git_cache.py +74 -27
- data/vendor/depot_tools/git_cl.py +2118 -747
- data/vendor/depot_tools/git_common.py +100 -6
- data/vendor/depot_tools/git_dates.py +62 -0
- data/vendor/depot_tools/git_drover.py +424 -0
- data/vendor/depot_tools/git_find_releases.py +65 -0
- data/vendor/depot_tools/git_footers.py +42 -0
- data/vendor/depot_tools/git_hyper_blame.py +391 -0
- data/vendor/depot_tools/git_map_branches.py +8 -6
- data/vendor/depot_tools/git_new_branch.py +6 -1
- data/vendor/depot_tools/git_rebase_update.py +56 -16
- data/vendor/depot_tools/git_reparent_branch.py +13 -0
- data/vendor/depot_tools/git_try.py +0 -2
- data/vendor/depot_tools/gsutil.py +51 -20
- data/vendor/depot_tools/infra/config/OWNERS +3 -1
- data/vendor/depot_tools/infra/config/cq.cfg +7 -3
- data/vendor/depot_tools/infra/config/recipes.cfg +9 -0
- data/vendor/depot_tools/luci_hacks/README.md +35 -0
- data/vendor/depot_tools/{bootstrap/virtualenv/tests → luci_hacks}/__init__.py +0 -0
- data/vendor/depot_tools/luci_hacks/luci_recipe_run.isolate +12 -0
- data/vendor/depot_tools/luci_hacks/luci_recipe_run.py +81 -0
- data/vendor/depot_tools/luci_hacks/trigger_luci_job.py +128 -0
- data/vendor/depot_tools/man/html/depot_tools.html +9 -1
- data/vendor/depot_tools/man/html/depot_tools_tutorial.html +4 -4
- data/vendor/depot_tools/man/html/git-drover.html +191 -35
- data/vendor/depot_tools/man/html/git-hyper-blame.html +878 -0
- data/vendor/depot_tools/man/html/git-rebase-update.html +9 -4
- data/vendor/depot_tools/man/man1/git-drover.1 +189 -36
- data/vendor/depot_tools/man/man1/git-hyper-blame.1 +128 -0
- data/vendor/depot_tools/man/man1/git-rebase-update.1 +8 -6
- data/vendor/depot_tools/man/man7/depot_tools.7 +9 -4
- data/vendor/depot_tools/man/src/_git-hyper-blame_desc.helper.txt +1 -0
- data/vendor/depot_tools/man/src/common_demo_functions.sh +5 -0
- data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +1 -1
- data/vendor/depot_tools/man/src/git-drover.demo.1.sh +11 -16
- data/vendor/depot_tools/man/src/git-drover.demo.3.sh +27 -0
- data/vendor/depot_tools/man/src/git-drover.demo.4.sh +39 -0
- data/vendor/depot_tools/man/src/git-drover.txt +49 -3
- data/vendor/depot_tools/man/src/git-hyper-blame.demo.1.sh +3 -0
- data/vendor/depot_tools/man/src/git-hyper-blame.demo.2.sh +4 -0
- data/vendor/depot_tools/man/src/git-hyper-blame.demo.common.sh +57 -0
- data/vendor/depot_tools/man/src/git-hyper-blame.txt +85 -0
- data/vendor/depot_tools/man/src/git-rebase-update.txt +5 -1
- data/vendor/depot_tools/my_activity.py +6 -21
- data/vendor/depot_tools/ninja +2 -2
- data/vendor/depot_tools/ninja-linux32 +0 -0
- data/vendor/depot_tools/ninja-linux64 +0 -0
- data/vendor/depot_tools/ninja-mac +0 -0
- data/vendor/depot_tools/ninja.exe +0 -0
- data/vendor/depot_tools/presubmit_canned_checks.py +83 -69
- data/vendor/depot_tools/presubmit_support.py +126 -42
- data/vendor/depot_tools/pylint.py +5 -1
- data/vendor/depot_tools/python_runner.sh +55 -0
- data/vendor/depot_tools/recipe_modules/bot_update/__init__.py +32 -0
- data/vendor/depot_tools/recipe_modules/bot_update/api.py +283 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic.json +56 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_output_manifest.json +63 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +57 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/clobber.json +44 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/forced.json +57 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +44 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/no_shallow.json +44 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/off.json +43 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +43 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/svn_mode.json +59 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange.json +58 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2.json +60 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob.json +58 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +60 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +81 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +81 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +49 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8.json +61 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +51 -0
- data/vendor/depot_tools/recipe_modules/bot_update/example.py +172 -0
- data/vendor/depot_tools/{bootstrap/virtualenv/virtualenv_support → recipe_modules/bot_update/resources}/__init__.py +0 -0
- data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +1764 -0
- data/vendor/depot_tools/recipe_modules/bot_update/test_api.py +86 -0
- data/vendor/depot_tools/recipe_modules/depot_tools/__init__.py +3 -0
- data/vendor/depot_tools/recipe_modules/depot_tools/api.py +27 -0
- data/vendor/depot_tools/recipe_modules/gclient/__init__.py +10 -0
- data/vendor/depot_tools/recipe_modules/gclient/api.py +378 -0
- data/vendor/depot_tools/recipe_modules/gclient/config.py +671 -0
- data/vendor/depot_tools/recipe_modules/gclient/example.expected/basic.json +172 -0
- data/vendor/depot_tools/recipe_modules/gclient/example.expected/revision.json +174 -0
- data/vendor/depot_tools/recipe_modules/gclient/example.expected/tryserver.json +185 -0
- data/vendor/depot_tools/recipe_modules/gclient/example.py +100 -0
- data/vendor/depot_tools/recipe_modules/gclient/test_api.py +37 -0
- data/vendor/depot_tools/recipe_modules/git/__init__.py +9 -0
- data/vendor/depot_tools/recipe_modules/git/api.py +377 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic.json +177 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic_branch.json +177 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic_file_name.json +179 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic_hash.json +176 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic_ref.json +177 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/basic_submodule_update_force.json +178 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +153 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/cannot_fail_build.json +181 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/cat-file_test.json +199 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_delta.json +250 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_failed.json +181 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output.json +182 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +102 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/curl_trace_file.json +181 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +186 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +179 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/remote_not_origin.json +179 -0
- data/vendor/depot_tools/recipe_modules/git/example.expected/set_got_revision.json +178 -0
- data/vendor/depot_tools/recipe_modules/git/example.py +147 -0
- data/vendor/depot_tools/recipe_modules/git/resources/git_setup.py +61 -0
- data/vendor/depot_tools/recipe_modules/git/test_api.py +18 -0
- data/vendor/depot_tools/recipe_modules/git_cl/__init__.py +4 -0
- data/vendor/depot_tools/recipe_modules/git_cl/api.py +25 -0
- data/vendor/depot_tools/recipe_modules/git_cl/config.py +22 -0
- data/vendor/depot_tools/recipe_modules/git_cl/example.expected/basic.json +66 -0
- data/vendor/depot_tools/recipe_modules/git_cl/example.py +41 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/__init__.py +4 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/api.py +12 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/basic.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_linux.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_mac.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_win.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_linux.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_mac.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_win.json +14 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/example.py +28 -0
- data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +45 -0
- data/vendor/depot_tools/recipe_modules/presubmit/__init__.py +4 -0
- data/vendor/depot_tools/recipe_modules/presubmit/api.py +20 -0
- data/vendor/depot_tools/recipe_modules/presubmit/example.expected/basic.json +18 -0
- data/vendor/depot_tools/recipe_modules/presubmit/example.py +15 -0
- data/vendor/depot_tools/recipe_modules/rietveld/__init__.py +5 -0
- data/vendor/depot_tools/recipe_modules/rietveld/api.py +94 -0
- data/vendor/depot_tools/recipe_modules/rietveld/example.expected/basic.json +30 -0
- data/vendor/depot_tools/recipe_modules/rietveld/example.py +24 -0
- data/vendor/depot_tools/recipe_modules/tryserver/__init__.py +15 -0
- data/vendor/depot_tools/recipe_modules/tryserver/api.py +280 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +104 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +58 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +58 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_svn_patch.json +68 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +43 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +43 -0
- data/vendor/depot_tools/recipe_modules/tryserver/example.py +53 -0
- data/vendor/depot_tools/recipe_modules/tryserver/test_api.py +7 -0
- data/vendor/depot_tools/recipes.py +136 -0
- data/vendor/depot_tools/repo +1 -1
- data/vendor/depot_tools/rietveld.py +46 -15
- data/vendor/depot_tools/roll_dep.py +97 -36
- data/vendor/depot_tools/scm.py +3 -3
- data/vendor/depot_tools/setup_color.py +94 -0
- data/vendor/depot_tools/subprocess2.py +10 -1
- data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -1
- data/vendor/depot_tools/third_party/cq_client/README.md +47 -9
- data/vendor/depot_tools/third_party/cq_client/cq.pb.go +617 -0
- data/vendor/depot_tools/third_party/cq_client/cq.proto +75 -17
- data/vendor/depot_tools/third_party/cq_client/cq_pb2.py +168 -41
- data/vendor/depot_tools/third_party/cq_client/testdata/cq_gerrit.cfg +55 -0
- data/vendor/depot_tools/third_party/cq_client/{test/cq_example.cfg → testdata/cq_rietveld.cfg} +14 -6
- data/vendor/depot_tools/third_party/fancy_urllib/README +5 -4
- data/vendor/depot_tools/third_party/fancy_urllib/__init__.py +114 -52
- data/vendor/depot_tools/third_party/protobuf26/README.chromium +9 -6
- data/vendor/depot_tools/third_party/upload.py +17 -31
- data/vendor/depot_tools/trychange.py +0 -2
- data/vendor/depot_tools/update_depot_tools +29 -11
- data/vendor/depot_tools/update_depot_tools.bat +4 -9
- data/vendor/depot_tools/upload_to_google_storage.py +42 -5
- data/vendor/depot_tools/win_toolchain/OWNERS +1 -0
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +227 -52
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +203 -88
- metadata +161 -81
- data/patches/arm/do-not-imply-vfp3-and-armv7.patch +0 -16
- data/patches/arm/do-not-use-vfp2.patch +0 -13
- data/patches/clang51/no-unused-variable.patch +0 -12
- data/vendor/depot_tools/bootstrap/.gitignore +0 -2
- data/vendor/depot_tools/bootstrap/bootstrap.py +0 -234
- data/vendor/depot_tools/bootstrap/deps.pyl +0 -15
- data/vendor/depot_tools/bootstrap/util.py +0 -87
- data/vendor/depot_tools/bootstrap/virtualenv/.gitignore +0 -10
- data/vendor/depot_tools/bootstrap/virtualenv/.travis.yml +0 -28
- data/vendor/depot_tools/bootstrap/virtualenv/AUTHORS.txt +0 -91
- data/vendor/depot_tools/bootstrap/virtualenv/CONTRIBUTING.rst +0 -21
- data/vendor/depot_tools/bootstrap/virtualenv/LICENSE.txt +0 -22
- data/vendor/depot_tools/bootstrap/virtualenv/MANIFEST.in +0 -11
- data/vendor/depot_tools/bootstrap/virtualenv/README.rst +0 -10
- data/vendor/depot_tools/bootstrap/virtualenv/bin/rebuild-script.py +0 -71
- data/vendor/depot_tools/bootstrap/virtualenv/docs/changes.rst +0 -747
- data/vendor/depot_tools/bootstrap/virtualenv/docs/conf.py +0 -149
- data/vendor/depot_tools/bootstrap/virtualenv/docs/development.rst +0 -61
- data/vendor/depot_tools/bootstrap/virtualenv/docs/index.rst +0 -137
- data/vendor/depot_tools/bootstrap/virtualenv/docs/installation.rst +0 -58
- data/vendor/depot_tools/bootstrap/virtualenv/docs/make.bat +0 -170
- data/vendor/depot_tools/bootstrap/virtualenv/docs/reference.rst +0 -256
- data/vendor/depot_tools/bootstrap/virtualenv/docs/userguide.rst +0 -249
- data/vendor/depot_tools/bootstrap/virtualenv/scripts/virtualenv +0 -3
- data/vendor/depot_tools/bootstrap/virtualenv/setup.py +0 -111
- data/vendor/depot_tools/bootstrap/virtualenv/tests/test_activate.sh +0 -94
- data/vendor/depot_tools/bootstrap/virtualenv/tests/test_activate_expected.output +0 -2
- data/vendor/depot_tools/bootstrap/virtualenv/tests/test_virtualenv.py +0 -139
- data/vendor/depot_tools/bootstrap/virtualenv/tests/tox.ini +0 -12
- data/vendor/depot_tools/bootstrap/virtualenv/tox.ini +0 -17
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv.py +0 -2367
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.bat +0 -26
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.csh +0 -42
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.fish +0 -74
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.ps1 +0 -150
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.sh +0 -80
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate_this.py +0 -34
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/deactivate.bat +0 -20
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/distutils-init.py +0 -101
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/distutils.cfg +0 -6
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/site.py +0 -758
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_support/pip-6.0-py2.py3-none-any.whl +0 -0
- data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_support/setuptools-8.2.1-py2.py3-none-any.whl +0 -0
- data/vendor/depot_tools/bootstrap/win/README.google +0 -16
- data/vendor/depot_tools/cbuildbot +0 -96
- data/vendor/depot_tools/chrome_set_ver +0 -96
- data/vendor/depot_tools/cros +0 -96
- data/vendor/depot_tools/cros_sdk +0 -96
- data/vendor/depot_tools/git-cl-upload-hook +0 -52
- data/vendor/depot_tools/git-crup +0 -45
- data/vendor/depot_tools/python_git_runner.sh +0 -36
- data/vendor/depot_tools/recipes/blink.py +0 -59
- data/vendor/depot_tools/third_party/cq_client/test/validate_config_test.py +0 -52
- data/vendor/depot_tools/third_party/cq_client/validate_config.py +0 -108
- data/vendor/depot_tools/win_toolchain/toolchain2013.py +0 -494
@@ -30,6 +30,10 @@ GSUTIL_DEFAULT_PATH = os.path.join(
|
|
30
30
|
os.path.dirname(os.path.abspath(__file__)), 'gsutil.py')
|
31
31
|
|
32
32
|
|
33
|
+
class NoUsableRevError(gclient_utils.Error):
|
34
|
+
"""Raised if requested revision isn't found in checkout."""
|
35
|
+
|
36
|
+
|
33
37
|
class DiffFiltererWrapper(object):
|
34
38
|
"""Simple base class which tracks which file is being diffed and
|
35
39
|
replaces instances of its file name in the original and
|
@@ -323,6 +327,27 @@ class GitWrapper(SCMWrapper):
|
|
323
327
|
os.remove(disabled_hook_path)
|
324
328
|
os.rename(os.path.join(hook_dir, f), disabled_hook_path)
|
325
329
|
|
330
|
+
def _maybe_break_locks(self, options):
|
331
|
+
"""This removes all .lock files from this repo's .git directory, if the
|
332
|
+
user passed the --break_repo_locks command line flag.
|
333
|
+
|
334
|
+
In particular, this will cleanup index.lock files, as well as ref lock
|
335
|
+
files.
|
336
|
+
"""
|
337
|
+
if options.break_repo_locks:
|
338
|
+
git_dir = os.path.join(self.checkout_path, '.git')
|
339
|
+
for path, _, filenames in os.walk(git_dir):
|
340
|
+
for filename in filenames:
|
341
|
+
if filename.endswith('.lock'):
|
342
|
+
to_break = os.path.join(path, filename)
|
343
|
+
self.Print('breaking lock: %s' % (to_break,))
|
344
|
+
try:
|
345
|
+
os.remove(to_break)
|
346
|
+
except OSError as ex:
|
347
|
+
self.Print('FAILED to break lock: %s: %s' % (to_break, ex))
|
348
|
+
raise
|
349
|
+
|
350
|
+
|
326
351
|
def update(self, options, args, file_list):
|
327
352
|
"""Runs git to update or transparently checkout the working copy.
|
328
353
|
|
@@ -429,6 +454,8 @@ class GitWrapper(SCMWrapper):
|
|
429
454
|
self.Print('________ unmanaged solution; skipping %s' % self.relpath)
|
430
455
|
return self._Capture(['rev-parse', '--verify', 'HEAD'])
|
431
456
|
|
457
|
+
self._maybe_break_locks(options)
|
458
|
+
|
432
459
|
if mirror:
|
433
460
|
self._UpdateMirror(mirror, options)
|
434
461
|
|
@@ -457,8 +484,12 @@ class GitWrapper(SCMWrapper):
|
|
457
484
|
self.checkout_path, '.git', 'objects', 'info', 'alternates'),
|
458
485
|
'w') as fh:
|
459
486
|
fh.write(os.path.join(url, 'objects'))
|
487
|
+
self._EnsureValidHeadObjectOrCheckout(revision, options, url)
|
460
488
|
self._FetchAndReset(revision, file_list, options)
|
489
|
+
|
461
490
|
return_early = True
|
491
|
+
else:
|
492
|
+
self._EnsureValidHeadObjectOrCheckout(revision, options, url)
|
462
493
|
|
463
494
|
if return_early:
|
464
495
|
return self._Capture(['rev-parse', '--verify', 'HEAD'])
|
@@ -511,7 +542,7 @@ class GitWrapper(SCMWrapper):
|
|
511
542
|
if verbose:
|
512
543
|
self.Print(remote_output)
|
513
544
|
|
514
|
-
|
545
|
+
self._UpdateBranchHeads(options, fetch=True)
|
515
546
|
|
516
547
|
# This is a big hammer, debatable if it should even be here...
|
517
548
|
if options.force or options.reset:
|
@@ -522,7 +553,9 @@ class GitWrapper(SCMWrapper):
|
|
522
553
|
|
523
554
|
if current_type == 'detached':
|
524
555
|
# case 0
|
525
|
-
|
556
|
+
if not options.force:
|
557
|
+
# Don't do this check if nuclear option is on.
|
558
|
+
self._CheckClean(rev_str)
|
526
559
|
self._CheckDetachedHead(rev_str, options)
|
527
560
|
if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision:
|
528
561
|
self.Print('Up-to-date; skipping checkout.')
|
@@ -532,7 +565,7 @@ class GitWrapper(SCMWrapper):
|
|
532
565
|
self._Checkout(
|
533
566
|
options,
|
534
567
|
revision,
|
535
|
-
force=(options.force
|
568
|
+
force=(options.force or options.delete_unversioned_trees),
|
536
569
|
quiet=True,
|
537
570
|
)
|
538
571
|
if not printed_path:
|
@@ -717,7 +750,15 @@ class GitWrapper(SCMWrapper):
|
|
717
750
|
deps_revision = default_rev
|
718
751
|
if deps_revision.startswith('refs/heads/'):
|
719
752
|
deps_revision = deps_revision.replace('refs/heads/', self.remote + '/')
|
720
|
-
|
753
|
+
try:
|
754
|
+
deps_revision = self.GetUsableRev(deps_revision, options)
|
755
|
+
except NoUsableRevError as e:
|
756
|
+
# If the DEPS entry's url and hash changed, try to update the origin.
|
757
|
+
# See also http://crbug.com/520067.
|
758
|
+
logging.warn(
|
759
|
+
'Couldn\'t find usable revision, will retrying to update instead: %s',
|
760
|
+
e.message)
|
761
|
+
return self.update(options, [], file_list)
|
721
762
|
|
722
763
|
if file_list is not None:
|
723
764
|
files = self._Capture(['diff', deps_revision, '--name-only']).split()
|
@@ -755,7 +796,7 @@ class GitWrapper(SCMWrapper):
|
|
755
796
|
will be called on the source."""
|
756
797
|
sha1 = None
|
757
798
|
if not os.path.isdir(self.checkout_path):
|
758
|
-
raise
|
799
|
+
raise NoUsableRevError(
|
759
800
|
( 'We could not find a valid hash for safesync_url response "%s".\n'
|
760
801
|
'Safesync URLs with a git checkout currently require the repo to\n'
|
761
802
|
'be cloned without a safesync_url before adding the safesync_url.\n'
|
@@ -789,7 +830,7 @@ class GitWrapper(SCMWrapper):
|
|
789
830
|
'the closest sane git revision, which is:\n'
|
790
831
|
' %s\n' % (rev, e.message))
|
791
832
|
if not sha1:
|
792
|
-
raise
|
833
|
+
raise NoUsableRevError(
|
793
834
|
( 'It appears that either your git-svn remote is incorrectly\n'
|
794
835
|
'configured or the revision in your safesync_url is\n'
|
795
836
|
'higher than git-svn remote\'s HEAD as we couldn\'t find a\n'
|
@@ -805,7 +846,7 @@ class GitWrapper(SCMWrapper):
|
|
805
846
|
sha1 = rev
|
806
847
|
|
807
848
|
if not sha1:
|
808
|
-
raise
|
849
|
+
raise NoUsableRevError(
|
809
850
|
( 'We could not find a valid hash for safesync_url response "%s".\n'
|
810
851
|
'Safesync URLs with a git checkout currently require a git-svn\n'
|
811
852
|
'remote or a safesync_url that provides git sha1s. Please add a\n'
|
@@ -855,7 +896,8 @@ class GitWrapper(SCMWrapper):
|
|
855
896
|
mirror.populate(verbose=options.verbose,
|
856
897
|
bootstrap=not getattr(options, 'no_bootstrap', False),
|
857
898
|
depth=depth,
|
858
|
-
ignore_lock=getattr(options, 'ignore_locks', False)
|
899
|
+
ignore_lock=getattr(options, 'ignore_locks', False),
|
900
|
+
lock_timeout=getattr(options, 'lock_timeout', 0))
|
859
901
|
mirror.unlock()
|
860
902
|
|
861
903
|
def _Clone(self, revision, url, options):
|
@@ -1027,6 +1069,29 @@ class GitWrapper(SCMWrapper):
|
|
1027
1069
|
raise gclient_utils.Error('git version %s < minimum required %s' %
|
1028
1070
|
(current_version, min_version))
|
1029
1071
|
|
1072
|
+
def _EnsureValidHeadObjectOrCheckout(self, revision, options, url):
|
1073
|
+
# Special case handling if all 3 conditions are met:
|
1074
|
+
# * the mirros have recently changed, but deps destination remains same,
|
1075
|
+
# * the git histories of mirrors are conflicting.
|
1076
|
+
# * git cache is used
|
1077
|
+
# This manifests itself in current checkout having invalid HEAD commit on
|
1078
|
+
# most git operations. Since git cache is used, just deleted the .git
|
1079
|
+
# folder, and re-create it by cloning.
|
1080
|
+
try:
|
1081
|
+
self._Capture(['rev-list', '-n', '1', 'HEAD'])
|
1082
|
+
except subprocess2.CalledProcessError as e:
|
1083
|
+
if ('fatal: bad object HEAD' in e.stderr
|
1084
|
+
and self.cache_dir and self.cache_dir in url):
|
1085
|
+
self.Print((
|
1086
|
+
'Likely due to DEPS change with git cache_dir, '
|
1087
|
+
'the current commit points to no longer existing object.\n'
|
1088
|
+
'%s' % e)
|
1089
|
+
)
|
1090
|
+
self._DeleteOrMove(options.force)
|
1091
|
+
self._Clone(revision, url, options)
|
1092
|
+
else:
|
1093
|
+
raise
|
1094
|
+
|
1030
1095
|
def _IsRebasing(self):
|
1031
1096
|
# Check for any of REBASE-i/REBASE-m/REBASE/AM. Unfortunately git doesn't
|
1032
1097
|
# have a plumbing command to determine whether a rebase is in progress, so
|
@@ -1037,6 +1102,14 @@ class GitWrapper(SCMWrapper):
|
|
1037
1102
|
os.path.isdir(os.path.join(g, "rebase-apply")))
|
1038
1103
|
|
1039
1104
|
def _CheckClean(self, rev_str):
|
1105
|
+
lockfile = os.path.join(self.checkout_path, ".git", "index.lock")
|
1106
|
+
if os.path.exists(lockfile):
|
1107
|
+
raise gclient_utils.Error(
|
1108
|
+
'\n____ %s%s\n'
|
1109
|
+
'\tYour repo is locked, possibly due to a concurrent git process.\n'
|
1110
|
+
'\tIf no git executable is running, then clean up %r and try again.\n'
|
1111
|
+
% (self.relpath, rev_str, lockfile))
|
1112
|
+
|
1040
1113
|
# Make sure the tree is clean; see git-rebase.sh for reference
|
1041
1114
|
try:
|
1042
1115
|
scm.GIT.Capture(['update-index', '--ignore-submodules', '--refresh'],
|
@@ -1173,7 +1246,7 @@ class SVNWrapper(SCMWrapper):
|
|
1173
1246
|
'Oh hai! You are using subversion. Chrome infra is eager to get rid of',
|
1174
1247
|
'svn support so please switch to git.',
|
1175
1248
|
'Tracking bug: http://crbug.com/475320',
|
1176
|
-
'
|
1249
|
+
'If you are a project owner, you may request git migration assistance at: ',
|
1177
1250
|
' https://code.google.com/p/chromium/issues/entry?template=Infra-Git')
|
1178
1251
|
|
1179
1252
|
def __init__(self, *args, **kwargs):
|
@@ -1590,7 +1663,7 @@ class SVNWrapper(SCMWrapper):
|
|
1590
1663
|
def GetUsableRev(self, rev, _options):
|
1591
1664
|
"""Verifies the validity of the revision for this repository."""
|
1592
1665
|
if not scm.SVN.IsValidRevision(url='%s@%s' % (self.url, rev)):
|
1593
|
-
raise
|
1666
|
+
raise NoUsableRevError(
|
1594
1667
|
( '%s isn\'t a valid revision. Please check that your safesync_url is\n'
|
1595
1668
|
'correct.') % rev)
|
1596
1669
|
return rev
|
@@ -1084,7 +1084,11 @@ def RunEditor(content, git, git_editor=None):
|
|
1084
1084
|
'!! Please remove \\r from your change description !!')
|
1085
1085
|
fileobj = os.fdopen(file_handle, 'w')
|
1086
1086
|
# Still remove \r if present.
|
1087
|
-
|
1087
|
+
content = re.sub('\r?\n', '\n', content)
|
1088
|
+
# Some editors complain when the file doesn't end in \n.
|
1089
|
+
if not content.endswith('\n'):
|
1090
|
+
content += '\n'
|
1091
|
+
fileobj.write(content)
|
1088
1092
|
fileobj.close()
|
1089
1093
|
|
1090
1094
|
try:
|
@@ -9,42 +9,26 @@ https://gerrit-review.googlesource.com/Documentation/rest-api.html
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
import base64
|
12
|
+
import cookielib
|
12
13
|
import httplib
|
13
14
|
import json
|
14
15
|
import logging
|
15
16
|
import netrc
|
16
17
|
import os
|
17
18
|
import re
|
19
|
+
import socket
|
18
20
|
import stat
|
19
21
|
import sys
|
20
22
|
import time
|
21
23
|
import urllib
|
24
|
+
import urlparse
|
22
25
|
from cStringIO import StringIO
|
23
26
|
|
24
|
-
_netrc_file = '_netrc' if sys.platform.startswith('win') else '.netrc'
|
25
|
-
_netrc_file = os.path.join(os.environ['HOME'], _netrc_file)
|
26
|
-
try:
|
27
|
-
NETRC = netrc.netrc(_netrc_file)
|
28
|
-
except IOError:
|
29
|
-
print >> sys.stderr, 'WARNING: Could not read netrc file %s' % _netrc_file
|
30
|
-
NETRC = netrc.netrc(os.devnull)
|
31
|
-
except netrc.NetrcParseError as e:
|
32
|
-
_netrc_stat = os.stat(e.filename)
|
33
|
-
if _netrc_stat.st_mode & (stat.S_IRWXG | stat.S_IRWXO):
|
34
|
-
print >> sys.stderr, (
|
35
|
-
'WARNING: netrc file %s cannot be used because its file permissions '
|
36
|
-
'are insecure. netrc file permissions should be 600.' % _netrc_file)
|
37
|
-
else:
|
38
|
-
print >> sys.stderr, ('ERROR: Cannot use netrc file %s due to a parsing '
|
39
|
-
'error.' % _netrc_file)
|
40
|
-
raise
|
41
|
-
del _netrc_stat
|
42
|
-
NETRC = netrc.netrc(os.devnull)
|
43
|
-
del _netrc_file
|
44
27
|
|
45
28
|
LOGGER = logging.getLogger()
|
46
29
|
TRY_LIMIT = 5
|
47
30
|
|
31
|
+
|
48
32
|
# Controls the transport protocol used to communicate with gerrit.
|
49
33
|
# This is parameterized primarily to enable GerritTestCase.
|
50
34
|
GERRIT_PROTOCOL = 'https'
|
@@ -84,17 +68,203 @@ def GetConnectionClass(protocol=None):
|
|
84
68
|
"Don't know how to work with protocol '%s'" % protocol)
|
85
69
|
|
86
70
|
|
71
|
+
class Authenticator(object):
|
72
|
+
"""Base authenticator class for authenticator implementations to subclass."""
|
73
|
+
|
74
|
+
def get_auth_header(self, host):
|
75
|
+
raise NotImplementedError()
|
76
|
+
|
77
|
+
@staticmethod
|
78
|
+
def get():
|
79
|
+
"""Returns: (Authenticator) The identified Authenticator to use.
|
80
|
+
|
81
|
+
Probes the local system and its environment and identifies the
|
82
|
+
Authenticator instance to use.
|
83
|
+
"""
|
84
|
+
if GceAuthenticator.is_gce():
|
85
|
+
return GceAuthenticator()
|
86
|
+
return CookiesAuthenticator()
|
87
|
+
|
88
|
+
|
89
|
+
class CookiesAuthenticator(Authenticator):
|
90
|
+
"""Authenticator implementation that uses ".netrc" or ".gitcookies" for token.
|
91
|
+
|
92
|
+
Expected case for developer workstations.
|
93
|
+
"""
|
94
|
+
|
95
|
+
def __init__(self):
|
96
|
+
self.netrc = self._get_netrc()
|
97
|
+
self.gitcookies = self._get_gitcookies()
|
98
|
+
|
99
|
+
@classmethod
|
100
|
+
def get_new_password_message(cls, host):
|
101
|
+
assert not host.startswith('http')
|
102
|
+
# Assume *.googlesource.com pattern.
|
103
|
+
parts = host.split('.')
|
104
|
+
if not parts[0].endswith('-review'):
|
105
|
+
parts[0] += '-review'
|
106
|
+
url = 'https://%s/new-password' % ('.'.join(parts))
|
107
|
+
return 'You can (re)generate your credentails by visiting %s' % url
|
108
|
+
|
109
|
+
@classmethod
|
110
|
+
def get_netrc_path(cls):
|
111
|
+
path = '_netrc' if sys.platform.startswith('win') else '.netrc'
|
112
|
+
return os.path.expanduser(os.path.join('~', path))
|
113
|
+
|
114
|
+
@classmethod
|
115
|
+
def _get_netrc(cls):
|
116
|
+
path = cls.get_netrc_path()
|
117
|
+
if not os.path.exists(path):
|
118
|
+
return netrc.netrc(os.devnull)
|
119
|
+
|
120
|
+
try:
|
121
|
+
return netrc.netrc(path)
|
122
|
+
except IOError:
|
123
|
+
print >> sys.stderr, 'WARNING: Could not read netrc file %s' % path
|
124
|
+
return netrc.netrc(os.devnull)
|
125
|
+
except netrc.NetrcParseError:
|
126
|
+
st = os.stat(path)
|
127
|
+
if st.st_mode & (stat.S_IRWXG | stat.S_IRWXO):
|
128
|
+
print >> sys.stderr, (
|
129
|
+
'WARNING: netrc file %s cannot be used because its file '
|
130
|
+
'permissions are insecure. netrc file permissions should be '
|
131
|
+
'600.' % path)
|
132
|
+
else:
|
133
|
+
print >> sys.stderr, ('ERROR: Cannot use netrc file %s due to a '
|
134
|
+
'parsing error.' % path)
|
135
|
+
raise
|
136
|
+
return netrc.netrc(os.devnull)
|
137
|
+
|
138
|
+
@classmethod
|
139
|
+
def get_gitcookies_path(cls):
|
140
|
+
return os.path.join(os.environ['HOME'], '.gitcookies')
|
141
|
+
|
142
|
+
@classmethod
|
143
|
+
def _get_gitcookies(cls):
|
144
|
+
gitcookies = {}
|
145
|
+
path = cls.get_gitcookies_path()
|
146
|
+
if not os.path.exists(path):
|
147
|
+
return gitcookies
|
148
|
+
|
149
|
+
try:
|
150
|
+
f = open(path, 'rb')
|
151
|
+
except IOError:
|
152
|
+
return gitcookies
|
153
|
+
|
154
|
+
with f:
|
155
|
+
for line in f:
|
156
|
+
try:
|
157
|
+
fields = line.strip().split('\t')
|
158
|
+
if line.strip().startswith('#') or len(fields) != 7:
|
159
|
+
continue
|
160
|
+
domain, xpath, key, value = fields[0], fields[2], fields[5], fields[6]
|
161
|
+
if xpath == '/' and key == 'o':
|
162
|
+
login, secret_token = value.split('=', 1)
|
163
|
+
gitcookies[domain] = (login, secret_token)
|
164
|
+
except (IndexError, ValueError, TypeError) as exc:
|
165
|
+
logging.warning(exc)
|
166
|
+
|
167
|
+
return gitcookies
|
168
|
+
|
169
|
+
def get_auth_header(self, host):
|
170
|
+
auth = None
|
171
|
+
for domain, creds in self.gitcookies.iteritems():
|
172
|
+
if cookielib.domain_match(host, domain):
|
173
|
+
auth = (creds[0], None, creds[1])
|
174
|
+
break
|
175
|
+
|
176
|
+
if not auth:
|
177
|
+
auth = self.netrc.authenticators(host)
|
178
|
+
if auth:
|
179
|
+
return 'Basic %s' % (base64.b64encode('%s:%s' % (auth[0], auth[2])))
|
180
|
+
return None
|
181
|
+
|
182
|
+
# Backwards compatibility just in case somebody imports this outside of
|
183
|
+
# depot_tools.
|
184
|
+
NetrcAuthenticator = CookiesAuthenticator
|
185
|
+
|
186
|
+
|
187
|
+
class GceAuthenticator(Authenticator):
|
188
|
+
"""Authenticator implementation that uses GCE metadata service for token.
|
189
|
+
"""
|
190
|
+
|
191
|
+
_INFO_URL = 'http://metadata.google.internal'
|
192
|
+
_ACQUIRE_URL = ('http://metadata/computeMetadata/v1/instance/'
|
193
|
+
'service-accounts/default/token')
|
194
|
+
_ACQUIRE_HEADERS = {"Metadata-Flavor": "Google"}
|
195
|
+
|
196
|
+
_cache_is_gce = None
|
197
|
+
_token_cache = None
|
198
|
+
_token_expiration = None
|
199
|
+
|
200
|
+
@classmethod
|
201
|
+
def is_gce(cls):
|
202
|
+
if cls._cache_is_gce is None:
|
203
|
+
cls._cache_is_gce = cls._test_is_gce()
|
204
|
+
return cls._cache_is_gce
|
205
|
+
|
206
|
+
@classmethod
|
207
|
+
def _test_is_gce(cls):
|
208
|
+
# Based on https://cloud.google.com/compute/docs/metadata#runninggce
|
209
|
+
try:
|
210
|
+
resp = cls._get(cls._INFO_URL)
|
211
|
+
except socket.error:
|
212
|
+
# Could not resolve URL.
|
213
|
+
return False
|
214
|
+
return resp.getheader('Metadata-Flavor', None) == 'Google'
|
215
|
+
|
216
|
+
@staticmethod
|
217
|
+
def _get(url, **kwargs):
|
218
|
+
next_delay_sec = 1
|
219
|
+
for i in xrange(TRY_LIMIT):
|
220
|
+
if i > 0:
|
221
|
+
# Retry server error status codes.
|
222
|
+
LOGGER.info('Encountered server error; retrying after %d second(s).',
|
223
|
+
next_delay_sec)
|
224
|
+
time.sleep(next_delay_sec)
|
225
|
+
next_delay_sec *= 2
|
226
|
+
|
227
|
+
p = urlparse.urlparse(url)
|
228
|
+
c = GetConnectionClass(protocol=p.scheme)(p.netloc)
|
229
|
+
c.request('GET', url, **kwargs)
|
230
|
+
resp = c.getresponse()
|
231
|
+
LOGGER.debug('GET [%s] #%d/%d (%d)', url, i+1, TRY_LIMIT, resp.status)
|
232
|
+
if resp.status < httplib.INTERNAL_SERVER_ERROR:
|
233
|
+
return resp
|
234
|
+
|
235
|
+
|
236
|
+
@classmethod
|
237
|
+
def _get_token_dict(cls):
|
238
|
+
if cls._token_cache:
|
239
|
+
# If it expires within 25 seconds, refresh.
|
240
|
+
if cls._token_expiration < time.time() - 25:
|
241
|
+
return cls._token_cache
|
242
|
+
|
243
|
+
resp = cls._get(cls._ACQUIRE_URL, headers=cls._ACQUIRE_HEADERS)
|
244
|
+
if resp.status != httplib.OK:
|
245
|
+
return None
|
246
|
+
cls._token_cache = json.load(resp)
|
247
|
+
cls._token_expiration = cls._token_cache['expires_in'] + time.time()
|
248
|
+
return cls._token_cache
|
249
|
+
|
250
|
+
def get_auth_header(self, _host):
|
251
|
+
token_dict = self._get_token_dict()
|
252
|
+
if not token_dict:
|
253
|
+
return None
|
254
|
+
return '%(token_type)s %(access_token)s' % token_dict
|
255
|
+
|
256
|
+
|
257
|
+
|
87
258
|
def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
|
88
259
|
"""Opens an https connection to a gerrit service, and sends a request."""
|
89
260
|
headers = headers or {}
|
90
261
|
bare_host = host.partition(':')[0]
|
91
|
-
auth = NETRC.authenticators(bare_host)
|
92
262
|
|
263
|
+
auth = Authenticator.get().get_auth_header(bare_host)
|
93
264
|
if auth:
|
94
|
-
headers.setdefault('Authorization',
|
95
|
-
base64.b64encode('%s:%s' % (auth[0], auth[2]))))
|
265
|
+
headers.setdefault('Authorization', auth)
|
96
266
|
else:
|
97
|
-
LOGGER.debug('No authorization found
|
267
|
+
LOGGER.debug('No authorization found for %s.' % bare_host)
|
98
268
|
|
99
269
|
if 'Authorization' in headers and not path.startswith('a/'):
|
100
270
|
url = '/a/%s' % path
|
@@ -313,6 +483,21 @@ def GetChangeDetail(host, change, o_params=None):
|
|
313
483
|
return ReadHttpJsonResponse(CreateHttpConn(host, path))
|
314
484
|
|
315
485
|
|
486
|
+
def GetChangeDescriptionFromGitiles(url, revision):
|
487
|
+
"""Query Gitiles for actual commit message for a given url and ref.
|
488
|
+
|
489
|
+
url must be obtained from call to GetChangeDetail for a specific
|
490
|
+
revision (patchset) under 'fetch' key.
|
491
|
+
"""
|
492
|
+
parsed = urlparse.urlparse(url)
|
493
|
+
path = '%s/+/%s?format=json' % (parsed.path, revision)
|
494
|
+
# Note: Gerrit instances that Chrome infrastructure uses thus far have all
|
495
|
+
# enabled Gitiles, which allowes us to execute this call. This isn't true for
|
496
|
+
# all Gerrit instances out there. Thus, if line below fails, consider adding a
|
497
|
+
# fallback onto actually fetching ref from remote using pure git.
|
498
|
+
return ReadHttpJsonResponse(CreateHttpConn(parsed.netloc, path))['message']
|
499
|
+
|
500
|
+
|
316
501
|
def GetChangeCurrentRevision(host, change):
|
317
502
|
"""Get information about the latest revision for a given change."""
|
318
503
|
return QueryChanges(host, {}, change, o_params=('CURRENT_REVISION',))
|
@@ -339,7 +524,7 @@ def GetChangeReview(host, change, revision=None):
|
|
339
524
|
def AbandonChange(host, change, msg=''):
|
340
525
|
"""Abandon a gerrit change."""
|
341
526
|
path = 'changes/%s/abandon' % change
|
342
|
-
body = {'message': msg} if msg else
|
527
|
+
body = {'message': msg} if msg else {}
|
343
528
|
conn = CreateHttpConn(host, path, reqtype='POST', body=body)
|
344
529
|
return ReadHttpJsonResponse(conn, ignore_404=False)
|
345
530
|
|
@@ -347,7 +532,7 @@ def AbandonChange(host, change, msg=''):
|
|
347
532
|
def RestoreChange(host, change, msg=''):
|
348
533
|
"""Restore a previously abandoned change."""
|
349
534
|
path = 'changes/%s/restore' % change
|
350
|
-
body = {'message': msg} if msg else
|
535
|
+
body = {'message': msg} if msg else {}
|
351
536
|
conn = CreateHttpConn(host, path, reqtype='POST', body=body)
|
352
537
|
return ReadHttpJsonResponse(conn, ignore_404=False)
|
353
538
|
|
@@ -360,6 +545,38 @@ def SubmitChange(host, change, wait_for_merge=True):
|
|
360
545
|
return ReadHttpJsonResponse(conn, ignore_404=False)
|
361
546
|
|
362
547
|
|
548
|
+
def SetCommitMessage(host, change, description):
|
549
|
+
"""Updates a commit message."""
|
550
|
+
# First, edit the commit message in a draft.
|
551
|
+
path = 'changes/%s/edit:message' % change
|
552
|
+
body = {'message': description}
|
553
|
+
conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
|
554
|
+
try:
|
555
|
+
ReadHttpResponse(conn, ignore_404=False)
|
556
|
+
except GerritError as e:
|
557
|
+
# On success, gerrit returns status 204; anything else is an error.
|
558
|
+
if e.http_status != 204:
|
559
|
+
raise
|
560
|
+
else:
|
561
|
+
raise GerritError(
|
562
|
+
'Unexpectedly received a 200 http status while editing message in '
|
563
|
+
'change %s' % change)
|
564
|
+
|
565
|
+
# And then publish it.
|
566
|
+
path = 'changes/%s/edit:publish' % change
|
567
|
+
conn = CreateHttpConn(host, path, reqtype='POST', body={})
|
568
|
+
try:
|
569
|
+
ReadHttpResponse(conn, ignore_404=False)
|
570
|
+
except GerritError as e:
|
571
|
+
# On success, gerrit returns status 204; anything else is an error.
|
572
|
+
if e.http_status != 204:
|
573
|
+
raise
|
574
|
+
else:
|
575
|
+
raise GerritError(
|
576
|
+
'Unexpectedly received a 200 http status while publishing message '
|
577
|
+
'change in %s' % change)
|
578
|
+
|
579
|
+
|
363
580
|
def GetReviewers(host, change):
|
364
581
|
"""Get information about all reviewers attached to a change."""
|
365
582
|
path = 'changes/%s/reviewers' % change
|