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

Side by Side Diff: trunk/src/build/android/pylib/android_commands.py

Issue 23926012: Revert 221736 "[android] Adds constants.GetOutDirectory() and co..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if device: 240 if device:
241 self._adb.SetTargetSerial(device) 241 self._adb.SetTargetSerial(device)
242 self._device = device 242 self._device = device
243 self._logcat = None 243 self._logcat = None
244 self.logcat_process = None 244 self.logcat_process = None
245 self._logcat_tmpoutfile = None 245 self._logcat_tmpoutfile = None
246 self._pushed_files = [] 246 self._pushed_files = []
247 self._device_utc_offset = None 247 self._device_utc_offset = None
248 self._potential_push_size = 0 248 self._potential_push_size = 0
249 self._actual_push_size = 0 249 self._actual_push_size = 0
250 self._md5sum_build_dir = ''
250 self._external_storage = '' 251 self._external_storage = ''
251 self._util_wrapper = '' 252 self._util_wrapper = ''
252 253
253 def _LogShell(self, cmd): 254 def _LogShell(self, cmd):
254 """Logs the adb shell command.""" 255 """Logs the adb shell command."""
255 if self._device: 256 if self._device:
256 device_repr = self._device[-4:] 257 device_repr = self._device[-4:]
257 else: 258 else:
258 device_repr = '????' 259 device_repr = '????'
259 logging.info('[%s]> %s', device_repr, cmd) 260 logging.info('[%s]> %s', device_repr, cmd)
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 """Gets the md5sum of a host path and device path. 776 """Gets the md5sum of a host path and device path.
776 777
777 Args: 778 Args:
778 host_path: Path (file or directory) on the host. 779 host_path: Path (file or directory) on the host.
779 device_path: Path on the device. 780 device_path: Path on the device.
780 781
781 Returns: 782 Returns:
782 A tuple containing lists of the host and device md5sum results as 783 A tuple containing lists of the host and device md5sum results as
783 created by _ParseMd5SumOutput(). 784 created by _ParseMd5SumOutput().
784 """ 785 """
785 md5sum_dist_path = os.path.join(constants.GetOutDirectory(), 786 if not self._md5sum_build_dir:
786 'md5sum_dist') 787 default_build_type = os.environ.get('BUILD_TYPE', 'Debug')
787 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.' 788 build_dir = '%s/%s/' % (
788 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER) 789 cmd_helper.OutDirectory().get(), default_build_type)
789 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) 790 md5sum_dist_path = '%s/md5sum_dist' % build_dir
791 if not os.path.exists(md5sum_dist_path):
792 build_dir = '%s/Release/' % cmd_helper.OutDirectory().get()
793 md5sum_dist_path = '%s/md5sum_dist' % build_dir
794 assert os.path.exists(md5sum_dist_path), 'Please build md5sum.'
795 command = 'push %s %s' % (md5sum_dist_path, MD5SUM_DEVICE_FOLDER)
796 assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
797 self._md5sum_build_dir = build_dir
790 798
791 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' + 799 cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' +
792 MD5SUM_DEVICE_PATH + ' ' + device_path) 800 MD5SUM_DEVICE_PATH + ' ' + device_path)
793 device_hash_tuples = _ParseMd5SumOutput( 801 device_hash_tuples = _ParseMd5SumOutput(
794 self.RunShellCommand(cmd, timeout_time=2 * 60)) 802 self.RunShellCommand(cmd, timeout_time=2 * 60))
795 assert os.path.exists(host_path), 'Local path not found %s' % host_path 803 assert os.path.exists(host_path), 'Local path not found %s' % host_path
796 md5sum_output = cmd_helper.GetCmdOutput( 804 md5sum_output = cmd_helper.GetCmdOutput(
797 [os.path.join(constants.GetOutDirectory(), 'md5sum_bin_host'), 805 ['%s/md5sum_bin_host' % self._md5sum_build_dir, host_path])
798 host_path])
799 host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines()) 806 host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines())
800 return (host_hash_tuples, device_hash_tuples) 807 return (host_hash_tuples, device_hash_tuples)
801 808
802 def GetFilesChanged(self, host_path, device_path, ignore_filenames=False): 809 def GetFilesChanged(self, host_path, device_path, ignore_filenames=False):
803 """Compares the md5sum of a host path against a device path. 810 """Compares the md5sum of a host path against a device path.
804 811
805 Note: Ignores extra files on the device. 812 Note: Ignores extra files on the device.
806 813
807 Args: 814 Args:
808 host_path: Path (file or directory) on the host. 815 host_path: Path (file or directory) on the host.
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 """ 1552 """
1546 def __init__(self, output): 1553 def __init__(self, output):
1547 self._output = output 1554 self._output = output
1548 1555
1549 def write(self, data): 1556 def write(self, data):
1550 data = data.replace('\r\r\n', '\n') 1557 data = data.replace('\r\r\n', '\n')
1551 self._output.write(data) 1558 self._output.write(data)
1552 1559
1553 def flush(self): 1560 def flush(self):
1554 self._output.flush() 1561 self._output.flush()
OLDNEW
« no previous file with comments | « trunk/src/build/android/adb_reverse_forwarder.py ('k') | trunk/src/build/android/pylib/base/base_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698