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 collections | 5 import collections |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import tempfile | 9 import tempfile |
| 10 import types | 10 import types |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 md5sum_dist_path = os.path.join(constants.GetOutDirectory(), 'md5sum_dist') | 58 md5sum_dist_path = os.path.join(constants.GetOutDirectory(), 'md5sum_dist') |
| 59 if not os.path.exists(md5sum_dist_path): | 59 if not os.path.exists(md5sum_dist_path): |
| 60 raise IOError('File not built: %s' % md5sum_dist_path) | 60 raise IOError('File not built: %s' % md5sum_dist_path) |
| 61 device.adb.Push(md5sum_dist_path, MD5SUM_DEVICE_LIB_PATH) | 61 device.adb.Push(md5sum_dist_path, MD5SUM_DEVICE_LIB_PATH) |
| 62 | 62 |
| 63 out = [] | 63 out = [] |
| 64 | 64 |
| 65 with tempfile.NamedTemporaryFile() as md5sum_script_file: | 65 with tempfile.NamedTemporaryFile() as md5sum_script_file: |
| 66 with device_temp_file.DeviceTempFile( | 66 with device_temp_file.DeviceTempFile( |
| 67 device.adb) as md5sum_device_script_file: | 67 device.adb) as md5sum_device_script_file: |
| 68 device_pie_wrapper = device.GetDevicePieWrapper() | |
| 69 md5sum_script = ( | 68 md5sum_script = ( |
|
aurimas (slooooooooow)
2015/05/11 18:36:33
do we need to modify md5sum executable to accept o
jbudorick
2015/05/11 18:40:20
No, the wrapper isn't an argument to md5sum. Remov
| |
| 70 MD5SUM_DEVICE_SCRIPT_FORMAT.format( | 69 MD5SUM_DEVICE_SCRIPT_FORMAT.format( |
| 71 path=p, md5sum_lib=MD5SUM_DEVICE_LIB_PATH, | 70 path=p, md5sum_lib=MD5SUM_DEVICE_LIB_PATH, |
| 72 device_pie_wrapper=device_pie_wrapper, | 71 device_pie_wrapper='', |
|
aurimas (slooooooooow)
2015/05/11 17:45:23
Can I remove this completely?
jbudorick
2015/05/11 17:49:41
Yep.
| |
| 73 md5sum_bin=MD5SUM_DEVICE_BIN_PATH) | 72 md5sum_bin=MD5SUM_DEVICE_BIN_PATH) |
| 74 for p in paths) | 73 for p in paths) |
| 75 md5sum_script_file.write('; '.join(md5sum_script)) | 74 md5sum_script_file.write('; '.join(md5sum_script)) |
| 76 md5sum_script_file.flush() | 75 md5sum_script_file.flush() |
| 77 device.adb.Push(md5sum_script_file.name, md5sum_device_script_file.name) | 76 device.adb.Push(md5sum_script_file.name, md5sum_device_script_file.name) |
| 78 out = device.RunShellCommand(['sh', md5sum_device_script_file.name]) | 77 out = device.RunShellCommand(['sh', md5sum_device_script_file.name]) |
| 79 | 78 |
| 80 return _ParseMd5SumOutput(out) | 79 return _ParseMd5SumOutput(out) |
| 81 | 80 |
| 82 | 81 |
| 83 def _ParseMd5SumOutput(out): | 82 def _ParseMd5SumOutput(out): |
| 84 hash_and_path = (l.split(None, 1) for l in out | 83 hash_and_path = (l.split(None, 1) for l in out |
| 85 if l and _STARTS_WITH_CHECKSUM_RE.match(l)) | 84 if l and _STARTS_WITH_CHECKSUM_RE.match(l)) |
| 86 return dict((p, h) for h, p in hash_and_path) | 85 return dict((p, h) for h, p in hash_and_path) |
| 87 | 86 |
| OLD | NEW |