From dc598e8223bf9a901f6f960f75f4ed3b30e1668b Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Thu, 29 Jun 2017 14:20:25 -0700 Subject: [PATCH] [bot_update] Prefix PATH, cleanup. Prefix "depot_tools" to PATH instead of appending. This will ensure that "depot_tools" pulls resources from the recipe checkout as a preference, not as a last resort. Use "env_prefixes" instead of "env" to prefix PATH. Remove Git speed limit settings, which are taken care of by the Git wrapper now. BUG=chromium:738176 TEST=expectations R=hinoka@chromium.org, iannucci@chromium.org Change-Id: I2e509a331266e867be323bc70e3bc0f08f85246f Reviewed-on: https://chromium-review.googlesource.com/556287 Reviewed-by: Ryan Tseng Commit-Queue: Daniel Jacques --- recipes/recipe_modules/bot_update/__init__.py | 1 + recipes/recipe_modules/bot_update/api.py | 25 ++++++++----------- .../full.expected/apply_gerrit_ref.json | 6 +++-- .../examples/full.expected/basic.json | 8 +++--- .../basic_with_branch_heads.json | 16 ++++++------ .../examples/full.expected/buildbot.json | 8 +++--- .../examples/full.expected/clobber.json | 16 ++++++------ .../deprecated_got_revision_mapping.json | 16 ++++++------ .../gerrit_no_rebase_patch_ref.json | 16 ++++++------ .../full.expected/gerrit_no_reset.json | 16 ++++++------ .../examples/full.expected/no_shallow.json | 16 ++++++------ .../reset_root_solution_revision.json | 16 ++++++------ .../examples/full.expected/trychange.json | 16 ++++++------ .../trychange_oauth2_buildbot.json | 16 ++++++------ .../full.expected/trychange_oauth2_json.json | 16 ++++++------ .../trychange_oauth2_json_win.json | 16 ++++++------ .../examples/full.expected/tryjob.json | 16 ++++++------ .../examples/full.expected/tryjob_fail.json | 8 +++--- .../full.expected/tryjob_fail_patch.json | 8 +++--- .../tryjob_fail_patch_download.json | 8 +++--- .../full.expected/tryjob_gerrit_angle.json | 16 ++++++------ .../tryjob_gerrit_angle_deprecated.json | 16 ++++++------ .../examples/full.expected/tryjob_v8.json | 16 ++++++------ .../tryjob_v8_head_by_default.json | 16 ++++++------ .../examples/full.expected/with_tags.json | 16 ++++++------ recipes/recipe_modules/depot_tools/api.py | 5 ++++ .../examples/full.expected/basic.json | 7 ++++++ .../examples/full.expected/win.json | 7 ++++++ .../depot_tools/examples/full.py | 2 ++ 29 files changed, 192 insertions(+), 173 deletions(-) diff --git a/recipes/recipe_modules/bot_update/__init__.py b/recipes/recipe_modules/bot_update/__init__.py index cf1a67231..f9540f445 100644 --- a/recipes/recipe_modules/bot_update/__init__.py +++ b/recipes/recipe_modules/bot_update/__init__.py @@ -1,4 +1,5 @@ DEPS = [ + 'depot_tools', 'gclient', 'recipe_engine/context', 'recipe_engine/json', diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index f600f3f0a..52ef59fb1 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -33,16 +33,11 @@ class BotUpdateApi(recipe_api.RecipeApi): assert isinstance(cmd, (list, tuple)) bot_update_path = self.resource('bot_update.py') kwargs.setdefault('infra_step', True) - env = self.m.context.env - env.setdefault('PATH', '%(PATH)s') - env['PATH'] = self.m.path.pathsep.join([ - env['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) - # These are to prevent git from hanging. If the git connection is slower - # than 1KB/s for more than 5 minutes then git will kill the connection - # and die with an error "error: RPC failed; curl 28 Operation too slow" - env['GIT_HTTP_LOW_SPEED_LIMIT'] = 1000 - env['GIT_HTTP_LOW_SPEED_TIME'] = 300 - with self.m.context(env=env): + + env_prefixes = { + 'PATH': [self.m.depot_tools.root], + } + with self.m.context(env_prefixes=env_prefixes): return self.m.python(name, bot_update_path, cmd, **kwargs) @property @@ -55,10 +50,6 @@ class BotUpdateApi(recipe_api.RecipeApi): gerrit_no_rebase_patch_ref=False, **kwargs): apply_gerrit_path = self.resource('apply_gerrit.py') kwargs.setdefault('infra_step', True) - env = self.m.context.env - env.setdefault('PATH', '%(PATH)s') - env['PATH'] = self.m.path.pathsep.join([ - env['PATH'], str(self._module.PACKAGE_REPO_ROOT)]) cmd = [ '--gerrit_repo', self._repository, '--gerrit_ref', self._gerrit_ref or '', @@ -68,7 +59,11 @@ class BotUpdateApi(recipe_api.RecipeApi): cmd.append('--gerrit_no_reset') if gerrit_no_rebase_patch_ref: cmd.append('--gerrit_no_rebase_patch_ref') - with self.m.context(env=env): + + env_prefixes = { + 'PATH': [self.m.depot_tools.root], + } + with self.m.context(env_prefixes=env_prefixes): return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs) def ensure_checkout(self, gclient_config=None, suffix=None, diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json b/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json index 32c85ef59..f35693ff7 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json @@ -13,8 +13,10 @@ "--gerrit_no_reset", "--gerrit_no_rebase_patch_ref" ], - "env": { - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "apply_gerrit" diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/basic.json b/recipes/recipe_modules/bot_update/examples/full.expected/basic.json index 06f99c8bd..9b6187d0f 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/basic.json @@ -20,10 +20,10 @@ "src@abc", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json b/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json index 80514a5a8..72052deca 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json @@ -21,10 +21,10 @@ "--with_branch_heads", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update - with branch heads", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json b/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json index 06f99c8bd..9b6187d0f 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json @@ -20,10 +20,10 @@ "src@abc", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json b/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json index 7e89ebcaf..d3d9f6f07 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json @@ -21,10 +21,10 @@ "--clobber", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", 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 cebcee0b8..7ea7d1036 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 @@ -26,10 +26,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -82,10 +82,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json b/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json index 29777373d..83e7d37be 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json @@ -21,10 +21,10 @@ "--gerrit_no_rebase_patch_ref", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json b/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json index 7dd91ee30..49817dfaf 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json @@ -21,10 +21,10 @@ "--gerrit_no_reset", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json b/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json index b816b9825..3cf7e5918 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json @@ -21,10 +21,10 @@ "--no_shallow", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json b/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json index 25c8928a9..1112dc974 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json @@ -20,10 +20,10 @@ "src@revision", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -78,10 +78,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json b/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json index 8f0f19836..08467a220 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json @@ -22,10 +22,10 @@ "+refs/change/1/2/333", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -80,10 +80,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json index bc16d5182..67e9ecc6d 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json @@ -24,10 +24,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -82,10 +82,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json index f23146857..20e7e6c73 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json @@ -22,10 +22,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -80,10 +80,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json index f2e18e9f7..eeac27300 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json @@ -22,10 +22,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ";RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -80,10 +80,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ";RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", 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 bb0f332c6..cddeccaf6 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json @@ -26,10 +26,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -86,10 +86,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", 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 bd1f1aa40..ccd0507c6 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 @@ -26,10 +26,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", 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 f46ce31e3..c3e4ec4f0 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 @@ -26,10 +26,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", 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 7770137b5..fb8ca94f4 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 @@ -26,10 +26,10 @@ "src@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json index 7b84b5bec..9c462ceef 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json @@ -26,10 +26,10 @@ "src/third_party/angle@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -87,10 +87,10 @@ "--revision", "src/third_party/angle@HEAD" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json index 7b84b5bec..9c462ceef 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json @@ -26,10 +26,10 @@ "src/third_party/angle@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -87,10 +87,10 @@ "--revision", "src/third_party/angle@HEAD" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", 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 0a1645e1a..2c4facaf0 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 @@ -28,10 +28,10 @@ "src/v8@abc", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -91,10 +91,10 @@ "--revision", "src/v8@abc" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json index 51d9ff92c..e06401d20 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json @@ -28,10 +28,10 @@ "src/v8@HEAD", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -91,10 +91,10 @@ "--revision", "src/v8@HEAD" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json b/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json index 59182c61b..9307d58cc 100644 --- a/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +++ b/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json @@ -21,10 +21,10 @@ "--with_tags", "--disable-syntax-validation" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update", @@ -79,10 +79,10 @@ "--revision", "src@f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9" ], - "env": { - "GIT_HTTP_LOW_SPEED_LIMIT": "1000", - "GIT_HTTP_LOW_SPEED_TIME": "300", - "PATH": ":RECIPE_PACKAGE_REPO[depot_tools]" + "env_prefixes": { + "PATH": [ + "RECIPE_PACKAGE_REPO[depot_tools]" + ] }, "infra_step": true, "name": "bot_update (without patch)", diff --git a/recipes/recipe_modules/depot_tools/api.py b/recipes/recipe_modules/depot_tools/api.py index 9d03ed48d..16863ad54 100644 --- a/recipes/recipe_modules/depot_tools/api.py +++ b/recipes/recipe_modules/depot_tools/api.py @@ -13,6 +13,11 @@ class DepotToolsApi(recipe_api.RecipeApi): def upload_to_google_storage_path(self): return self.package_repo_resource('upload_to_google_storage.py') + @property + def root(self): + """Returns (Path): The "depot_tools" root directory.""" + return self.package_repo_resource() + @property def cros_path(self): return self.package_repo_resource('cros') diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json b/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json index 954d9ab10..1cc3f560d 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json @@ -1,4 +1,11 @@ [ + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]" + ], + "name": "root" + }, { "cmd": [ "ls", diff --git a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json index ce6e12d92..e7f4b94f6 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +++ b/recipes/recipe_modules/depot_tools/examples/full.expected/win.json @@ -1,4 +1,11 @@ [ + { + "cmd": [ + "ls", + "RECIPE_PACKAGE_REPO[depot_tools]" + ], + "name": "root" + }, { "cmd": [ "ls", diff --git a/recipes/recipe_modules/depot_tools/examples/full.py b/recipes/recipe_modules/depot_tools/examples/full.py index b867d5115..57c6d66f8 100644 --- a/recipes/recipe_modules/depot_tools/examples/full.py +++ b/recipes/recipe_modules/depot_tools/examples/full.py @@ -11,6 +11,8 @@ DEPS = [ def RunSteps(api): + api.step('root', ['ls', api.depot_tools.root]) + api.step( 'download_from_google_storage', ['ls', api.depot_tools.download_from_google_storage_path])