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

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

Issue 197883005: [Telementry][Android] Only copy changed or missing files of profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add shebang to satisfy presubmit checks Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/efficient_android_directory_copy.sh » ('j') | 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 c5fa3d436df7ce30de661d2eb350fdd10ae6956c..4cf996f134a724e9ad7a17825cf69b57eb6804bd 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -1800,6 +1800,37 @@ class AndroidCommands(object):
logging.error('Still showing a %s dialog for %s' % match.groups())
return package
+ def EfficientDeviceDirectoryCopy(self, source, dest):
+ """ Copy a directory efficiently on the device
+
+ Uses a shell script running on the target to copy new and changed files the
+ source directory to the destination directory and remove added files. This
+ is in some cases much faster than cp -r.
+
+ Args:
+ source: absolute path of source directory
+ dest: absolute path of destination directory
+ """
+ logging.info('In EfficientDeviceDirectoryCopy %s %s', source, dest)
+ temp_script_file = self._GetDeviceTempFileName(
+ AndroidCommands._TEMP_SCRIPT_FILE_BASE_FMT)
+ host_script_path = os.path.join(constants.DIR_SOURCE_ROOT,
+ 'build',
+ 'android',
+ 'pylib',
+ 'efficient_android_directory_copy.sh')
+ self._adb.Push(host_script_path, temp_script_file)
+ self.EnableAdbRoot
+ out = self.RunShellCommand('sh %s %s %s' % (temp_script_file, source, dest),
+ timeout_time=120)
+ if self._device:
+ device_repr = self._device[-4:]
+ else:
+ device_repr = '????'
+ for line in out:
+ logging.info('[%s]> %s', device_repr, line)
+ self.RunShellCommand('rm %s' % temp_script_file)
+
class NewLineNormalizer(object):
"""A file-like object to normalize EOLs to '\n'.
« no previous file with comments | « no previous file | build/android/pylib/efficient_android_directory_copy.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698