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

Unified Diff: build/android/pylib/android_commands.py

Issue 57633003: Make PushIfNeeded do what is says. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 1741619276ce56042a9a3df6f3b004fed1ebe3ad..f33534ba725065e67bef27af599c689c5f914b36 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -841,13 +841,21 @@ class AndroidCommands(object):
A list of tuples of the form (host_path, device_path) for files whose
md5sums do not match.
"""
+
+ # Md5Sum resolves symbolic links in path names so the calculation of
+ # relative path names from its output will need the real path names of the
+ # base directories. Having calculated these they are used throughout the
+ # function since this makes us less subject to any future changes to Md5Sum.
+ real_host_path = os.path.realpath(host_path)
+ real_device_path = self.RunShellCommand('realpath "%s"' % device_path)[0]
+
host_hash_tuples, device_hash_tuples = self._RunMd5Sum(
- host_path, device_path)
+ real_host_path, real_device_path)
# Ignore extra files on the device.
if not ignore_filenames:
host_files = [os.path.relpath(os.path.normpath(p.path),
- os.path.normpath(host_path)) for p in host_hash_tuples]
+ real_host_path) for p in host_hash_tuples]
def HostHas(fname):
return any(path in fname for path in host_files)
@@ -862,12 +870,12 @@ class AndroidCommands(object):
# only a single file is given as the base name given in device_path may
# differ from that in host_path.
def HostToDevicePath(host_file_path):
- return os.path.join(device_path, os.path.relpath(
- host_file_path, os.path.normpath(host_path)))
+ return os.path.join(device_path, os.path.relpath(host_file_path,
+ real_host_path))
device_hashes = [h.hash for h in device_hash_tuples]
- return [(t.path, HostToDevicePath(t.path) if os.path.isdir(host_path) else
- device_path)
+ return [(t.path, HostToDevicePath(t.path) if
+ os.path.isdir(real_host_path) else real_device_path)
for t in host_hash_tuples if t.hash not in device_hashes]
def PushIfNeeded(self, host_path, device_path):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698