def InitDependencyManager(environment_config): global _binary_manager if _binary_manager: raise exceptions.InitializationError( 'Trying to re-initialize the binary manager with config %s' % environment_config) configs = [base_config.BaseConfig(TELEMETRY_PROJECT_CONFIG), base_config.BaseConfig(CHROME_BINARY_CONFIG)] if environment_config: configs.insert(0, base_config.BaseConfig(environment_config)) _binary_manager = binary_manager.BinaryManager(configs) devil_env.config.Initialize()
def UpdateDependency(dependency, dep_local_path, version, os_name=None, arch_name=None): config = os.path.join( util.GetTelemetryDir(), 'telemetry', 'binary_dependencies.json') if not os_name: assert not arch_name, 'arch_name is specified but not os_name' os_name = py_utils.GetHostOsName() arch_name = py_utils.GetHostArchName() else: assert arch_name, 'os_name is specified but not arch_name' dep_platform = '%s_%s' % (os_name, arch_name) c = base_config.BaseConfig(config, writable=True) try: old_version = c.GetVersion(dependency, dep_platform) print 'Updating from version: {}'.format(old_version) except ValueError: raise RuntimeError( ('binary_dependencies.json entry for %s missing or invalid; please add ' 'it first! (need download_path and path_within_archive)') % dep_platform) if dep_local_path: c.AddCloudStorageDependencyUpdateJob( dependency, dep_platform, dep_local_path, version=version, execute_job=True)
def UploadBinary(arch, path, config, dep): print 'Uploading binary:' print ' arch: %s' % arch print ' path: %s' % path print ' config: %s' % config print ' dep: %s' % dep c = base_config.BaseConfig(config, writable=True) c.AddCloudStorageDependencyUpdateJob( dep, arch, path, version=None, execute_job=True) print 'Upload complete.'
def UpdateBuilds(args): config = base_config.BaseConfig(_CHROME_BINARIES_CONFIG, writable=True) for channel in _CHANNELS_TO_UPDATE: channel_versions_map = _ChannelVersionsMap(channel) for platform in channel_versions_map: version_info = channel_versions_map.get(platform) if args.update_chrome: if _NeedsUpdate(config, 'chrome', channel, platform, version_info): _QueuePlatformUpdate('chrome', platform, version_info, config, channel) if args.update_chromium and platform in _CHROMIUM_PLATFORMS: if _NeedsUpdate(config, 'chromium', channel, platform, version_info): _QueuePlatformUpdate('chromium', platform, version_info, config, channel) print('Updating builds with downloaded binaries') config.ExecuteUpdateJobs(force=True)
def setUp(self): self.setUpPyfakefs() # pylint: disable=bad-continuation self.expected_dependencies = { 'dep_1': { 'cloud_storage_base_folder': 'dependencies/fake_config', 'cloud_storage_bucket': 'chrome-tel', 'file_info': { 'linux_x86_64': { 'cloud_storage_hash': '661ce936b3276f7ec3d687ab62be05b96d796f21', 'download_path': 'bin/linux/x86_64/dep_1' }, 'mac_x86_64': { 'cloud_storage_hash': 'c7b1bfc6399dc683058e88dac1ef0f877edea74b', 'download_path': 'bin/mac/x86_64/dep_1' }, 'win_AMD64': { 'cloud_storage_hash': 'ac4fee89a51662b9d920bce443c19b9b2929b198', 'download_path': 'bin/win/AMD64/dep_1.exe' }, 'win_x86': { 'cloud_storage_hash': 'e246e183553ea26967d7b323ea269e3357b9c837', 'download_path': 'bin/win/x86/dep_1.exe' } } }, 'dep_2': { 'cloud_storage_base_folder': 'dependencies/fake_config', 'cloud_storage_bucket': 'chrome-tel', 'file_info': { 'linux_x86_64': { 'cloud_storage_hash': '13a57efae9a680ac0f160b3567e02e81f4ac493c', 'download_path': 'bin/linux/x86_64/dep_2', 'local_paths': [ '../../example/location/linux/dep_2', '../../example/location2/linux/dep_2' ] }, 'mac_x86_64': { 'cloud_storage_hash': 'd10c0ddaa8586b20449e951216bee852fa0f8850', 'download_path': 'bin/mac/x86_64/dep_2', 'local_paths': [ '../../example/location/mac/dep_2', '../../example/location2/mac/dep_2' ] }, 'win_AMD64': { 'cloud_storage_hash': 'fd5b417f78c7f7d9192a98967058709ded1d399d', 'download_path': 'bin/win/AMD64/dep_2.exe', 'local_paths': [ '../../example/location/win64/dep_2', '../../example/location2/win64/dep_2' ] }, 'win_x86': { 'cloud_storage_hash': 'cf5c8fe920378ce30d057e76591d57f63fd31c1a', 'download_path': 'bin/win/x86/dep_2.exe', 'local_paths': [ '../../example/location/win32/dep_2', '../../example/location2/win32/dep_2' ] }, 'android_k_x64': { 'cloud_storage_hash': '09177be2fed00b44df0e777932828425440b23b3', 'download_path': 'bin/android/x64/k/dep_2.apk', 'local_paths': [ '../../example/location/android_x64/k/dep_2', '../../example/location2/android_x64/k/dep_2' ] }, 'android_l_x64': { 'cloud_storage_hash': '09177be2fed00b44df0e777932828425440b23b3', 'download_path': 'bin/android/x64/l/dep_2.apk', 'local_paths': [ '../../example/location/android_x64/l/dep_2', '../../example/location2/android_x64/l/dep_2' ] }, 'android_k_x86': { 'cloud_storage_hash': 'bcf02af039713a48b69b89bd7f0f9c81ed8183a4', 'download_path': 'bin/android/x86/k/dep_2.apk', 'local_paths': [ '../../example/location/android_x86/k/dep_2', '../../example/location2/android_x86/k/dep_2' ] }, 'android_l_x86': { 'cloud_storage_hash': '12a74cec071017ba11655b5740b8a58e2f52a219', 'download_path': 'bin/android/x86/l/dep_2.apk', 'local_paths': [ '../../example/location/android_x86/l/dep_2', '../../example/location2/android_x86/l/dep_2' ] } } }, 'dep_3': { 'file_info': { 'linux_x86_64': { 'local_paths': [ '../../example/location/linux/dep_3', '../../example/location2/linux/dep_3' ] }, 'mac_x86_64': { 'local_paths': [ '../../example/location/mac/dep_3', '../../example/location2/mac/dep_3' ] }, 'win_AMD64': { 'local_paths': [ '../../example/location/win64/dep_3', '../../example/location2/win64/dep_3' ] }, 'win_x86': { 'local_paths': [ '../../example/location/win32/dep_3', '../../example/location2/win32/dep_3' ] } } } } # pylint: enable=bad-continuation fake_config = { 'config_type': 'BaseConfig', 'dependencies': self.expected_dependencies } base_config_path = os.path.join(os.path.dirname(__file__), 'example_config.json') self.fs.CreateFile(base_config_path, contents=json.dumps(fake_config)) self.base_config = base_config.BaseConfig(base_config_path) linux_file = os.path.join( os.path.dirname(base_config_path), os.path.join('..', '..', 'example', 'location2', 'linux', 'dep_2')) android_file = os.path.join( os.path.dirname(base_config_path), '..', '..', 'example', 'location', 'android_x86', 'l', 'dep_2') self.expected_dep2_linux_file = os.path.abspath(linux_file) self.expected_dep2_android_file = os.path.abspath(android_file) self.fs.CreateFile(self.expected_dep2_linux_file) self.fs.CreateFile(self.expected_dep2_android_file)