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

Side by Side Diff: build/android/provision_devices.py

Issue 380073003: Fix provision_devices on the L-release preview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: partial revert Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provisions Android devices with settings required for bots. 7 """Provisions Android devices with settings required for bots.
8 8
9 Usage: 9 Usage:
10 ./provision_devices.py [-d <device serial number>] 10 ./provision_devices.py [-d <device serial number>]
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 """ 119 """
120 device_authorized = device.FileExists(constants.ADB_KEYS_FILE) 120 device_authorized = device.FileExists(constants.ADB_KEYS_FILE)
121 if device_authorized: 121 if device_authorized:
122 adb_keys = device.RunShellCommand('cat %s' % constants.ADB_KEYS_FILE, 122 adb_keys = device.RunShellCommand('cat %s' % constants.ADB_KEYS_FILE,
123 as_root=True) 123 as_root=True)
124 device.RunShellCommand('wipe data', as_root=True) 124 device.RunShellCommand('wipe data', as_root=True)
125 if device_authorized: 125 if device_authorized:
126 path_list = constants.ADB_KEYS_FILE.split('/') 126 path_list = constants.ADB_KEYS_FILE.split('/')
127 dir_path = '/'.join(path_list[:len(path_list)-1]) 127 dir_path = '/'.join(path_list[:len(path_list)-1])
128 device.RunShellCommand('mkdir -p %s' % dir_path, as_root=True) 128 device.RunShellCommand('mkdir -p %s' % dir_path, as_root=True)
129 device.RunShellCommand('restorecon %s' % dir_path, as_root=True)
129 device.RunShellCommand('echo %s > %s' % 130 device.RunShellCommand('echo %s > %s' %
130 (adb_keys[0], constants.ADB_KEYS_FILE)) 131 (adb_keys[0], constants.ADB_KEYS_FILE), as_root=True)
131 for adb_key in adb_keys[1:]: 132 for adb_key in adb_keys[1:]:
132 device.RunShellCommand( 133 device.RunShellCommand(
133 'echo %s >> %s' % (adb_key, constants.ADB_KEYS_FILE)) 134 'echo %s >> %s' % (adb_key, constants.ADB_KEYS_FILE), as_root=True)
135 device.RunShellCommand('restorecon %s' % constants.ADB_KEYS_FILE,
136 as_root=True)
134 137
135 138
136 def ProvisionDevices(options): 139 def ProvisionDevices(options):
137 is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower() 140 is_perf = 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower()
138 # TODO(jbudorick): Parallelize provisioning of all attached devices after 141 # TODO(jbudorick): Parallelize provisioning of all attached devices after
139 # switching from AndroidCommands. 142 # switching from AndroidCommands.
140 if options.device is not None: 143 if options.device is not None:
141 devices = [options.device] 144 devices = [options.device]
142 else: 145 else:
143 devices = android_commands.GetAttachedDevices() 146 devices = android_commands.GetAttachedDevices()
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 230
228 if args: 231 if args:
229 print >> sys.stderr, 'Unused args %s' % args 232 print >> sys.stderr, 'Unused args %s' % args
230 return 1 233 return 1
231 234
232 ProvisionDevices(options) 235 ProvisionDevices(options)
233 236
234 237
235 if __name__ == '__main__': 238 if __name__ == '__main__':
236 sys.exit(main(sys.argv)) 239 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698