Index: recipe_modules/gclient/api.py |
diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py |
index 7565fed62b3892c592abc10494f181779a8a6172..22914a8fb8614dc27070ea3fd7bea445e8a687a4 100644 |
--- a/recipe_modules/gclient/api.py |
+++ b/recipe_modules/gclient/api.py |
@@ -321,23 +321,41 @@ class GclientApi(recipe_api.RecipeApi): |
"""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. |
""" |
- self.m.python.inline( |
- 'cleanup index.lock', |
- """ |
- import os, sys |
- |
- build_path = sys.argv[1] |
- if os.path.exists(build_path): |
- for (path, dir, files) in os.walk(build_path): |
- for cur_file in files: |
- if cur_file.endswith('index.lock'): |
- path_to_file = os.path.join(path, cur_file) |
- print 'deleting %s' % path_to_file |
- os.remove(path_to_file) |
- """, |
- args=[self.m.path['slave_build']], |
- infra_step=True, |
- ) |
+ if self.c and self.c.break_locks_flag: |
+ self.m.python.inline( |
+ 'cleanup index.lock', |
+ """ |
+ import os, sys |
+ |
+ build_path = sys.argv[1] |
+ if os.path.exists(build_path): |
+ for (path, dir, files) in os.walk(build_path): |
+ for cur_file in files: |
+ if cur_file.endswith('index.lock'): |
+ path_to_file = os.path.join(path, cur_file) |
+ os.remove(path_to_file) |
+ """, |
+ args=[self.m.path['slave_build']], |
+ infra_step=True, |
+ ) |
+ else: |
+ self.m.python.inline( |
+ 'cleanup index.lock', |
+ """ |
+ import os, sys |
+ |
+ build_path = sys.argv[1] |
+ if os.path.exists(build_path): |
+ for (path, dir, files) in os.walk(build_path): |
+ for cur_file in files: |
+ if cur_file.endswith('index.lock'): |
+ path_to_file = os.path.join(path, cur_file) |
+ print 'deleting %s' % path_to_file |
+ os.remove(path_to_file) |
+ """, |
+ args=[self.m.path['slave_build']], |
+ infra_step=True, |
+ ) |
def calculate_patch_root(self, patch_project, gclient_config=None): |
"""Returns path where a patch should be applied to based patch_project. |