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 from recipe_engine import recipe_test_api | 9 from recipe_engine import recipe_test_api |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return self.m.json.output(output) | 77 return self.m.json.output(output) |
78 | 78 |
79 @staticmethod | 79 @staticmethod |
80 def gen_revision(project, GIT_MODE): | 80 def gen_revision(project, GIT_MODE): |
81 """Hash project to bogus deterministic revision values.""" | 81 """Hash project to bogus deterministic revision values.""" |
82 h = hashlib.sha1(project) | 82 h = hashlib.sha1(project) |
83 if GIT_MODE: | 83 if GIT_MODE: |
84 return h.hexdigest() | 84 return h.hexdigest() |
85 else: | 85 else: |
86 return struct.unpack('!I', h.digest()[:4])[0] % 300000 | 86 return struct.unpack('!I', h.digest()[:4])[0] % 300000 |
OLD | NEW |