OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
6 | 6 |
7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
8 """ | 8 """ |
9 | 9 |
10 import collections | 10 import collections |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 assert os.path.exists(host_path), 'Local path not found %s' % host_path | 855 assert os.path.exists(host_path), 'Local path not found %s' % host_path |
856 | 856 |
857 def GetHostSize(path): | 857 def GetHostSize(path): |
858 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) | 858 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) |
859 | 859 |
860 size = GetHostSize(host_path) | 860 size = GetHostSize(host_path) |
861 self._pushed_files.append(device_path) | 861 self._pushed_files.append(device_path) |
862 self._potential_push_size += size | 862 self._potential_push_size += size |
863 | 863 |
864 changed_files = self.GetFilesChanged(host_path, device_path) | 864 changed_files = self.GetFilesChanged(host_path, device_path) |
| 865 logging.info('Found %d files that need to be pushed to %s', |
| 866 len(changed_files), device_path) |
865 if not changed_files: | 867 if not changed_files: |
866 return | 868 return |
867 | 869 |
868 def Push(host, device): | 870 def Push(host, device): |
869 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout | 871 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout |
870 # of 60 seconds which isn't sufficient for a lot of users of this method. | 872 # of 60 seconds which isn't sufficient for a lot of users of this method. |
871 push_command = 'push %s %s' % (host, device) | 873 push_command = 'push %s %s' % (host, device) |
872 self._LogShell(push_command) | 874 self._LogShell(push_command) |
873 | 875 |
874 # Retry push with increasing backoff if the device is busy. | 876 # Retry push with increasing backoff if the device is busy. |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 """ | 1548 """ |
1547 def __init__(self, output): | 1549 def __init__(self, output): |
1548 self._output = output | 1550 self._output = output |
1549 | 1551 |
1550 def write(self, data): | 1552 def write(self, data): |
1551 data = data.replace('\r\r\n', '\n') | 1553 data = data.replace('\r\r\n', '\n') |
1552 self._output.write(data) | 1554 self._output.write(data) |
1553 | 1555 |
1554 def flush(self): | 1556 def flush(self): |
1555 self._output.flush() | 1557 self._output.flush() |
OLD | NEW |