Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Unified Diff: build/android/pylib/utils/md5sum.py

Issue 1106573002: [Android] Fix checksum handling when md5sum generates unexpected output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/utils/md5sum.py
diff --git a/build/android/pylib/utils/md5sum.py b/build/android/pylib/utils/md5sum.py
index da3cd15c785b0da5a2382816078d6817f63fc7aa..9dad097312f4570fd2a854f5bd1cdf1113a9d766 100644
--- a/build/android/pylib/utils/md5sum.py
+++ b/build/android/pylib/utils/md5sum.py
@@ -5,6 +5,7 @@
import collections
import logging
import os
+import re
import tempfile
import types
@@ -21,6 +22,8 @@ MD5SUM_DEVICE_SCRIPT_FORMAT = (
'test -f {path} -o -d {path} '
'&& LD_LIBRARY_PATH={md5sum_lib} {device_pie_wrapper} {md5sum_bin} {path}')
+_STARTS_WITH_CHECKSUM_RE = re.compile(r'^\s*[0-9a-fA-f]{32}\s+')
+
def CalculateHostMd5Sums(paths):
"""Calculates the MD5 sum value for all items in |paths|.
@@ -72,5 +75,7 @@ def CalculateDeviceMd5Sums(paths, device):
device.adb.Push(md5sum_script_file.name, md5sum_device_script_file.name)
out = device.RunShellCommand(['sh', md5sum_device_script_file.name])
- return [HashAndPath(*l.split(None, 1)) for l in out if l]
+ return [HashAndPath(*l.split(None, 1))
+ for l in out
+ if l and _STARTS_WITH_CHECKSUM_RE.match(l)]

Powered by Google App Engine
This is Rietveld 408576698