diff options
Diffstat (limited to 'catapult/common/bin/update_chrome_reference_binaries')
-rwxr-xr-x | catapult/common/bin/update_chrome_reference_binaries | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/catapult/common/bin/update_chrome_reference_binaries b/catapult/common/bin/update_chrome_reference_binaries index 02070f08..e148c747 100755 --- a/catapult/common/bin/update_chrome_reference_binaries +++ b/catapult/common/bin/update_chrome_reference_binaries @@ -18,6 +18,7 @@ import os import shutil import subprocess import sys +import tempfile import urllib2 import zipfile @@ -42,9 +43,10 @@ CHROME_GS_BUCKET = 'chrome-unsigned' # Add one to enable updating it. (Must also update _PLATFORM_MAP.) _PLATFORMS_TO_UPDATE = ['mac_x86_64', 'win_x86', 'win_AMD64', 'linux_x86_64', 'android_k_armeabi-v7a', 'android_l_arm64-v8a', - 'android_l_armeabi-v7a', 'android_n_armeabi-v7a'] + 'android_l_armeabi-v7a', 'android_n_armeabi-v7a', + 'android_n_arm64-v8a'] -# Remove a channal name from this list to disable updating it. +# Remove a channel name from this list to disable updating it. # Add one to enable updating it. _CHANNELS_TO_UPDATE = ['stable', 'canary', 'dev'] @@ -56,7 +58,7 @@ _OMAHA_PLATFORMS = { 'stable': ['mac', 'linux', 'win', 'android'], # All of the information we need to update each platform. -# omaha: name omaha uses for the plaftorms. +# omaha: name omaha uses for the platforms. # zip_name: name of the zip file to be retrieved from cloud storage. # gs_build: name of the Chrome build platform used in cloud storage. # destination: Name of the folder to download the reference build to. @@ -94,6 +96,10 @@ _PLATFORM_MAP = {'mac_x86_64': UpdateInfo(omaha='mac', gs_folder='android-*', gs_build='arm', zip_name='Monochrome.apk'), + 'android_n_arm64-v8a': UpdateInfo(omaha='android', + gs_folder='android-*', + gs_build='arm_64', + zip_name='Monochrome.apk'), } @@ -155,11 +161,49 @@ def _QueuePlatformUpdate(platform, version, config, channel): os.makedirs(reference_builds_folder) local_dest_path = os.path.join(reference_builds_folder, filename) cloud_storage.Get(CHROME_GS_BUCKET, remote_path, local_dest_path) + _ModifyBuildIfNeeded(local_dest_path, platform) config.AddCloudStorageDependencyUpdateJob( 'chrome_%s' % channel, platform, local_dest_path, version=version, execute_job=False) +def _ModifyBuildIfNeeded(location, platform): + """Hook to modify the build before saving it for Telemetry to use. + + This can be used to remove various utilities that cause noise in a + test environment. Right now, it is just used to remove Keystone, + which is a tool used to autoupdate Chrome. + """ + if platform == 'mac_x86_64': + _RemoveKeystoneFromBuild(location) + return + + if 'mac' in platform: + raise NotImplementedError( + 'Platform <%s> sounds like it is an OSX version. If so, we may need to ' + 'remove Keystone from it per crbug.com/932615. Please edit this script' + ' and teach it what needs to be done :).') + + +def _RemoveKeystoneFromBuild(location): + """Removes the Keystone autoupdate binary from the chrome mac zipfile.""" + logging.info('Removing keystone from mac build at %s' % location) + temp_folder = tempfile.mkdtemp(prefix='RemoveKeystoneFromBuild') + try: + subprocess.check_call(['unzip', '-q', location, '-d', temp_folder]) + keystone_folder = os.path.join( + temp_folder, 'chrome-mac', 'Google Chrome.app', 'Contents', + 'Frameworks', 'Google Chrome Framework.framework', 'Frameworks', + 'KeystoneRegistration.framework') + shutil.rmtree(keystone_folder) + os.remove(location) + subprocess.check_call(['zip', '--quiet', '--recurse-paths', '--symlinks', + location, 'chrome-mac'], + cwd=temp_folder) + finally: + shutil.rmtree(temp_folder) + + def UpdateBuilds(): config = base_config.BaseConfig(_CHROME_BINARIES_CONFIG, writable=True) for channel in _CHANNELS_TO_UPDATE: @@ -172,7 +216,6 @@ def UpdateBuilds(): if current_version and current_version == channel_version: continue _QueuePlatformUpdate(platform, channel_version, config, channel) - # TODO: move execute update jobs here, and add committing/uploading the cl. print 'Updating chrome builds with downloaded binaries' config.ExecuteUpdateJobs(force=True) @@ -180,10 +223,7 @@ def UpdateBuilds(): def main(): logging.getLogger().setLevel(logging.DEBUG) - #TODO(aiolos): alert sheriffs via email when an error is seen. - #This should be added when alerts are added when updating the build. UpdateBuilds() - # TODO(aiolos): Add --commit flag. crbug.com/547229 if __name__ == '__main__': main() |