Commit f4c2703a authored by Robert Iannucci's avatar Robert Iannucci Committed by Commit Bot

[bot_update] Remove rietveld recipe_module.

R=agable@chromium.org, tandrii@chromium.org

Recipe-Nontrivial-Roll: build
Change-Id: Ic4c2dc7a50d389f18f3e0c1de332cb1a0ab376a9
Reviewed-on: https://chromium-review.googlesource.com/957834
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 3a8b0908
This diff is collapsed.
......@@ -12,7 +12,6 @@ DEPS = [
'recipe_engine/runtime',
'recipe_engine/source_manifest',
'recipe_engine/step',
'rietveld',
'tryserver',
]
......@@ -30,8 +29,7 @@ PROPERTIES = {
# Legacy Gerrit fields.
'event.patchSet.ref': Property(default=None, param_name='gerrit_ref'),
# Rietveld-only fields.
'rietveld': Property(default=None), # Stores Url of Rietveld server.
# Rietveld-only (?) fields.
'issue': Property(default=None),
'patchset': Property(default=None),
'repository': Property(default=None),
......
......@@ -12,14 +12,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
def __init__(self, issue, patch_issue, patchset, patch_set,
repository, patch_repository_url, gerrit_ref, patch_ref,
patch_gerrit_url, rietveld, revision, parent_got_revision,
patch_gerrit_url, revision, parent_got_revision,
deps_revision_overrides, fail_patch, *args, **kwargs):
self._issue = issue or patch_issue
self._patchset = patchset or patch_set
self._repository = repository or patch_repository_url
self._gerrit_ref = gerrit_ref or patch_ref
self._gerrit = patch_gerrit_url
self._rietveld = rietveld
self._revision = revision
self._parent_got_revision = parent_got_revision
self._deps_revision_overrides = deps_revision_overrides
......@@ -80,8 +79,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
Args:
gclient_config: The gclient configuration to use when running bot_update.
If omitted, the current gclient configuration is used.
rietveld: The rietveld server to use. If omitted, will infer from
the 'rietveld' property.
issue: The rietveld issue number to use. If omitted, will infer from
the 'issue' property.
patchset: The rietveld issue patchset to use. If omitted, will infer from
......@@ -93,6 +90,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
be unique for the whole build.
"""
assert use_site_config_creds is None, "use_site_config_creds is deprecated"
assert rietveld is None, "rietveld is deprecated"
refs = refs or []
# We can re-use the gclient spec from the gclient module, since all the
......@@ -169,7 +167,6 @@ class BotUpdateApi(recipe_api.RecipeApi):
# How to find the patch, if any (issue/patchset).
['--issue', issue],
['--patchset', patchset],
['--rietveld_server', rietveld or self._rietveld],
['--gerrit_repo', gerrit_repo],
['--gerrit_ref', gerrit_ref],
['--apply_issue_oauth2_file', oauth2_json_file],
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......@@ -86,8 +84,6 @@
"[GIT_CACHE]",
"--cleanup-dir",
"[CLEANUP]/bot_update",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......@@ -118,8 +116,6 @@
"[GIT_CACHE]",
"--cleanup-dir",
"[CLEANUP]/bot_update",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......@@ -118,8 +116,6 @@
"[GIT_CACHE]",
"--cleanup-dir",
"[CLEANUP]/bot_update",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -18,8 +18,6 @@
"12345",
"--patchset",
"654321",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......@@ -121,8 +119,6 @@
"[GIT_CACHE]",
"--cleanup-dir",
"[CLEANUP]/bot_update",
"--rietveld_server",
"https://rietveld.example.com/",
"--output_json",
"/path/to/tmp/json",
"--revision",
......
......@@ -719,7 +719,7 @@ def _download(url):
raise
def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
def apply_rietveld_issue(issue, patchset, root, _rev_map, _revision,
oauth2_file, whitelist=None, blacklist=None):
apply_issue_bin = ('apply_issue.bat' if sys.platform.startswith('win')
else 'apply_issue')
......@@ -728,7 +728,7 @@ def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
'--root_dir', root,
# Tell apply_issue how to fetch the patch.
'--issue', issue,
'--server', server,
'--server', 'codereview.chromium.org',
# Always run apply_issue.py, otherwise it would see update.flag
# and then bail out.
'--force',
......@@ -867,11 +867,10 @@ def emit_json(out_file, did_run, gclient_output=None, **kwargs):
def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
target_cpu, patch_root, issue, patchset, rietveld_server,
gerrit_repo, gerrit_ref, gerrit_rebase_patch_ref,
revision_mapping, apply_issue_oauth2_file, shallow,
refs, git_cache_dir, cleanup_dir, gerrit_reset,
disable_syntax_validation):
target_cpu, patch_root, issue, patchset, gerrit_repo,
gerrit_ref, gerrit_rebase_patch_ref, revision_mapping,
apply_issue_oauth2_file, shallow, refs, git_cache_dir,
cleanup_dir, gerrit_reset, disable_syntax_validation):
# Get a checkout of each solution, without DEPS or hooks.
# Calling git directly because there is no way to run Gclient without
# invoking DEPS.
......@@ -893,8 +892,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
target = '/'.join([relative_root, 'DEPS']).lstrip('/')
print ' relative root is %r, target is %r' % (relative_root, target)
if issue:
apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
revision_mapping, git_ref, apply_issue_oauth2_file,
apply_rietveld_issue(issue, patchset, patch_root, revision_mapping,
git_ref, apply_issue_oauth2_file,
whitelist=[target])
already_patched.append(target)
elif gerrit_ref:
......@@ -936,9 +935,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
# Apply the rest of the patch here (sans DEPS)
if issue:
apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
revision_mapping, git_ref, apply_issue_oauth2_file,
blacklist=already_patched)
apply_rietveld_issue(issue, patchset, patch_root, revision_mapping, git_ref,
apply_issue_oauth2_file, blacklist=already_patched)
elif gerrit_ref and not applied_gerrit_patch:
# If gerrit_ref was for solution's main repository, it has already been
# applied above. This chunk is executed only for patches to DEPS-ed in
......@@ -1007,9 +1005,6 @@ def parse_args():
parse.add_option('--root', dest='patch_root',
help='DEPRECATED: Use --patch_root.')
parse.add_option('--patch_root', help='Directory to patch on top of.')
parse.add_option('--rietveld_server',
default='codereview.chromium.org',
help='Rietveld server.')
parse.add_option('--gerrit_repo',
help='Gerrit repository to pull the ref from.')
parse.add_option('--gerrit_ref', help='Gerrit ref to apply.')
......@@ -1159,7 +1154,6 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
patch_root=options.patch_root,
issue=options.issue,
patchset=options.patchset,
rietveld_server=options.rietveld_server,
gerrit_repo=options.gerrit_repo,
gerrit_ref=options.gerrit_ref,
gerrit_rebase_patch_ref=not options.gerrit_no_rebase_patch_ref,
......
DEPS = [
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
]
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import urlparse
from recipe_engine import recipe_api
class RietveldApi(recipe_api.RecipeApi):
def calculate_issue_root(self, extra_patch_project_roots=None):
"""Returns path where a patch should be applied to based on "patch_project".
YOU SHOULD NOT USE THIS METHOD. Put this into gclient's config as
patch_projects instead, and with luck you won't need to use
calculate_patch_root from gclient api.
TODO(tandrii): remove this method completely. See http://crbug.com/605563.
Maps Rietveld's "patch_project" to a path of directories relative to
api.gclient.c.solutions[0].name which describe where to place the patch.
Args:
extra_patch_project_roots: Dict mapping project names to relative roots.
Returns:
Relative path or empty string if patch_project is not set or path for a
given is unknown.
"""
# Property 'patch_project' is set by Rietveld, 'project' is set by git-try
# when TRYSERVER_PROJECT is present in codereview.settings.
patch_project = (self.m.properties.get('patch_project') or
self.m.properties.get('project'))
# Please avoid adding projects into this hard-coded list unless your project
# CLs are being run by multiple recipes. Instead pass patch_project_roots to
# ensure_checkout.
patch_project_roots = {
'angle/angle': ['third_party', 'angle'],
'blink': ['third_party', 'WebKit'],
'v8': ['v8'],
'luci-py': ['luci'],
'recipes-py': ['recipes-py'],
}
# Make sure to update common projects (above) with extra projects (and not
# vice versa, so that recipes can override default values if needed.
if extra_patch_project_roots:
patch_project_roots.update(extra_patch_project_roots)
path_parts = patch_project_roots.get(patch_project)
return self.m.path.join(*path_parts) if path_parts else ''
def apply_issue(self, *root_pieces, **kwargs):
"""Call apply_issue from depot_tools.
Args:
root_pieces (strings): location where to run apply_issue, relative to the
checkout root.
authentication (string or None): authentication scheme to use. Can be None
or 'oauth2'. See also apply_issue.py --help (-E and --no-auth options.)
"""
# TODO(pgervais): replace *root_pieces by a single Path object.
authentication = kwargs.get('authentication', None)
rietveld_url = self.m.properties['rietveld']
issue_number = self.m.properties['issue']
if authentication == 'oauth2':
try:
build_path = self.m.path['build']
except KeyError:
raise self.m.step.StepFailure(
'build path is not defined. This is typical for LUCI builds. '
'LUCI does not support rietveld.apply_issue; use bot_update instead')
step_result = self.m.python(
'apply_issue',
self.package_repo_resource('apply_issue.py'), [
'-r', self.m.path['checkout'].join(*root_pieces),
'-i', issue_number,
'-p', self.m.properties['patchset'],
'-s', rietveld_url,
'-E', build_path.join('site_config', '.rietveld_client_email'),
'-k', build_path.join('site_config', '.rietveld_secret_key'),
],
)
else:
step_result = self.m.python(
'apply_issue',
self.package_repo_resource('apply_issue.py'), [
'-r', self.m.path['checkout'].join(*root_pieces),
'-i', issue_number,
'-p', self.m.properties['patchset'],
'-s', rietveld_url,
'--no-auth'],
)
step_result.presentation.links['Applied issue %s' % issue_number] = (
urlparse.urljoin(rietveld_url, str(issue_number)))
[
{
"name": "$result",
"reason": "build path is not defined. This is typical for LUCI builds. LUCI does not support rietveld.apply_issue; use bot_update instead",
"recipe_result": null,
"status_code": 1
}
]
\ No newline at end of file
[
{
"cmd": [
"python",
"-u",
"RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py",
"-r",
"[START_DIR]/foo/bar",
"-i",
"1",
"-p",
"1",
"-s",
"http://review_tool.url",
"-E",
"[BUILD]/site_config/.rietveld_client_email",
"-k",
"[BUILD]/site_config/.rietveld_secret_key"
],
"name": "apply_issue",
"~followup_annotations": [
"@@@STEP_LINK@Applied issue 1@http://review_tool.url/1@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
[
{
"cmd": [
"python",
"-u",
"RECIPE_PACKAGE_REPO[depot_tools]/apply_issue.py",
"-r",
"[START_DIR]/foo/bar",
"-i",
"1",
"-p",
"1",
"-s",
"http://review_tool.url",
"--no-auth"
],
"name": "apply_issue",
"~followup_annotations": [
"@@@STEP_LINK@Applied issue 1@http://review_tool.url/1@@@"
]
},
{
"name": "$result",
"recipe_result": null,
"status_code": 0
}
]
\ No newline at end of file
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'infra_paths',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/step',
'rietveld',
]
def RunSteps(api):
api.path['checkout'] = api.path['start_dir']
api.rietveld.apply_issue(
'foo', 'bar', authentication=api.properties.get('authentication'))
api.rietveld.calculate_issue_root({'project': ['']})
def GenTests(api):
yield api.test('basic') + api.properties(
issue=1,
patchset=1,
rietveld='http://review_tool.url',
authentication='oauth2',
)
yield api.test('no_auth') + api.properties(
issue=1,
patchset=1,
rietveld='http://review_tool.url',
)
yield api.test('buildbot') + api.properties(
path_config='buildbot',
issue=1,
patchset=1,
rietveld='http://review_tool.url',
authentication='oauth2',
)
......@@ -151,7 +151,6 @@ class BotUpdateUnittests(unittest.TestCase):
'patch_root': None,
'issue': None,
'patchset': None,
'rietveld_server': None,
'gerrit_repo': None,
'gerrit_ref': None,
'gerrit_rebase_patch_ref': None,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment