android: Download ARMv7 image for the emulator.
Follow-up to r222121: GetSDK() used to download an additional copy of the Android SDK that came with an ARM image. The copy we currently use in third_party/android_tools/sdk does not come with the ARM image. Restore the lost functionality while still avoiding downloading the complete SDK by grabbing only the ARM images from a Google URL. R=mariakhomenko@chromium.org,peter@chromium.org,bulach@chromium.org Review URL: https://chromiumcodereview.appspot.com/23708033 git-svn-id: http://src.chromium.org/svn/trunk/src/build@223003 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
e55911635e
Коммит
27fe85bb14
|
@ -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,21 @@ 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:
|
||||
raise Exception('ERROR: Could not download/unzip image zip.')
|
||||
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.')
|
||||
|
@ -88,8 +118,7 @@ def GetX86Image():
|
|||
cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL])
|
||||
rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/'])
|
||||
if rc:
|
||||
logging.critical('ERROR: Could not download/unzip image zip.')
|
||||
raise
|
||||
raise Exception('ERROR: Could not download/unzip image zip.')
|
||||
sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk',
|
||||
'system-images', API_TARGET, 'x86')
|
||||
shutil.move('/tmp/x86', sys_imgs)
|
||||
|
@ -110,11 +139,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()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче