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