Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import os | 6 import os |
| 7 import struct | 7 import struct |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 sys.path.append( | 10 sys.path.append( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 'repository': 'https://fake.org/%s.git' % project_name, | 65 'repository': 'https://fake.org/%s.git' % project_name, |
| 66 'revision': self.gen_revision(project_name, git_mode), | 66 'revision': self.gen_revision(project_name, git_mode), |
| 67 } | 67 } |
| 68 for project_name in revision_mapping | 68 for project_name in revision_mapping |
| 69 } | 69 } |
| 70 }) | 70 }) |
| 71 | 71 |
| 72 if fail_patch: | 72 if fail_patch: |
| 73 output['log_lines'] = [('patch error', 'Patch failed to apply'),] | 73 output['log_lines'] = [('patch error', 'Patch failed to apply'),] |
| 74 output['patch_failure'] = True | 74 output['patch_failure'] = True |
| 75 output['return_code'] = 1 | |
|
Sergiy Byelozyorov
2015/10/02 12:44:35
if fail_patch == 'apply':
output['return_code']
tandrii(chromium)
2015/10/02 12:50:36
If it's 0 OR if apply_issue isn't run at all, it's
| |
| 76 if fail_patch == 'download': | |
| 77 output['return_code'] = 3 | |
| 75 return self.m.json.output(output) | 78 return self.m.json.output(output) |
| 76 | 79 |
| 77 @staticmethod | 80 @staticmethod |
| 78 def gen_revision(project, GIT_MODE): | 81 def gen_revision(project, GIT_MODE): |
| 79 """Hash project to bogus deterministic revision values.""" | 82 """Hash project to bogus deterministic revision values.""" |
| 80 h = hashlib.sha1(project) | 83 h = hashlib.sha1(project) |
| 81 if GIT_MODE: | 84 if GIT_MODE: |
| 82 return h.hexdigest() | 85 return h.hexdigest() |
| 83 else: | 86 else: |
| 84 return struct.unpack('!I', h.digest()[:4])[0] % 300000 | 87 return struct.unpack('!I', h.digest()[:4])[0] % 300000 |
| OLD | NEW |