diff options
author | Robert Iannucci <iannucci@google.com> | 2017-05-12 19:09:38 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-15 13:46:22 +0000 |
commit | 297a7efd54495a06a7473eb8d99b211fd511766c (patch) | |
tree | 44b09641b37f75abe50d849a1082b6d9b6c6a459 /infra/bots/recipe_modules | |
parent | 9018952290a468886c819405c6d9495b4aa5d7d4 (diff) |
[skia] convert recipes and module to new context module
This is a syntax-only change to convert to the new (documented) context
module.
R=borenet@google.com
Bug: skia:
Change-Id: Id907c309d3cf38b85a46f6d8d7ce90ed58ba026f
Reviewed-on: https://skia-review.googlesource.com/16840
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules')
-rw-r--r-- | infra/bots/recipe_modules/core/__init__.py | 1 | ||||
-rw-r--r-- | infra/bots/recipe_modules/core/api.py | 8 | ||||
-rw-r--r-- | infra/bots/recipe_modules/env/__init__.py | 2 | ||||
-rw-r--r-- | infra/bots/recipe_modules/env/api.py | 4 | ||||
-rw-r--r-- | infra/bots/recipe_modules/env/example.py | 3 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/__init__.py | 1 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/flutter_flavor.py | 2 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/gn_android_flavor.py | 4 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py | 9 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/gn_flavor.py | 6 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/pdfium_flavor.py | 4 | ||||
-rw-r--r-- | infra/bots/recipe_modules/infra/__init__.py | 1 | ||||
-rw-r--r-- | infra/bots/recipe_modules/infra/api.py | 4 | ||||
-rw-r--r-- | infra/bots/recipe_modules/run/example.py | 3 | ||||
-rw-r--r-- | infra/bots/recipe_modules/swarming/__init__.py | 1 | ||||
-rw-r--r-- | infra/bots/recipe_modules/swarming/api.py | 2 | ||||
-rw-r--r-- | infra/bots/recipe_modules/vars/__init__.py | 1 | ||||
-rw-r--r-- | infra/bots/recipe_modules/vars/api.py | 2 |
18 files changed, 30 insertions, 28 deletions
diff --git a/infra/bots/recipe_modules/core/__init__.py b/infra/bots/recipe_modules/core/__init__.py index 9112c1c4f8..6b541c39aa 100644 --- a/infra/bots/recipe_modules/core/__init__.py +++ b/infra/bots/recipe_modules/core/__init__.py @@ -8,6 +8,7 @@ DEPS = [ 'depot_tools/gclient', 'depot_tools/tryserver', 'flavor', + 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', diff --git a/infra/bots/recipe_modules/core/api.py b/infra/bots/recipe_modules/core/api.py index 0a2cb4ef1d..747416468a 100644 --- a/infra/bots/recipe_modules/core/api.py +++ b/infra/bots/recipe_modules/core/api.py @@ -41,7 +41,7 @@ class SkiaApi(recipe_api.RecipeApi): git = 'git.bat' else: git = 'git' - with self.m.step.context({'cwd': repo_path}): + with self.m.context(cwd=repo_path): self.m.step('git remote set-url', cmd=[git, 'remote', 'set-url', 'origin', repo.url], infra_step=True) @@ -159,13 +159,13 @@ class SkiaApi(recipe_api.RecipeApi): self.m.bot_update._repository = patch_repo self.m.gclient.c = gclient_cfg - with self.m.step.context({'cwd': self.m.vars.checkout_root}): + with self.m.context(cwd=self.m.vars.checkout_root): update_step = self.m.bot_update.ensure_checkout(patch_root=patch_root) self.m.vars.got_revision = ( update_step.presentation.properties['got_revision']) if self.m.vars.need_chromium_checkout: - with self.m.step.context({'cwd': self.m.vars.checkout_root, - 'env': self.m.vars.gclient_env}): + with self.m.context(cwd=self.m.vars.checkout_root, + env=self.m.vars.gclient_env): self.m.gclient.runhooks() diff --git a/infra/bots/recipe_modules/env/__init__.py b/infra/bots/recipe_modules/env/__init__.py index 67d72f4fb8..774cf5f42a 100644 --- a/infra/bots/recipe_modules/env/__init__.py +++ b/infra/bots/recipe_modules/env/__init__.py @@ -4,6 +4,6 @@ DEPS = [ - 'recipe_engine/step', + 'recipe_engine/context', ] diff --git a/infra/bots/recipe_modules/env/api.py b/infra/bots/recipe_modules/env/api.py index 8060a0f946..ea9ed523a8 100644 --- a/infra/bots/recipe_modules/env/api.py +++ b/infra/bots/recipe_modules/env/api.py @@ -8,7 +8,7 @@ from recipe_engine import recipe_api class EnvApi(recipe_api.RecipeApi): def __call__(self, env_dict): - env = self.m.step.get_from_context('env', {}) + env = self.m.context.env # If PATH is defined in both, merge them together, merging default_env into # path by replacing %(PATH)s upstream_path = env.get('PATH', '') @@ -17,4 +17,4 @@ class EnvApi(recipe_api.RecipeApi): if upstream_path and my_path and upstream_path != my_path: env['PATH'] = upstream_path.replace(r'%(PATH)s', my_path) - return self.m.step.context({'env': env}) + return self.m.context(env=env) diff --git a/infra/bots/recipe_modules/env/example.py b/infra/bots/recipe_modules/env/example.py index a22899b576..d53ab57973 100644 --- a/infra/bots/recipe_modules/env/example.py +++ b/infra/bots/recipe_modules/env/example.py @@ -5,6 +5,7 @@ DEPS = [ 'env', + 'recipe_engine/context', 'recipe_engine/step', ] @@ -15,7 +16,7 @@ def RunSteps(api): api.step('2', cmd=['echo', 'hi']) path = 'mypath:%(PATH)s' - with api.step.context({'env': {'PATH': path}}): + with api.context(env={'PATH': path}): api.step('3', cmd=['echo', 'hi']) with api.env({'PATH': '%(PATH)s:otherpath'}): api.step('4', cmd=['echo', 'hi']) diff --git a/infra/bots/recipe_modules/flavor/__init__.py b/infra/bots/recipe_modules/flavor/__init__.py index f4176820f8..a5ef0640e3 100644 --- a/infra/bots/recipe_modules/flavor/__init__.py +++ b/infra/bots/recipe_modules/flavor/__init__.py @@ -7,6 +7,7 @@ DEPS = [ 'build/file', 'builder_name_schema', 'depot_tools/bot_update', + 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', diff --git a/infra/bots/recipe_modules/flavor/flutter_flavor.py b/infra/bots/recipe_modules/flavor/flutter_flavor.py index 0f0302b20e..6b95cb8160 100644 --- a/infra/bots/recipe_modules/flavor/flutter_flavor.py +++ b/infra/bots/recipe_modules/flavor/flutter_flavor.py @@ -20,7 +20,7 @@ class FlutterFlavorUtils(default_flavor.DefaultFlavorUtils): extra_config = self.m.vars.builder_cfg.get('extra_config', '') out_dir = configuration - with self.m.step.context({'cwd': flutter_dir}): + with self.m.context(cwd=flutter_dir): # Runhook to generate the gn binary in buildtools. self.m.run( self.m.step, diff --git a/infra/bots/recipe_modules/flavor/gn_android_flavor.py b/infra/bots/recipe_modules/flavor/gn_android_flavor.py index 095a82c1d3..1ff8b8c10c 100644 --- a/infra/bots/recipe_modules/flavor/gn_android_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_android_flavor.py @@ -24,11 +24,11 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils): tmp_dir = self.m.vars.android_data_dir) def _run(self, title, *cmd, **kwargs): - with self.m.step.context({'cwd': self.m.vars.skia_dir}): + with self.m.context(cwd=self.m.vars.skia_dir): return self.m.run(self.m.step, title, cmd=list(cmd), **kwargs) def _py(self, title, script, infra_step=True): - with self.m.step.context({'cwd': self.m.vars.skia_dir}): + with self.m.context(cwd=self.m.vars.skia_dir): return self.m.run(self.m.python, title, script=script, infra_step=infra_step) diff --git a/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py b/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py index c004d9971e..3cf2cf19d1 100644 --- a/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_chromebook_flavor.py @@ -135,13 +135,8 @@ class GNChromebookFlavorUtils(gn_flavor.GNFlavorUtils): ninja = 'ninja.exe' if 'Win' in os else 'ninja' gn = self.m.vars.skia_dir.join('bin', gn) - context = { - 'cwd': self.m.vars.skia_dir, - 'env': { - 'LD_LIBRARY_PATH': sysroot_dir.join('lib'), - } - } - with self.m.step.context(context): + with self.m.context(cwd=self.m.vars.skia_dir, + env={'LD_LIBRARY_PATH': sysroot_dir.join('lib')}): self._py('fetch-gn', self.m.vars.skia_dir.join('bin', 'fetch-gn')) self._run('gn gen', [gn, 'gen', self.out_dir, '--args=' + gn_args]) self._run('ninja', [ninja, '-C', self.out_dir, 'nanobench', 'dm']) diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py index 744cc5a1ce..1b243717a5 100644 --- a/infra/bots/recipe_modules/flavor/gn_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_flavor.py @@ -127,7 +127,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils): ninja = 'ninja.exe' if 'Win' in os else 'ninja' gn = self.m.vars.skia_dir.join('bin', gn) - with self.m.step.context({'cwd': self.m.vars.skia_dir}): + with self.m.context(cwd=self.m.vars.skia_dir): self._py('fetch-gn', self.m.vars.skia_dir.join('bin', 'fetch-gn')) self._run('gn gen', [gn, 'gen', self.out_dir, '--args=' + gn_args]) self._run('ninja', [ninja, '-C', self.out_dir]) @@ -171,12 +171,12 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils): # Convert path objects or placeholders into strings such that they can # be passed to symbolize_stack_trace.py args = [self.m.vars.slave_dir] + [str(x) for x in cmd] - with self.m.step.context({'cwd': self.m.vars.skia_dir, 'env': env}): + with self.m.context(cwd=self.m.vars.skia_dir, env=env): self._py('symbolized %s' % name, self.module.resource('symbolize_stack_trace.py'), args=args, infra_step=False) else: - with self.m.step.context({'env': env}): + with self.m.context(env=env): self._run(name, cmd) diff --git a/infra/bots/recipe_modules/flavor/pdfium_flavor.py b/infra/bots/recipe_modules/flavor/pdfium_flavor.py index 84645f2720..7c34a3299d 100644 --- a/infra/bots/recipe_modules/flavor/pdfium_flavor.py +++ b/infra/bots/recipe_modules/flavor/pdfium_flavor.py @@ -17,7 +17,7 @@ class PDFiumFlavorUtils(default_flavor.DefaultFlavorUtils): pdfium_dir = self.m.vars.checkout_root.join('pdfium') # Runhook to generate the gn binary in buildtools. - with self.m.step.context({'cwd': pdfium_dir}): + with self.m.context(cwd=pdfium_dir): self.m.run( self.m.step, 'runhook', @@ -45,7 +45,7 @@ class PDFiumFlavorUtils(default_flavor.DefaultFlavorUtils): env = self.m.step.get_from_context('env', {}) env['CHROMIUM_BUILDTOOLS_PATH'] = str(pdfium_dir.join('buildtools')) - with self.m.step.context({'env': env}): + with self.m.context(env=env): self.m.run( self.m.step, 'gn_gen', diff --git a/infra/bots/recipe_modules/infra/__init__.py b/infra/bots/recipe_modules/infra/__init__.py index ba20b52f95..94aa82aa7b 100644 --- a/infra/bots/recipe_modules/infra/__init__.py +++ b/infra/bots/recipe_modules/infra/__init__.py @@ -3,6 +3,7 @@ # found in the LICENSE file. DEPS = [ + 'recipe_engine/context', 'recipe_engine/step', 'run', 'vars', diff --git a/infra/bots/recipe_modules/infra/api.py b/infra/bots/recipe_modules/infra/api.py index 4eb3aed2a8..0a4784267a 100644 --- a/infra/bots/recipe_modules/infra/api.py +++ b/infra/bots/recipe_modules/infra/api.py @@ -39,7 +39,7 @@ class InfraApi(recipe_api.RecipeApi): """Print the Go version.""" env = self.m.step.get_from_context('env', {}) env.update(self.go_env) - with self.m.step.context({'env': env}): + with self.m.context(env=env): self.m.run( self.m.step, 'go version', @@ -57,7 +57,7 @@ class InfraApi(recipe_api.RecipeApi): self.go_version() env = self.m.step.get_from_context('env', {}) env.update(self.go_env) - with self.m.step.context({'env': env}): + with self.m.context(env=env): self.m.run.with_retry( self.m.step, 'update go pkgs', diff --git a/infra/bots/recipe_modules/run/example.py b/infra/bots/recipe_modules/run/example.py index dd4ddcb7ec..162f6792a8 100644 --- a/infra/bots/recipe_modules/run/example.py +++ b/infra/bots/recipe_modules/run/example.py @@ -4,6 +4,7 @@ DEPS = [ + 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/step', @@ -36,7 +37,7 @@ def RunSteps(api): api.run.rmtree('mydir') # Merge PATHs. - with api.step.context({'env': {'PATH': 'mydir:%(PATH)s'}}): + with api.context(env={'PATH': 'mydir:%(PATH)s'}): api.run(api.step, 'env', cmd=['env']) # Copy build products. diff --git a/infra/bots/recipe_modules/swarming/__init__.py b/infra/bots/recipe_modules/swarming/__init__.py index 3e05b02b1f..fbd0c006cf 100644 --- a/infra/bots/recipe_modules/swarming/__init__.py +++ b/infra/bots/recipe_modules/swarming/__init__.py @@ -8,6 +8,7 @@ DEPS = [ 'build/swarming', 'build/swarming_client', 'depot_tools/depot_tools', + 'recipe_engine/context', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/properties', diff --git a/infra/bots/recipe_modules/swarming/api.py b/infra/bots/recipe_modules/swarming/api.py index 81b05e0f82..35dddcf507 100644 --- a/infra/bots/recipe_modules/swarming/api.py +++ b/infra/bots/recipe_modules/swarming/api.py @@ -44,7 +44,7 @@ class SkiaSwarmingApi(recipe_api.RecipeApi): depot_tools_path = self.m.depot_tools.package_repo_resource() env = {'PATH': self.m.path.pathsep.join([ str(depot_tools_path), '%(PATH)s'])} - with self.m.step.context({'env': env}): + with self.m.context(env=env): self.m.step('download luci-go linux', ['download_from_google_storage', '--no_resume', '--platform=linux*', '--no_auth', diff --git a/infra/bots/recipe_modules/vars/__init__.py b/infra/bots/recipe_modules/vars/__init__.py index e0e951379f..98c1d3ec2f 100644 --- a/infra/bots/recipe_modules/vars/__init__.py +++ b/infra/bots/recipe_modules/vars/__init__.py @@ -5,6 +5,7 @@ DEPS = [ 'builder_name_schema', 'depot_tools/bot_update', + 'recipe_engine/context', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/properties', diff --git a/infra/bots/recipe_modules/vars/api.py b/infra/bots/recipe_modules/vars/api.py index dbafc90ac3..e48de5bee6 100644 --- a/infra/bots/recipe_modules/vars/api.py +++ b/infra/bots/recipe_modules/vars/api.py @@ -28,7 +28,7 @@ class SkiaVarsApi(recipe_api.RecipeApi): self.slave_dir = self.m.path['start_dir'] self.checkout_root = self.slave_dir - self.default_env = self.m.step.get_from_context('env', {}) + self.default_env = self.m.context.env self.default_env['CHROME_HEADLESS'] = '1' self.default_env['PATH'] = self.m.path.pathsep.join([ self.default_env.get('PATH', '%(PATH)s'), |