Index: recipe_modules/path/config.py |
diff --git a/recipe_modules/path/config.py b/recipe_modules/path/config.py |
index cead31ae75e432dca7570233044dc9ac467c9c4f..0ae25c5688db3b3564da538c14e6f7b4fa22c63d 100644 |
--- a/recipe_modules/path/config.py |
+++ b/recipe_modules/path/config.py |
@@ -5,7 +5,7 @@ |
from recipe_engine.config import config_item_context, ConfigGroup, Dict, Static |
from recipe_engine.config_types import Path |
-def BaseConfig(CURRENT_WORKING_DIR, TEMP_DIR, **_kwargs): |
+def BaseConfig(PLATFORM, CURRENT_WORKING_DIR, TEMP_DIR, **_kwargs): |
assert CURRENT_WORKING_DIR[0].endswith(('\\', '/')) |
assert TEMP_DIR[0].endswith(('\\', '/')) |
return ConfigGroup( |
@@ -15,16 +15,61 @@ |
# dynamic path name -> Path object (referencing one of the base_paths) |
dynamic_paths = Dict(value_type=(Path, type(None))), |
+ PLATFORM = Static(PLATFORM), |
CURRENT_WORKING_DIR = Static(tuple(CURRENT_WORKING_DIR)), |
TEMP_DIR = Static(tuple(TEMP_DIR)), |
) |
+ |
+def test_name(args): # pragma: no cover |
+ if args['CURRENT_WORKING_DIR'][0] == '/': |
+ return 'posix' |
+ else: |
+ return 'windows' |
config_ctx = config_item_context(BaseConfig) |
@config_ctx(is_root=True) |
def BASE(c): |
c.base_paths['cwd'] = c.CURRENT_WORKING_DIR |
- c.base_paths['tmp'] = c.TEMP_DIR |
- c.base_paths['root'] = c.CURRENT_WORKING_DIR[:1] |
+ c.base_paths['tmp_base'] = c.TEMP_DIR |
+@config_ctx() |
+def buildbot(c): |
+ c.base_paths['root'] = c.CURRENT_WORKING_DIR[:-4] |
+ c.base_paths['slave_build'] = c.CURRENT_WORKING_DIR |
+ c.base_paths['cache'] = c.base_paths['root'] + ( |
+ 'build', 'slave', 'cache') |
+ c.base_paths['git_cache'] = c.base_paths['root'] + ( |
+ 'build', 'slave', 'cache_dir') |
+ c.base_paths['goma_cache'] = c.base_paths['root'] + ( |
+ 'build', 'slave', 'goma_cache') |
+ for token in ('build_internal', 'build', 'depot_tools'): |
+ c.base_paths[token] = c.base_paths['root'] + (token,) |
c.dynamic_paths['checkout'] = None |
+ |
+@config_ctx(includes=['buildbot']) |
+def swarming(c): |
+ c.base_paths['slave_build'] = ( |
+ c.CURRENT_WORKING_DIR[:1] + |
+ ('b', 'fake_build', 'slave', 'fake_slave', 'build')) |
+ |
+@config_ctx() |
+def kitchen(c): |
+ c.base_paths['root'] = c.CURRENT_WORKING_DIR |
+ c.base_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.base_paths['cache'] = ( |
+ '/', 'b', 'cache', 'chromium') |
+ c.base_paths['git_cache'] = ( |
+ '/', 'b', 'cache', 'chromium', 'git_cache') |
+ c.base_paths['goma_cache'] = ( |
+ '/', 'b', 'cache', 'chromium', 'goma_cache') |
+ else: |
+ c.base_paths['cache'] = c.base_paths['root'] + ('cache',) |
+ c.base_paths['git_cache'] = c.base_paths['root'] + ('cache_dir',) |
+ c.base_paths['goma_cache'] = c.base_paths['root'] + ('goma_cache',) |
+ c.dynamic_paths['checkout'] = None |