Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index bda1b69615e7773f8f379546357752d1fde03402..e677ba401914d2697facb597e0aa7c851bcd1e92 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -672,7 +672,18 @@ class AndroidCommands(object): |
""" |
self.RunShellCommand('input keyevent %d' % keycode) |
- def CheckMd5Sum(self, local_path, device_path): |
+ def CheckMd5Sum(self, local_path, device_path, ignore_paths=False): |
+ """Compares the md5sum of a local path against a device path. |
+ |
+ Args: |
+ local_path: Path (file or directory) on the host. |
+ device_path: Path on the device. |
+ ignore_paths: If False, both the md5sum and the relative paths/names of |
+ files must match. If True, only the md5sum must match. |
+ |
+ Returns: |
+ True if the md5sums match. |
+ """ |
assert os.path.exists(local_path), 'Local path not found %s' % local_path |
if not self._md5sum_build_dir: |
@@ -697,6 +708,10 @@ class AndroidCommands(object): |
['%s/md5sum_bin_host' % self._md5sum_build_dir, local_path]) |
hashes_on_host = _ComputeFileListHash(md5sum_output.splitlines()) |
+ if ignore_paths: |
+ hashes_on_device = [h.split()[0] for h in hashes_on_device] |
+ hashes_on_host = [h.split()[0] for h in hashes_on_host] |
+ |
return hashes_on_device == hashes_on_host |
def PushIfNeeded(self, local_path, device_path): |