Chromium Code Reviews| Index: build/android/install_emulator_deps.py |
| diff --git a/build/android/install_emulator_deps.py b/build/android/install_emulator_deps.py |
| index e1dbe051797a9c8a6052b4e32b6a643893830152..58b4fecb2bb2b90519d4e27d095b9162770651da 100755 |
| --- a/build/android/install_emulator_deps.py |
| +++ b/build/android/install_emulator_deps.py |
| @@ -19,6 +19,9 @@ from pylib import cmd_helper |
| from pylib import constants |
| from pylib.utils import run_tests_helper |
| +# Android ARMv7 system image for the SDK. |
| +ARMV7_IMG_URL = 'https://dl-ssl.google.com/android/repository/sysimg_armv7a-18_r01.zip' |
| + |
| # Android x86 system image from the Intel website: |
| # http://software.intel.com/en-us/articles/intel-eula-x86-android-4-2-jelly-bean-bin |
| X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-18_r01.zip' |
| @@ -37,6 +40,18 @@ def CheckSDK(): |
| 'android_tools')) |
| +def CheckARMv7Image(): |
| + """Check if the ARMv7 system images have been installed. |
| + |
| + Returns: |
| + True if the armeabi-v7a directory is present inside the Android SDK |
| + checkout directory. |
| + """ |
| + return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, |
| + 'android_tools', 'sdk', 'system-images', |
| + API_TARGET, 'armeabi-v7a')) |
| + |
| + |
| def CheckX86Image(): |
| """Check if Android system images have been installed. |
| @@ -81,6 +96,22 @@ def InstallKVM(): |
| 'AMD SVM).') |
| +def GetARMv7Image(): |
| + """Download and install the ARMv7 system image.""" |
| + logging.info('Download ARMv7 system image directory into sdk directory.') |
| + try: |
| + cmd_helper.RunCmd(['curl', '-o', '/tmp/armv7_img.zip', ARMV7_IMG_URL]) |
| + rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/armv7_img.zip', '-d', '/tmp/']) |
| + if rc: |
| + logging.critical('ERROR: Could not download/unzip image zip.') |
| + raise |
|
Paweł Hajdan Jr.
2013/09/12 17:44:43
This is suspect. You're not catching any exception
|
| + sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', |
| + 'system-images', API_TARGET, 'armeabi-v7a') |
| + shutil.move('/tmp/armeabi-v7a', sys_imgs) |
| + finally: |
| + os.unlink('/tmp/armv7_img.zip') |
| + |
| + |
| def GetX86Image(): |
| """Download x86 system image from Intel's website.""" |
| logging.info('Download x86 system image directory into sdk directory.') |
| @@ -110,11 +141,14 @@ def main(argv): |
| 'more information.') |
| return 1 |
| - logging.info('Emulator deps for ARM emulator complete.') |
| - |
| # Download system images only if needed. |
| + if CheckARMv7Image(): |
| + logging.info('The ARMv7 image is already present.') |
| + else: |
| + GetARMv7Image() |
| + |
| if CheckX86Image(): |
| - logging.info('system-images directory already exists.') |
| + logging.info('The x86 image is already present.') |
| else: |
| GetX86Image() |