Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: scripts/slave/recipe_util.py

Issue 14602020: Add an AOSP builder recipe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/slave/compile.py ('k') | scripts/slave/recipes/android_webview_aosp.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_util.py
diff --git a/scripts/slave/recipe_util.py b/scripts/slave/recipe_util.py
index 02e934c2585d39bdaa68567828b22e5e62c9ba88..c69ba5c02b723206e5ef91eef0a4e109709f2375 100644
--- a/scripts/slave/recipe_util.py
+++ b/scripts/slave/recipe_util.py
@@ -64,9 +64,11 @@ functionality provided by annotated_run.
""" # pylint: disable=W0105
checkout_path = _path_method('checkout_path', '%(CheckoutRootPlaceholder)s')
+def path_exists(path):
+ return _os.path.exists(path)
@_contextlib.contextmanager
-def mock_paths():
+def mock_paths(paths_to_mock=None):
"""Used by unittest/recipes_test.py to temporarily override the paths
generated by the various path functions in this module.
@@ -79,6 +81,7 @@ def mock_paths():
g = globals()
tokens = {}
path_funcs = {}
+ paths_to_mock = frozenset(paths_to_mock or [])
try:
for name in path_base_names:
token_name = (name + '_root').upper()
@@ -92,6 +95,10 @@ def mock_paths():
if path_func_name in g:
path_funcs[path_func_name] = g[path_func_name]
g[path_func_name] = _path_method(path_func_name, token_val)
+
+ path_funcs['path_exists'] = g['path_exists']
+ g['path_exists'] = lambda path: path in paths_to_mock
+
yield
finally:
g.update(tokens)
@@ -378,10 +385,18 @@ class Steps(object):
self.git('submodule', 'update', '--init', '--recursive', cwd=dir_path),
]
- def gclient_checkout(self, common_repo_name, git_mode=False):
+ def gclient_checkout(self, common_repo_name_or_spec, git_mode=False,
+ spec_name=None):
"""Returns a step generator function for gclient checkouts."""
- spec = GCLIENT_COMMON_SPECS[common_repo_name](self)
+ if isinstance(common_repo_name_or_spec, basestring):
+ spec = GCLIENT_COMMON_SPECS[common_repo_name_or_spec](self)
+ else:
+ spec = common_repo_name_or_spec
spec_string = ''
+ if not spec_name:
+ step_name = lambda n: 'gclient ' + n
+ else:
+ step_name = lambda n: '[spec: %s] gclient %s' % (spec_name, n)
for key in spec:
# We should be using json.dumps here, but gclient directly execs the dict
# that it receives as the argument to --spec, so we have to have True,
@@ -390,8 +405,9 @@ class Steps(object):
gclient = depot_tools_path('gclient') + ('.bat' if IsWindows() else '')
if not git_mode:
- clean_step = self.step('gclient clean', [gclient, 'revert', '--nohooks'])
- sync_step = self.step('gclient sync', [gclient, 'sync', '--nohooks'])
+ clean_step = self.step(step_name('clean'),
+ [gclient, 'revert', '--nohooks'])
+ sync_step = self.step(step_name('sync'), [gclient, 'sync', '--nohooks'])
else:
# clean() isn't used because the gclient sync flags passed in checkout()
# do much the same thing, and they're more correct than doing a separate
@@ -407,12 +423,12 @@ class Steps(object):
# git-based builds (e.g. maybe some combination of 'git reset/clean -fx'
# and removing the 'out' directory).
clean_step = None
- sync_step = self.step('gclient sync', [
+ sync_step = self.step(step_name('sync'), [
gclient, 'sync', '--verbose', '--with_branch_heads', '--nohooks',
'--reset', '--delete_unversioned_trees', '--force'])
steps = [
self.step(
- 'gclient setup',
+ step_name('setup'),
[gclient, 'config', '--spec', spec_string],
static_json_data={
'CheckoutRoot': slave_build_path(spec['solutions'][0]['name']),
« no previous file with comments | « scripts/slave/compile.py ('k') | scripts/slave/recipes/android_webview_aosp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698