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 tempfile | 8 import tempfile |
9 import types | 9 import types |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if isinstance(paths, basestring): | 50 if isinstance(paths, basestring): |
51 paths = [paths] | 51 paths = [paths] |
52 | 52 |
53 if not device.FileExists(MD5SUM_DEVICE_BIN_PATH): | 53 if not device.FileExists(MD5SUM_DEVICE_BIN_PATH): |
54 device.adb.Push( | 54 device.adb.Push( |
55 os.path.join(constants.GetOutDirectory(), 'md5sum_dist'), | 55 os.path.join(constants.GetOutDirectory(), 'md5sum_dist'), |
56 MD5SUM_DEVICE_LIB_PATH) | 56 MD5SUM_DEVICE_LIB_PATH) |
57 | 57 |
58 out = [] | 58 out = [] |
59 with tempfile.NamedTemporaryFile() as md5sum_script_file: | 59 with tempfile.NamedTemporaryFile() as md5sum_script_file: |
60 with device_temp_file.DeviceTempFile(device) as md5sum_device_script_file: | 60 with device_temp_file.DeviceTempFile( |
| 61 device.adb) as md5sum_device_script_file: |
61 md5sum_script = ( | 62 md5sum_script = ( |
62 MD5SUM_DEVICE_SCRIPT_FORMAT.format( | 63 MD5SUM_DEVICE_SCRIPT_FORMAT.format( |
63 path=p, md5sum_lib=MD5SUM_DEVICE_LIB_PATH, | 64 path=p, md5sum_lib=MD5SUM_DEVICE_LIB_PATH, |
64 md5sum_bin=MD5SUM_DEVICE_BIN_PATH) | 65 md5sum_bin=MD5SUM_DEVICE_BIN_PATH) |
65 for p in paths) | 66 for p in paths) |
66 md5sum_script_file.write('; '.join(md5sum_script)) | 67 md5sum_script_file.write('; '.join(md5sum_script)) |
67 md5sum_script_file.flush() | 68 md5sum_script_file.flush() |
68 device.adb.Push(md5sum_script_file.name, md5sum_device_script_file.name) | 69 device.adb.Push(md5sum_script_file.name, md5sum_device_script_file.name) |
69 out = device.RunShellCommand(['sh', md5sum_device_script_file.name]) | 70 out = device.RunShellCommand(['sh', md5sum_device_script_file.name]) |
70 | 71 |
71 return [HashAndPath(*l.split(None, 1)) for l in out] | 72 return [HashAndPath(*l.split(None, 1)) for l in out] |
72 | 73 |
OLD | NEW |