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

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 on top of CL 15270004 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
Index: scripts/slave/recipe_util.py
diff --git a/scripts/slave/recipe_util.py b/scripts/slave/recipe_util.py
index dd9cff57512fee0c9653a67334082ba9fb07f585..7ff0c2d26ec78004b3323056d357bf77f76996c9 100644
--- a/scripts/slave/recipe_util.py
+++ b/scripts/slave/recipe_util.py
@@ -63,9 +63,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(mock_path_exists=None):
"""Used by unittest/recipes_test.py to temporarily override the paths
generated by the various path functions in this module.
@@ -91,6 +93,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)
+
+ if mock_path_exists:
iannucci 2013/05/20 19:41:38 Let's replace path_exists no matter what. If not m
mkosiba (inactive) 2013/05/21 10:56:07 Done.
+ path_funcs['path_exists'] = g['path_exists']
+ g['path_exists'] = lambda path: path in mock_path_exists
yield
finally:
g.update(tokens)
@@ -366,10 +372,18 @@ class Steps(object):
self.git('submodule', 'update', '--init', '--recursive'),
]
- 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,
@@ -378,8 +392,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
@@ -395,12 +410,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']),

Powered by Google App Engine
This is Rietveld 408576698