Chromium Code Reviews| Index: build/android/pylib/android_commands.py |
| diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
| index f260639352cb073fa6674acbf979f0a307361f44..03e3dbd32f1e172f846aec16e41610ef880321a8 100644 |
| --- a/build/android/pylib/android_commands.py |
| +++ b/build/android/pylib/android_commands.py |
| @@ -219,6 +219,8 @@ class AndroidCommands(object): |
| self.logcat_process = None |
| self._logcat_tmpoutfile = None |
| self._pushed_files = [] |
| + self._potential_push_size = 0 |
| + self._actual_push_size = 0 |
| self._device_utc_offset = self.RunShellCommand('date +%z')[0] |
| self._md5sum_build_dir = '' |
| self._external_storage = '' |
| @@ -708,8 +710,6 @@ class AndroidCommands(object): |
| 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: |
| default_build_type = os.environ.get('BUILD_TYPE', 'Debug') |
| build_dir = '%s/%s/' % ( |
| @@ -723,7 +723,6 @@ class AndroidCommands(object): |
| assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) |
| self._md5sum_build_dir = build_dir |
| - self._pushed_files.append(device_path) |
| hashes_on_device = _ComputeFileListHash( |
| self.RunShellCommand(MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + |
| ' ' + MD5SUM_DEVICE_PATH + ' ' + device_path)) |
| @@ -746,9 +745,15 @@ class AndroidCommands(object): |
| All pushed files can be removed by calling RemovePushedFiles(). |
| """ |
| + assert os.path.exists(local_path), 'Local path not found %s' % local_path |
| + size = int(cmd_helper.GetCmdOutput(['du', '-sm', local_path]).split()[0]) |
|
craigdh
2013/06/20 17:46:51
why megabytes? just keep track of the bytes and pr
frankf
2013/06/20 18:32:30
Done.
|
| + self._pushed_files.append(device_path) |
| + self._potential_push_size += size |
| + |
| if self.CheckMd5Sum(local_path, device_path): |
| return |
| + self._actual_push_size += size |
| # They don't match, so remove everything first and then create it. |
| if os.path.isdir(local_path): |
| self.RunShellCommand('rm -r %s' % device_path, timeout_time=2 * 60) |
| @@ -761,6 +766,15 @@ class AndroidCommands(object): |
| output = self._adb.SendCommand(push_command, timeout_time=30 * 60) |
| assert _HasAdbPushSucceeded(output) |
| + def GetPushSizeInfo(self): |
| + """Get total size of pushes to the device done via PushIfNeeded() |
| + |
| + Returns: |
| + A tuple: |
| + 1. Total size of push requests to PushIfNeeded (MB) |
| + 2. Total size that was actually pushed (MB) |
| + """ |
| + return (self._potential_push_size, self._actual_push_size) |
| def GetFileContents(self, filename, log_result=False): |
| """Gets contents from the file specified by |filename|.""" |