Index: build/android/pylib/device/device_utils.py |
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py |
index 976399cfa35fa1222f4243b0076870b5ffc4585a..292c60533617888108ed379496824fb8c0eadfbb 100644 |
--- a/build/android/pylib/device/device_utils.py |
+++ b/build/android/pylib/device/device_utils.py |
@@ -1039,12 +1039,21 @@ class DeviceUtils(object): |
3rd element: a list of stale files under device_path, or [] when |
track_stale == False |
""" |
+ real_host_path = os.path.realpath(host_path) |
try: |
- host_checksums = md5sum.CalculateHostMd5Sums([host_path]) |
- interesting_device_paths = [device_path] |
- if not track_stale and os.path.isdir(host_path): |
+ real_device_path = self.RunShellCommand( |
+ ['realpath', device_path], single_line=True, check_return=True) |
+ except device_errors.CommandFailedError: |
+ real_device_path = None |
+ if not real_device_path: |
+ return ([(host_path, device_path)], [], []) |
+ |
+ try: |
+ host_checksums = md5sum.CalculateHostMd5Sums([real_host_path]) |
+ interesting_device_paths = [real_device_path] |
+ if not track_stale and os.path.isdir(real_host_path): |
interesting_device_paths = [ |
- posixpath.join(device_path, os.path.relpath(p, host_path)) |
+ posixpath.join(real_device_path, os.path.relpath(p, real_host_path)) |
for p in host_checksums.keys()] |
device_checksums = md5sum.CalculateDeviceMd5Sums( |
interesting_device_paths, self) |
@@ -1056,8 +1065,8 @@ class DeviceUtils(object): |
up_to_date = [] |
to_delete = [] |
if os.path.isfile(host_path): |
- host_checksum = host_checksums.get(host_path) |
- device_checksum = device_checksums.get(device_path) |
+ host_checksum = host_checksums.get(real_host_path) |
+ device_checksum = device_checksums.get(real_device_path) |
if host_checksum == device_checksum: |
up_to_date.append(host_path) |
else: |
@@ -1065,7 +1074,7 @@ class DeviceUtils(object): |
else: |
for host_abs_path, host_checksum in host_checksums.iteritems(): |
device_abs_path = posixpath.join( |
- device_path, os.path.relpath(host_abs_path, host_path)) |
+ real_device_path, os.path.relpath(host_abs_path, real_host_path)) |
device_checksum = device_checksums.pop(device_abs_path, None) |
if device_checksum == host_checksum: |
up_to_date.append(host_abs_path) |