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

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

Issue 23513022: android: Point EMULATOR_SDK_ROOT to a location inside the repository. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Same patch, rebased on top of r223028 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
« no previous file with comments | « build/android/avd.py ('k') | build/android/pylib/constants.py » ('j') | 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 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Installs deps for using SDK emulator for testing. 6 """Installs deps for using SDK emulator for testing.
7 7
8 The script will download system images, if they are not present, and 8 The script will download system images, if they are not present, and
9 install and enable KVM, if virtualization has been enabled in the BIOS. 9 install and enable KVM, if virtualization has been enabled in the BIOS.
10 """ 10 """
(...skipping 16 matching lines...) Expand all
27 X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysi mg_x86-18_r01.zip' 27 X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysi mg_x86-18_r01.zip'
28 28
29 # Android API level 29 # Android API level
30 API_TARGET = 'android-%s' % constants.ANDROID_SDK_VERSION 30 API_TARGET = 'android-%s' % constants.ANDROID_SDK_VERSION
31 31
32 32
33 def CheckSDK(): 33 def CheckSDK():
34 """Check if SDK is already installed. 34 """Check if SDK is already installed.
35 35
36 Returns: 36 Returns:
37 True if android_tools directory exists in current directory. 37 True if the third_party/android_tools/sdk directory exists.
38 """ 38 """
39 return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, 39 return os.path.exists(constants.ANDROID_SDK_ROOT)
40 'android_tools'))
41 40
42 41
43 def CheckARMv7Image(): 42 def CheckARMv7Image():
44 """Check if the ARMv7 system images have been installed. 43 """Check if the ARMv7 system images have been installed.
45 44
46 Returns: 45 Returns:
47 True if the armeabi-v7a directory is present inside the Android SDK 46 True if the armeabi-v7a directory is present inside the Android SDK
48 checkout directory. 47 checkout directory.
49 """ 48 """
50 return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, 49 return os.path.exists(os.path.join(constants.ANDROID_SDK_ROOT,
51 'android_tools', 'sdk', 'system-images', 50 'system-images',
52 API_TARGET, 'armeabi-v7a')) 51 API_TARGET,
52 'armeabi-v7a'))
53 53
54 54
55 def CheckX86Image(): 55 def CheckX86Image():
56 """Check if Android system images have been installed. 56 """Check if Android system images have been installed.
57 57
58 Returns: 58 Returns:
59 True if android_tools/sdk/system-images directory exists. 59 True if the X86 system images exist in
60 android_tools/sdk/system-images/<API TARGET>/x86.
60 """ 61 """
61 return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, 62 return os.path.exists(os.path.join(constants.ANDROID_SDK_ROOT,
62 'android_tools', 'sdk', 'system-images', 63 'system-images', API_TARGET, 'x86'))
63 API_TARGET, 'x86'))
64 64
65 65
66 def CheckKVM(): 66 def CheckKVM():
67 """Check if KVM is enabled. 67 """Check if KVM is enabled.
68 68
69 Returns: 69 Returns:
70 True if kvm-ok returns 0 (already enabled) 70 True if kvm-ok returns 0 (already enabled)
71 """ 71 """
72 try: 72 try:
73 return not cmd_helper.RunCmd(['kvm-ok']) 73 return not cmd_helper.RunCmd(['kvm-ok'])
(...skipping 23 matching lines...) Expand all
97 97
98 98
99 def GetARMv7Image(): 99 def GetARMv7Image():
100 """Download and install the ARMv7 system image.""" 100 """Download and install the ARMv7 system image."""
101 logging.info('Download ARMv7 system image directory into sdk directory.') 101 logging.info('Download ARMv7 system image directory into sdk directory.')
102 try: 102 try:
103 cmd_helper.RunCmd(['curl', '-o', '/tmp/armv7_img.zip', ARMV7_IMG_URL]) 103 cmd_helper.RunCmd(['curl', '-o', '/tmp/armv7_img.zip', ARMV7_IMG_URL])
104 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/armv7_img.zip', '-d', '/tmp/']) 104 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/armv7_img.zip', '-d', '/tmp/'])
105 if rc: 105 if rc:
106 raise Exception('ERROR: Could not download/unzip image zip.') 106 raise Exception('ERROR: Could not download/unzip image zip.')
107 sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', 107 sys_imgs = os.path.join(constants.ANDROID_SDK_ROOT, 'system-images',
108 'system-images', API_TARGET, 'armeabi-v7a') 108 API_TARGET, 'armeabi-v7a')
109 shutil.move('/tmp/armeabi-v7a', sys_imgs) 109 shutil.move('/tmp/armeabi-v7a', sys_imgs)
110 finally: 110 finally:
111 os.unlink('/tmp/armv7_img.zip') 111 os.unlink('/tmp/armv7_img.zip')
112 112
113 113
114 def GetX86Image(): 114 def GetX86Image():
115 """Download x86 system image from Intel's website.""" 115 """Download x86 system image from Intel's website."""
116 logging.info('Download x86 system image directory into sdk directory.') 116 logging.info('Download x86 system image directory into sdk directory.')
117 try: 117 try:
118 cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL]) 118 cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL])
119 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/']) 119 rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/'])
120 if rc: 120 if rc:
121 raise Exception('ERROR: Could not download/unzip image zip.') 121 raise Exception('ERROR: Could not download/unzip image zip.')
122 sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', 122 sys_imgs = os.path.join(constants.ANDROID_SDK_ROOT, 'system-images',
123 'system-images', API_TARGET, 'x86') 123 API_TARGET, 'x86')
124 shutil.move('/tmp/x86', sys_imgs) 124 shutil.move('/tmp/x86', sys_imgs)
125 finally: 125 finally:
126 os.unlink('/tmp/x86_img.zip') 126 os.unlink('/tmp/x86_img.zip')
127 127
128 128
129 def main(argv): 129 def main(argv):
130 logging.basicConfig(level=logging.INFO, 130 logging.basicConfig(level=logging.INFO,
131 format='# %(asctime)-15s: %(message)s') 131 format='# %(asctime)-15s: %(message)s')
132 run_tests_helper.SetLogLevel(verbose_count=1) 132 run_tests_helper.SetLogLevel(verbose_count=1)
133 133
(...skipping 18 matching lines...) Expand all
152 152
153 # Make sure KVM packages are installed and enabled. 153 # Make sure KVM packages are installed and enabled.
154 if CheckKVM(): 154 if CheckKVM():
155 logging.info('KVM already installed and enabled.') 155 logging.info('KVM already installed and enabled.')
156 else: 156 else:
157 InstallKVM() 157 InstallKVM()
158 158
159 159
160 if __name__ == '__main__': 160 if __name__ == '__main__':
161 sys.exit(main(sys.argv)) 161 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/avd.py ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698