diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index 65834d8d45..eb7fa66982 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -72,7 +72,7 @@ class BotUpdateApi(recipe_api.RecipeApi): def _get_bot_update_env(self): # TODO(gavinmak): Use mkdtemp when crbug.com/1457059 is fixed. - self._trace_dir = self.m.path['cleanup'] + self._trace_dir = self.m.path.cleanup_dir # If a Git HTTP request is constantly below GIT_HTTP_LOW_SPEED_LIMIT # bytes/second for GIT_HTTP_LOW_SPEED_TIME seconds then such request will be @@ -218,7 +218,7 @@ class BotUpdateApi(recipe_api.RecipeApi): ['--patch_root', patch_root], ['--revision_mapping_file', self.m.json.input(reverse_rev_map)], ['--git-cache-dir', cfg.cache_dir], - ['--cleanup-dir', self.m.path['cleanup'].join('bot_update')], + ['--cleanup-dir', self.m.path.cleanup_dir.join('bot_update')], # Hookups to JSON output back into recipes. ['--output_json', self.m.json.output()], @@ -488,8 +488,8 @@ class BotUpdateApi(recipe_api.RecipeApi): and 'checkout' not in self.m.path and 'root' in result): co_root = result['root'] - cwd = self.m.context.cwd or self.m.path['start_dir'] - self.m.path['checkout'] = cwd.join(*co_root.split(self.m.path.sep)) + cwd = self.m.context.cwd or self.m.path.start_dir + self.m.path.checkout_dir = cwd.join(*co_root.split(self.m.path.sep)) return step_result diff --git a/recipes/recipe_modules/bot_update/examples/full.py b/recipes/recipe_modules/bot_update/examples/full.py index 1d5c6ec001..46cc60ed2d 100644 --- a/recipes/recipe_modules/bot_update/examples/full.py +++ b/recipes/recipe_modules/bot_update/examples/full.py @@ -28,7 +28,7 @@ def RunSteps(api): api.gclient.use_mirror = True commit = api.buildbucket.build.input.gitiles_commit - src_cfg = api.gclient.make_config(CACHE_DIR=api.path['cache'].join('git')) + src_cfg = api.gclient.make_config(CACHE_DIR=api.path.cache_dir.join('git')) soln = src_cfg.solutions.add() soln.name = 'src' soln.url = 'https://chromium.googlesource.com/chromium/src.git' diff --git a/recipes/recipe_modules/gclient/api.py b/recipes/recipe_modules/gclient/api.py index b0cc706413..69bb0f6316 100644 --- a/recipes/recipe_modules/gclient/api.py +++ b/recipes/recipe_modules/gclient/api.py @@ -127,7 +127,7 @@ class GclientApi(recipe_api.RecipeApi): def get_config_defaults(self): return { 'USE_MIRROR': self.use_mirror, - 'CACHE_DIR': self.m.path['cache'].join('git'), + 'CACHE_DIR': self.m.path.cache_dir.join('git'), } @staticmethod @@ -271,9 +271,9 @@ class GclientApi(recipe_api.RecipeApi): name = 'recurse (git config %s)' % var self(name, ['recurse', 'git', 'config', var, val], **kwargs) finally: - cwd = self.m.context.cwd or self.m.path['start_dir'] + cwd = self.m.context.cwd or self.m.path.start_dir if 'checkout' not in self.m.path: - self.m.path['checkout'] = cwd.join( + self.m.path.checkout_dir = cwd.join( *cfg.solutions[0].name.split(self.m.path.sep)) return sync_step @@ -281,14 +281,14 @@ class GclientApi(recipe_api.RecipeApi): def runhooks(self, args=None, name='runhooks', **kwargs): args = args or [] assert isinstance(args, (list, tuple)) - with self.m.context(cwd=(self.m.context.cwd or self.m.path['checkout'])): + with self.m.context(cwd=(self.m.context.cwd or self.m.path.checkout_dir)): return self(name, ['runhooks'] + list(args), infra_step=False, **kwargs) def break_locks(self): """Remove all index.lock files. If a previous run of git crashed, bot was reset, etc... we might end up with leftover index.lock files. """ - cmd = ['python3', '-u', self.resource('cleanup.py'), self.m.path['start_dir']] + cmd = ['python3', '-u', self.resource('cleanup.py'), self.m.path.start_dir] return self.m.step('cleanup index.lock', cmd) def get_gerrit_patch_root(self, gclient_config=None): diff --git a/recipes/recipe_modules/gclient/examples/full.py b/recipes/recipe_modules/gclient/examples/full.py index ccd40c57a9..abfeb19605 100644 --- a/recipes/recipe_modules/gclient/examples/full.py +++ b/recipes/recipe_modules/gclient/examples/full.py @@ -91,7 +91,7 @@ def RunSteps(api): for config_name in TEST_CONFIGS: api.gclient.make_config(config_name) - src_cfg = api.gclient.make_config(CACHE_DIR=api.path['cache'].join('git')) + src_cfg = api.gclient.make_config(CACHE_DIR=api.path.cache_dir.join('git')) soln = src_cfg.solutions.add() soln.name = 'src' soln.url = 'https://chromium.googlesource.com/chromium/src.git' @@ -109,7 +109,7 @@ def RunSteps(api): bl_cfg.revisions['src/third_party/angle'] = 'refs/heads/lkgr' bl_cfg.got_revision_mapping['src/blatley'] = 'got_blatley_revision' - with api.context(cwd=api.path['start_dir'].join('src', 'third_party')): + with api.context(cwd=api.path.start_dir.join('src', 'third_party')): api.gclient.checkout( gclient_config=bl_cfg) diff --git a/recipes/recipe_modules/gclient/tests/diff_deps.py b/recipes/recipe_modules/gclient/tests/diff_deps.py index e267ca905f..8e671b6f61 100644 --- a/recipes/recipe_modules/gclient/tests/diff_deps.py +++ b/recipes/recipe_modules/gclient/tests/diff_deps.py @@ -19,7 +19,7 @@ DEPS = [ ] def RunSteps(api): - src_cfg = api.gclient.make_config(CACHE_DIR=api.path['cache'].join('git')) + src_cfg = api.gclient.make_config(CACHE_DIR=api.path.cache_dir.join('git')) soln = src_cfg.solutions.add() soln.name = 'src' @@ -33,7 +33,7 @@ def RunSteps(api): }) api.gclient.c = src_cfg - affected_files = api.gclient.diff_deps(api.path['cache']) + affected_files = api.gclient.diff_deps(api.path.cache_dir) api.assertions.assertEqual( affected_files, diff --git a/recipes/recipe_modules/gclient/tests/patch_project.py b/recipes/recipe_modules/gclient/tests/patch_project.py index c38e65e1a9..5bab688788 100644 --- a/recipes/recipe_modules/gclient/tests/patch_project.py +++ b/recipes/recipe_modules/gclient/tests/patch_project.py @@ -18,7 +18,7 @@ DEPS = [ def RunSteps(api): - src_cfg = api.gclient.make_config(CACHE_DIR=api.path['cache'].join('git')) + src_cfg = api.gclient.make_config(CACHE_DIR=api.path.cache_dir.join('git')) soln = src_cfg.solutions.add() soln.name = 'src' soln.url = 'https://chromium.googlesource.com/chromium/src.git' diff --git a/recipes/recipe_modules/gclient/tests/sync_failure.py b/recipes/recipe_modules/gclient/tests/sync_failure.py index f295b1947a..b891c2e2b5 100644 --- a/recipes/recipe_modules/gclient/tests/sync_failure.py +++ b/recipes/recipe_modules/gclient/tests/sync_failure.py @@ -13,7 +13,7 @@ DEPS = [ ] def RunSteps(api): - src_cfg = api.gclient.make_config(CACHE_DIR=api.path['cache'].join('git')) + src_cfg = api.gclient.make_config(CACHE_DIR=api.path.cache_dir.join('git')) api.gclient.sync(src_cfg) def GenTests(api): diff --git a/recipes/recipe_modules/git/api.py b/recipes/recipe_modules/git/api.py index a94546c60b..4607feccab 100644 --- a/recipes/recipe_modules/git/api.py +++ b/recipes/recipe_modules/git/api.py @@ -21,7 +21,7 @@ class GitApi(recipe_api.RecipeApi): options = kwargs.pop('git_config_options', {}) for k, v in sorted(options.items()): git_cmd.extend(['-c', '%s=%s' % (k, v)]) - with self.m.context(cwd=(self.m.context.cwd or self.m.path['checkout'])): + with self.m.context(cwd=(self.m.context.cwd or self.m.path.checkout_dir)): return self.m.step(name, git_cmd + list(args), infra_step=infra_step, **kwargs) @@ -178,10 +178,10 @@ class GitApi(recipe_api.RecipeApi): # ex: ssh://host:repo/foobar/.git dir_path = dir_path or dir_path.rsplit('/', 1)[-1] - dir_path = self.m.path['start_dir'].join(dir_path) + dir_path = self.m.path.start_dir.join(dir_path) if 'checkout' not in self.m.path: - self.m.path['checkout'] = dir_path + self.m.path.checkout_dir = dir_path git_setup_args = ['--path', dir_path, '--url', url] @@ -203,12 +203,12 @@ class GitApi(recipe_api.RecipeApi): if use_git_cache: with self.m.context(env={'PATH': path}): self('cache', 'populate', '-c', - self.m.path['cache'].join('git'), url, + self.m.path.cache_dir.join('git'), url, name='populate cache', raise_on_failure=raise_on_failure) dir_cmd = self( 'cache', 'exists', '--quiet', - '--cache-dir', self.m.path['cache'].join('git'), url, + '--cache-dir', self.m.path.cache_dir.join('git'), url, raise_on_failure=raise_on_failure, stdout=self.m.raw_io.output(), step_test_data=lambda: diff --git a/recipes/recipe_modules/git/examples/full.py b/recipes/recipe_modules/git/examples/full.py index b772e76477..e9c2a320bd 100644 --- a/recipes/recipe_modules/git/examples/full.py +++ b/recipes/recipe_modules/git/examples/full.py @@ -24,7 +24,7 @@ def RunSteps(api): # useful for debugging git access issues that are reproducible only on bots. curl_trace_file = None if api.properties.get('use_curl_trace'): - curl_trace_file = api.path['start_dir'].join('curl_trace.log') + curl_trace_file = api.path.start_dir.join('curl_trace.log') submodule_update_force = api.properties.get('submodule_update_force', False) submodule_update_recursive = api.properties.get('submodule_update_recursive', @@ -68,7 +68,7 @@ def RunSteps(api): # If you need to run more arbitrary git commands, you can use api.git itself, # which behaves like api.step(), but automatically sets the name of the step. - with api.context(cwd=api.path['checkout']): + with api.context(cwd=api.path.checkout_dir): api.git('status') api.git('status', name='git status can_fail_build', raise_on_failure=True) @@ -86,7 +86,7 @@ def RunSteps(api): api.git.new_branch('track_current', upstream_current=True) # You can use api.git.rebase to rebase the current branch onto another one api.git.rebase(name_prefix='my repo', branch='origin/main', - dir_path=api.path['checkout'], + dir_path=api.path.checkout_dir, remote_name=api.properties.get('remote_name')) if api.properties.get('cat_file', None): @@ -98,7 +98,7 @@ def RunSteps(api): # Bundle the repository. api.git.bundle_create( - api.path['start_dir'].join('all.bundle')) + api.path.start_dir.join('all.bundle')) def GenTests(api): diff --git a/recipes/recipe_modules/git/tests/number.py b/recipes/recipe_modules/git/tests/number.py index ad23f1237c..d79bd7216e 100644 --- a/recipes/recipe_modules/git/tests/number.py +++ b/recipes/recipe_modules/git/tests/number.py @@ -16,7 +16,7 @@ DEPS = [ def RunSteps(api): # Set the checkout_dir because the `git` module implicitly uses this. - api.path.checkout_dir = api.path['cache'].join('builder') + api.path.checkout_dir = api.path.cache_dir.join('builder') numbers = api.git.number( commitrefs=api.properties.get('commitrefs'), diff --git a/recipes/recipe_modules/gitiles/examples/full.py b/recipes/recipe_modules/gitiles/examples/full.py index e19cb0d25f..f4a2498754 100644 --- a/recipes/recipe_modules/gitiles/examples/full.py +++ b/recipes/recipe_modules/gitiles/examples/full.py @@ -30,10 +30,10 @@ def RunSteps(api): data = api.gitiles.download_file(url, 'NONEXISTENT', attempts=1, accept_statuses=[404]) - api.gitiles.download_archive(url, api.path['start_dir'].join('archive')) + api.gitiles.download_archive(url, api.path.start_dir.join('archive')) try: - api.gitiles.download_archive(url, api.path['start_dir'].join('archive2')) + api.gitiles.download_archive(url, api.path.start_dir.join('archive2')) assert False # pragma: no cover except api.step.StepFailure as ex: assert '/root' in ex.gitiles_skipped_files diff --git a/recipes/recipe_modules/gsutil/examples/full.py b/recipes/recipe_modules/gsutil/examples/full.py index b3763f22ff..d78f14b7f2 100644 --- a/recipes/recipe_modules/gsutil/examples/full.py +++ b/recipes/recipe_modules/gsutil/examples/full.py @@ -12,7 +12,7 @@ DEPS = [ def RunSteps(api): """Move things around in a loop!""" - local_file = api.path['tmp_base'].join('boom') + local_file = api.path.tmp_base_dir.join('boom') bucket = 'example' cloud_file = 'some/random/path/to/boom' @@ -40,13 +40,13 @@ def RunSteps(api): # Upload directory contents. api.gsutil.upload( - api.path['tmp_base'], + api.path.tmp_base_dir, bucket, 'some/random/path', args=['-r'], name='upload -r') api.gsutil.upload( - api.path['tmp_base'], + api.path.tmp_base_dir, bucket, 'some/other/random/path', args=['--recursive'], @@ -75,7 +75,7 @@ def RunSteps(api): pass new_cloud_file = 'staging/to/boom' - new_local_file = api.path['tmp_base'].join('erang') + new_local_file = api.path.tmp_base_dir.join('erang') api.gsutil.download(bucket, new_cloud_file, new_local_file) private_key_file = 'path/to/key' diff --git a/recipes/recipe_modules/osx_sdk/api.py b/recipes/recipe_modules/osx_sdk/api.py index b7daed0ad7..db7c373b5d 100644 --- a/recipes/recipe_modules/osx_sdk/api.py +++ b/recipes/recipe_modules/osx_sdk/api.py @@ -125,7 +125,7 @@ class OSXSDKApi(recipe_api.RecipeApi): """Ensures the mac_toolchain tool and OS X SDK packages are installed. Returns Path to the installed sdk app bundle.""" - cache_dir = self.m.path['cache'].join('osx_sdk') + cache_dir = self.m.path.cache_dir.join('osx_sdk') ef = self.m.cipd.EnsureFile() ef.add_package(self._tool_pkg, self._tool_ver) diff --git a/recipes/recipe_modules/presubmit/api.py b/recipes/recipe_modules/presubmit/api.py index 74de0df812..a0242faa40 100644 --- a/recipes/recipe_modules/presubmit/api.py +++ b/recipes/recipe_modules/presubmit/api.py @@ -95,7 +95,7 @@ class PresubmitApi(recipe_api.RecipeApi): infra_step=False) if self._runhooks: - with self.m.context(cwd=self.m.path['checkout']): + with self.m.context(cwd=self.m.path.checkout_dir): self.m.gclient.runhooks() return bot_update_step diff --git a/recipes/recipe_modules/presubmit/tests/execute.py b/recipes/recipe_modules/presubmit/tests/execute.py index 3c9509802b..3aa764e6b9 100644 --- a/recipes/recipe_modules/presubmit/tests/execute.py +++ b/recipes/recipe_modules/presubmit/tests/execute.py @@ -24,7 +24,7 @@ DEPS = [ def RunSteps(api): api.gclient.set_config('infra') - with api.context(cwd=api.path['cache'].join('builder')): + with api.context(cwd=api.path.cache_dir.join('builder')): bot_update_step = api.presubmit.prepare() skip_owners = api.properties.get('skip_owners', False) run_all = api.properties.get('run_all', False) diff --git a/recipes/recipe_modules/presubmit/tests/prepare.py b/recipes/recipe_modules/presubmit/tests/prepare.py index d1a7160cc4..7b8cfd5c88 100644 --- a/recipes/recipe_modules/presubmit/tests/prepare.py +++ b/recipes/recipe_modules/presubmit/tests/prepare.py @@ -27,7 +27,7 @@ PROPERTIES = { def RunSteps(api, patch_project, patch_repository_url): api.gclient.set_config('infra') - with api.context(cwd=api.path['cache'].join('builder')): + with api.context(cwd=api.path.cache_dir.join('builder')): bot_update_step = api.presubmit.prepare() diff --git a/recipes/recipe_modules/tryserver/api.py b/recipes/recipe_modules/tryserver/api.py index 973ee521a6..db915cb53d 100644 --- a/recipes/recipe_modules/tryserver/api.py +++ b/recipes/recipe_modules/tryserver/api.py @@ -244,7 +244,7 @@ class TryserverApi(recipe_api.RecipeApi): Returned paths will be relative to to api.path['root']. """ - cwd = self.m.context.cwd or self.m.path['start_dir'].join(patch_root) + cwd = self.m.context.cwd or self.m.path.start_dir.join(patch_root) with self.m.context(cwd=cwd): step_result = self.m.git( '-c', 'core.quotePath=false', 'diff', '--cached', '--name-only', diff --git a/recipes/recipe_modules/tryserver/examples/full.py b/recipes/recipe_modules/tryserver/examples/full.py index f9d537e6e8..4266a92ffd 100644 --- a/recipes/recipe_modules/tryserver/examples/full.py +++ b/recipes/recipe_modules/tryserver/examples/full.py @@ -20,7 +20,7 @@ from PB.go.chromium.org.luci.buildbucket.proto.common import GerritChange def RunSteps(api): - api.path['checkout'] = api.path['start_dir'] + api.path.checkout_dir = api.path.start_dir if api.properties.get('patch_text'): api.step('patch_text test', [ 'echo', str(api.tryserver.get_footers(api.properties['patch_text']))]) diff --git a/recipes/recipe_modules/windows_sdk/api.py b/recipes/recipe_modules/windows_sdk/api.py index 32b6f59420..554af8267b 100644 --- a/recipes/recipe_modules/windows_sdk/api.py +++ b/recipes/recipe_modules/windows_sdk/api.py @@ -53,7 +53,7 @@ class WindowsSDKApi(recipe_api.RecipeApi): """ if enabled: sdk_dir = self._ensure_sdk( - path or self.m.path['cache'].join('windows_sdk'), + path or self.m.path.cache_dir.join('windows_sdk'), version or self._sdk_properties['version']) try: with self.m.context(**self._sdk_env(sdk_dir, target_arch)):