diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 930f4e250..665af3b19 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -14,7 +14,6 @@ * [gsutil](#recipe_modules-gsutil) * [infra_paths](#recipe_modules-infra_paths) * [presubmit](#recipe_modules-presubmit) - * [rietveld](#recipe_modules-rietveld) * [tryserver](#recipe_modules-tryserver) **[Recipes](#Recipes)** @@ -32,36 +31,33 @@ * [gsutil:examples/full](#recipes-gsutil_examples_full) * [infra_paths:examples/full](#recipes-infra_paths_examples_full) * [presubmit:examples/full](#recipes-presubmit_examples_full) - * [rietveld:examples/full](#recipes-rietveld_examples_full) * [tryserver:examples/full](#recipes-tryserver_examples_full) ## Recipe Modules ### *recipe_modules* / [bot\_update](/recipes/recipe_modules/bot_update) -[DEPS](/recipes/recipe_modules/bot_update/__init__.py#1): [depot\_tools](#recipe_modules-depot_tools), [gclient](#recipe_modules-gclient), [gerrit](#recipe_modules-gerrit), [rietveld](#recipe_modules-rietveld), [tryserver](#recipe_modules-tryserver), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/source\_manifest][recipe_engine/recipe_modules/source_manifest], [recipe\_engine/step][recipe_engine/recipe_modules/step] +[DEPS](/recipes/recipe_modules/bot_update/__init__.py#1): [depot\_tools](#recipe_modules-depot_tools), [gclient](#recipe_modules-gclient), [gerrit](#recipe_modules-gerrit), [tryserver](#recipe_modules-tryserver), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/source\_manifest][recipe_engine/recipe_modules/source_manifest], [recipe\_engine/step][recipe_engine/recipe_modules/step] Recipe module to ensure a checkout is consistent on a bot. #### **class [BotUpdateApi](/recipes/recipe_modules/bot_update/api.py#11)([RecipeApi][recipe_engine/wkt/RecipeApi]):** -— **def [\_\_call\_\_](/recipes/recipe_modules/bot_update/api.py#31)(self, name, cmd, \*\*kwargs):** +— **def [\_\_call\_\_](/recipes/recipe_modules/bot_update/api.py#30)(self, name, cmd, \*\*kwargs):** Wrapper for easy calling of bot_update. -— **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#46)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, step_name='apply_gerrit', \*\*kwargs):** +— **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#45)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, step_name='apply_gerrit', \*\*kwargs):** -— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#424)(self, bot_update_step):** +— **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#421)(self, bot_update_step):** Deapplies a patch, taking care of DEPS and solution revisions properly. -— **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#68)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=None, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, manifest_name=None, \*\*kwargs):** +— **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#67)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=None, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, manifest_name=None, \*\*kwargs):** 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 @@ -72,7 +68,7 @@ Args: manifest_name: The name of the manifest to upload to LogDog. This must be unique for the whole build. -— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#401)(self, project_name, gclient_config=None):** +— **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#398)(self, project_name, gclient_config=None):** Returns all property names used for storing the checked-out revision of a given project. @@ -86,7 +82,7 @@ Args: Returns (list of str): All properties that'll hold the checked-out revision of the given project. An empty list if no such properties exist. -  **@property**
— **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#40)(self):** +  **@property**
— **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#39)(self):** ### *recipe_modules* / [cipd](/recipes/recipe_modules/cipd) [DEPS](/recipes/recipe_modules/cipd/__init__.py#1): [infra\_paths](#recipe_modules-infra_paths), [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step] @@ -634,40 +630,6 @@ uses the more generic [CACHE]/git path (LUCI world). Return a presubmit step.   **@property**
— **def [presubmit\_support\_path](/recipes/recipe_modules/presubmit/api.py#8)(self):** -### *recipe_modules* / [rietveld](/recipes/recipe_modules/rietveld) - -[DEPS](/recipes/recipe_modules/rietveld/__init__.py#1): [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step] - -#### **class [RietveldApi](/recipes/recipe_modules/rietveld/api.py#10)([RecipeApi][recipe_engine/wkt/RecipeApi]):** - -— **def [apply\_issue](/recipes/recipe_modules/rietveld/api.py#53)(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.) - -— **def [calculate\_issue\_root](/recipes/recipe_modules/rietveld/api.py#11)(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. ### *recipe_modules* / [tryserver](/recipes/recipe_modules/tryserver) [DEPS](/recipes/recipe_modules/tryserver/__init__.py#5): [gerrit](#recipe_modules-gerrit), [git](#recipe_modules-git), [git\_cl](#recipe_modules-git_cl), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step] @@ -825,11 +787,6 @@ Move things around in a loop! [DEPS](/recipes/recipe_modules/presubmit/examples/full.py#5): [presubmit](#recipe_modules-presubmit) — **def [RunSteps](/recipes/recipe_modules/presubmit/examples/full.py#10)(api):** -### *recipes* / [rietveld:examples/full](/recipes/recipe_modules/rietveld/examples/full.py) - -[DEPS](/recipes/recipe_modules/rietveld/examples/full.py#5): [infra\_paths](#recipe_modules-infra_paths), [rietveld](#recipe_modules-rietveld), [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step] - -— **def [RunSteps](/recipes/recipe_modules/rietveld/examples/full.py#13)(api):** ### *recipes* / [tryserver:examples/full](/recipes/recipe_modules/tryserver/examples/full.py) [DEPS](/recipes/recipe_modules/tryserver/examples/full.py#5): [tryserver](#recipe_modules-tryserver), [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step] diff --git a/recipes/recipe_modules/bot_update/__init__.py b/recipes/recipe_modules/bot_update/__init__.py index deaece127..d98c1d2af 100644 --- a/recipes/recipe_modules/bot_update/__init__.py +++ b/recipes/recipe_modules/bot_update/__init__.py @@ -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), diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index 888ff672d..176b0d6a5 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -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], diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json b/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json index 357f1a942..b554d7015 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json @@ -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", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json index 97e9f2305..8c2645f85 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json @@ -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", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json index 97e9f2305..8c2645f85 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json @@ -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", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json index ebd20163a..02aa019a7 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json @@ -18,8 +18,6 @@ "12345", "--patchset", "654321", - "--rietveld_server", - "https://rietveld.example.com/", "--output_json", "/path/to/tmp/json", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json index 4907b791d..e5a230df9 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json @@ -18,8 +18,6 @@ "12345", "--patchset", "654321", - "--rietveld_server", - "https://rietveld.example.com/", "--output_json", "/path/to/tmp/json", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json index eefa96cea..0ddd75b2c 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json @@ -18,8 +18,6 @@ "12345", "--patchset", "654321", - "--rietveld_server", - "https://rietveld.example.com/", "--output_json", "/path/to/tmp/json", "--revision", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json index 96a5addee..2907f334d 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json @@ -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", diff --git a/recipes/recipe_modules/bot_update/resources/bot_update.py b/recipes/recipe_modules/bot_update/resources/bot_update.py index ea38c2ff2..e688f35de 100755 --- a/recipes/recipe_modules/bot_update/resources/bot_update.py +++ b/recipes/recipe_modules/bot_update/resources/bot_update.py @@ -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, diff --git a/recipes/recipe_modules/rietveld/__init__.py b/recipes/recipe_modules/rietveld/__init__.py deleted file mode 100644 index 8dc3f8f5a..000000000 --- a/recipes/recipe_modules/rietveld/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -DEPS = [ - 'recipe_engine/path', - 'recipe_engine/properties', - 'recipe_engine/python', - 'recipe_engine/step', -] diff --git a/recipes/recipe_modules/rietveld/api.py b/recipes/recipe_modules/rietveld/api.py deleted file mode 100644 index 82f73f86f..000000000 --- a/recipes/recipe_modules/rietveld/api.py +++ /dev/null @@ -1,97 +0,0 @@ -# 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))) - diff --git a/recipes/recipe_modules/rietveld/examples/full.expected/basic.json b/recipes/recipe_modules/rietveld/examples/full.expected/basic.json deleted file mode 100644 index cf869a363..000000000 --- a/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "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 diff --git a/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json b/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json deleted file mode 100644 index 0999dbca0..000000000 --- a/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "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 diff --git a/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json b/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json deleted file mode 100644 index f050065f1..000000000 --- a/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "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 diff --git a/recipes/recipe_modules/rietveld/examples/full.py b/recipes/recipe_modules/rietveld/examples/full.py deleted file mode 100644 index b18c154e7..000000000 --- a/recipes/recipe_modules/rietveld/examples/full.py +++ /dev/null @@ -1,38 +0,0 @@ -# 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', - ) diff --git a/tests/bot_update_coverage_test.py b/tests/bot_update_coverage_test.py index bcd162a51..032f2ea13 100755 --- a/tests/bot_update_coverage_test.py +++ b/tests/bot_update_coverage_test.py @@ -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,