depot_tools: add infra_paths recipe module for infra-specific paths
Depends on https://codereview.chromium.org/1906323003 BUG=chromium:605919 Review URL: https://codereview.chromium.org/1915463002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300184 0039d316-1c4b-4281-b951-d872f2087c98changes/60/343160/1
parent
3f0dacf095
commit
f30e872853
@ -0,0 +1,5 @@
|
||||
DEPS = [
|
||||
'recipe_engine/path',
|
||||
'recipe_engine/platform',
|
||||
'recipe_engine/properties',
|
||||
]
|
@ -0,0 +1,33 @@
|
||||
# Copyright 2016 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.
|
||||
|
||||
from recipe_engine import recipe_api
|
||||
|
||||
|
||||
class InfraPathsApi(recipe_api.RecipeApi):
|
||||
def get_config_defaults(self):
|
||||
return {
|
||||
'PLATFORM': self.m.platform.name,
|
||||
'CURRENT_WORKING_DIR': self.m.path['cwd'],
|
||||
'ROOT': self.m.path['root'],
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(InfraPathsApi, self).__init__(**kwargs)
|
||||
self._config_set = False
|
||||
|
||||
def _lazy_set_config(self):
|
||||
if self._config_set:
|
||||
return
|
||||
self._config_set = True
|
||||
|
||||
path_config = self.m.properties.get('path_config')
|
||||
if path_config in ('kitchen',):
|
||||
self.set_config(path_config)
|
||||
else:
|
||||
self.set_config('buildbot')
|
||||
|
||||
def __getitem__(self, name):
|
||||
self._lazy_set_config()
|
||||
return self.c.paths[name]
|
@ -0,0 +1,50 @@
|
||||
# Copyright 2016 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.
|
||||
|
||||
from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static
|
||||
from recipe_engine.config_types import Path
|
||||
|
||||
def BaseConfig(PLATFORM, CURRENT_WORKING_DIR, ROOT, **_kwargs):
|
||||
return ConfigGroup(
|
||||
paths = Dict(value_type=Path),
|
||||
|
||||
PLATFORM = Static(PLATFORM),
|
||||
CURRENT_WORKING_DIR = Static(CURRENT_WORKING_DIR),
|
||||
ROOT = Static(ROOT),
|
||||
)
|
||||
|
||||
config_ctx = config_item_context(BaseConfig)
|
||||
|
||||
@config_ctx()
|
||||
def buildbot(c):
|
||||
c.paths['root'] = c.ROOT.join('b')
|
||||
c.paths['slave_build'] = c.CURRENT_WORKING_DIR
|
||||
c.paths['cache'] = c.paths['root'].join(
|
||||
'build', 'slave', 'cache')
|
||||
c.paths['git_cache'] = c.paths['root'].join(
|
||||
'build', 'slave', 'cache_dir')
|
||||
c.paths['goma_cache'] = c.paths['root'].join(
|
||||
'build', 'slave', 'goma_cache')
|
||||
for token in ('build_internal', 'build', 'depot_tools'):
|
||||
c.paths[token] = c.paths['root'].join(token,)
|
||||
|
||||
@config_ctx()
|
||||
def kitchen(c):
|
||||
c.paths['root'] = c.CURRENT_WORKING_DIR
|
||||
c.paths['slave_build'] = c.CURRENT_WORKING_DIR
|
||||
# TODO(phajdan.jr): have one cache dir, let clients append suffixes.
|
||||
# TODO(phajdan.jr): set persistent cache path for remaining platforms.
|
||||
# NOTE: do not use /b/swarm_slave here - it gets deleted on bot redeploy,
|
||||
# and may happen even after a reboot.
|
||||
if c.PLATFORM == 'linux':
|
||||
c.paths['cache'] = c.ROOT.join(
|
||||
'b', 'cache', 'chromium')
|
||||
c.paths['git_cache'] = c.ROOT.join(
|
||||
'b', 'cache', 'chromium', 'git_cache')
|
||||
c.paths['goma_cache'] = c.ROOT.join(
|
||||
'b', 'cache', 'chromium', 'goma_cache')
|
||||
else:
|
||||
c.paths['cache'] = c.paths['root'].join('cache')
|
||||
c.paths['git_cache'] = c.paths['root'].join('cache_dir')
|
||||
c.paths['goma_cache'] = c.paths['root'].join('goma_cache')
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"cwd": "[CWD]",
|
||||
"name": "step"
|
||||
},
|
||||
{
|
||||
"name": "$result",
|
||||
"recipe_result": null,
|
||||
"status_code": 0
|
||||
}
|
||||
]
|
@ -0,0 +1,24 @@
|
||||
# Copyright 2016 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/platform',
|
||||
'recipe_engine/properties',
|
||||
'recipe_engine/step',
|
||||
]
|
||||
|
||||
from recipe_engine.config_types import Path
|
||||
|
||||
def RunSteps(api):
|
||||
api.step('step', [], cwd=api.infra_paths['slave_build'])
|
||||
|
||||
|
||||
def GenTests(api):
|
||||
for platform in ('linux', 'win', 'mac'):
|
||||
yield (api.test(platform) + api.platform.name(platform))
|
||||
|
||||
yield (api.test('%s_kitchen' % platform) +
|
||||
api.platform.name(platform) +
|
||||
api.properties(path_config='kitchen'))
|
Loading…
Reference in New Issue