| 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 collections | 5 import collections |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import posixpath | 8 import posixpath |
| 9 import re | 9 import re |
| 10 import tempfile | 10 import tempfile |
| 11 import types | 11 import types |
| 12 | 12 |
| 13 from pylib import cmd_helper | 13 from devil.android import device_errors |
| 14 from devil.android import device_temp_file |
| 15 from devil.utils import cmd_helper |
| 14 from pylib import constants | 16 from pylib import constants |
| 15 from pylib.utils import device_temp_file | |
| 16 from pylib.device import device_errors | |
| 17 | 17 |
| 18 MD5SUM_DEVICE_LIB_PATH = '/data/local/tmp/md5sum/' | 18 MD5SUM_DEVICE_LIB_PATH = '/data/local/tmp/md5sum/' |
| 19 MD5SUM_DEVICE_BIN_PATH = MD5SUM_DEVICE_LIB_PATH + 'md5sum_bin' | 19 MD5SUM_DEVICE_BIN_PATH = MD5SUM_DEVICE_LIB_PATH + 'md5sum_bin' |
| 20 | 20 |
| 21 _STARTS_WITH_CHECKSUM_RE = re.compile(r'^\s*[0-9a-fA-F]{32}\s+') | 21 _STARTS_WITH_CHECKSUM_RE = re.compile(r'^\s*[0-9a-fA-F]{32}\s+') |
| 22 | 22 |
| 23 | 23 |
| 24 def CalculateHostMd5Sums(paths): | 24 def CalculateHostMd5Sums(paths): |
| 25 """Calculates the MD5 sum value for all items in |paths|. | 25 """Calculates the MD5 sum value for all items in |paths|. |
| 26 | 26 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 raise | 101 raise |
| 102 | 102 |
| 103 return _ParseMd5SumOutput(out) | 103 return _ParseMd5SumOutput(out) |
| 104 | 104 |
| 105 | 105 |
| 106 def _ParseMd5SumOutput(out): | 106 def _ParseMd5SumOutput(out): |
| 107 hash_and_path = (l.split(None, 1) for l in out | 107 hash_and_path = (l.split(None, 1) for l in out |
| 108 if l and _STARTS_WITH_CHECKSUM_RE.match(l)) | 108 if l and _STARTS_WITH_CHECKSUM_RE.match(l)) |
| 109 return dict((p, h) for h, p in hash_and_path) | 109 return dict((p, h) for h, p in hash_and_path) |
| 110 | 110 |
| OLD | NEW |