OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import hashlib | 5 import hashlib |
6 | 6 |
7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
8 | 8 |
9 """ | 9 """ |
10 The 'git_clone_bundler' creates and uploads 'clone.bundle' packages to | 10 The 'git_clone_bundler' creates and uploads 'clone.bundle' packages to |
11 Google Storage for specified Git repositories. | 11 Google Storage for specified Git repositories. |
12 """ | 12 """ |
13 | 13 |
14 class GitCloneBundlerApi(recipe_api.RecipeApi): | 14 class GitCloneBundlerApi(recipe_api.RecipeApi): |
15 """Provides methods to encapsulate repo operations.""" | 15 """Provides methods to encapsulate repo operations.""" |
16 | 16 |
17 def __init__(self, **kwargs): | 17 def __init__(self, **kwargs): |
18 super(recipe_api.RecipeApi, self).__init__(**kwargs) | 18 super(recipe_api.RecipeApi, self).__init__(**kwargs) |
19 | 19 |
20 @property | 20 @property |
21 def base_path(self): | 21 def base_path(self): |
22 return self.m.infra_paths['slave_build'].join('git_clone_bundler') | 22 return self.m.path['slave_build'].join('git_clone_bundler') |
23 | 23 |
24 @property | 24 @property |
25 def bundle_dir(self): | 25 def bundle_dir(self): |
26 return self.base_path.join('bundles') | 26 return self.base_path.join('bundles') |
27 | 27 |
28 @staticmethod | 28 @staticmethod |
29 def _hashname(base): | 29 def _hashname(base): |
30 return hashlib.md5(base).hexdigest() | 30 return hashlib.md5(base).hexdigest() |
31 | 31 |
32 def _setup(self): | 32 def _setup(self): |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 except self.m.step.StepFailure as e: | 158 except self.m.step.StepFailure as e: |
159 result = self.m.step.active_result | 159 result = self.m.step.active_result |
160 result.presentation.step_text = 'Exception: %s' % (e,) | 160 result.presentation.step_text = 'Exception: %s' % (e,) |
161 result.presentation.status = self.m.step.FAILURE | 161 result.presentation.status = self.m.step.FAILURE |
162 errors.append(e) | 162 errors.append(e) |
163 | 163 |
164 if errors: | 164 if errors: |
165 raise self.m.step.StepFailure("Encountered %d bundler failure(s)" % ( | 165 raise self.m.step.StepFailure("Encountered %d bundler failure(s)" % ( |
166 len(errors,))) | 166 len(errors,))) |
167 return bundle_map | 167 return bundle_map |
OLD | NEW |