Commit 38e90e21 authored by craigdh@chromium.org's avatar craigdh@chromium.org

[android] Explicitly specify whether to ignore file paths when pushing files.

When pushing data files avoids matching files whose relative paths do not match a file being pushed from the host.

BUG=284906
TEST=None
NOTRY=True

Review URL: https://chromiumcodereview.appspot.com/23513019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221477 0039d316-1c4b-4281-b951-d872f2087c98
parent 53ed958b
...@@ -425,7 +425,8 @@ class AndroidCommands(object): ...@@ -425,7 +425,8 @@ class AndroidCommands(object):
if package_name: if package_name:
installed_apk_path = self.GetApplicationPath(package_name) installed_apk_path = self.GetApplicationPath(package_name)
if (installed_apk_path and if (installed_apk_path and
not self.GetFilesChanged(apk_path, installed_apk_path)): not self.GetFilesChanged(apk_path, installed_apk_path,
ignore_filenames=True)):
logging.info('Skipped install: identical %s APK already installed' % logging.info('Skipped install: identical %s APK already installed' %
package_name) package_name)
return return
...@@ -805,7 +806,7 @@ class AndroidCommands(object): ...@@ -805,7 +806,7 @@ class AndroidCommands(object):
host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines()) host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines())
return (host_hash_tuples, device_hash_tuples) return (host_hash_tuples, device_hash_tuples)
def GetFilesChanged(self, host_path, device_path): def GetFilesChanged(self, host_path, device_path, ignore_filenames=False):
"""Compares the md5sum of a host path against a device path. """Compares the md5sum of a host path against a device path.
Note: Ignores extra files on the device. Note: Ignores extra files on the device.
...@@ -813,6 +814,9 @@ class AndroidCommands(object): ...@@ -813,6 +814,9 @@ class AndroidCommands(object):
Args: Args:
host_path: Path (file or directory) on the host. host_path: Path (file or directory) on the host.
device_path: Path on the device. device_path: Path on the device.
ignore_filenames: If True only the file contents are considered when
checking whether a file has changed, otherwise the relative path
must also match.
Returns: Returns:
A list of tuples of the form (host_path, device_path) for files whose A list of tuples of the form (host_path, device_path) for files whose
...@@ -822,7 +826,7 @@ class AndroidCommands(object): ...@@ -822,7 +826,7 @@ class AndroidCommands(object):
host_path, device_path) host_path, device_path)
# Ignore extra files on the device. # Ignore extra files on the device.
if len(device_hash_tuples) > len(host_hash_tuples): if not ignore_filenames:
host_files = [os.path.relpath(os.path.normpath(p.path), host_files = [os.path.relpath(os.path.normpath(p.path),
os.path.normpath(host_path)) for p in host_hash_tuples] os.path.normpath(host_path)) for p in host_hash_tuples]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment