def build_package(self, platform, arch_bit, op_id, branding_options, package_types, destination, routing_key): buid_request = build.BuildRequest(platform, arch_bit) platform = buid_request.platform() arch = platform.arch() platform_and_arch_str = '{0}_{1}'.format(platform.name(), arch.name()) dir_name = 'build_{0}_for_{1}'.format(platform_and_arch_str, op_id) bs = build.get_supported_build_system_by_name('ninja') self.send_status(routing_key, op_id, 20.0, 'Building package') def store(progress_min, progress_max, routing_key, op_id): def closure(progress, message): diff = progress_max - progress_min perc = round(progress_min + diff * (progress / 100.0), 1) print('{0}% {1}'.format(perc, message)) sys.stdout.flush() self.send_status(routing_key, op_id, perc, message) return closure store = store(21.0, 79.0, routing_key, op_id) saver = build.ProgressSaver(store) file_paths = buid_request.build('..', branding_options, dir_name, bs, package_types, saver) file_path = file_paths[0] self.send_status(routing_key, op_id, 80.0, 'Loading package to server') try: result = config.post_install_step(file_path, destination) except Exception as ex: raise ex return result
def build_package(self, platform, arch_bit, op_id, branding_options, package_types, destination, routing_key): buid_request = build.BuildRequest(platform, arch_bit) platform = buid_request.platform() arch = platform.arch() platform_and_arch_str = '{0}_{1}'.format(platform.name(), arch.name()) dir_name = 'build_{0}_for_{1}'.format(platform_and_arch_str, op_id) bs = build.get_supported_build_system_by_name('ninja') self.send_status(routing_key, op_id, 20.0, 'Building package') def store(progress_min, progress_max, routing_key, op_id): def closure(progress, message): diff = progress_max - progress_min perc = round(progress_min + diff * (progress / 100.0), 1) print('{0}% {1}'.format(perc, message)) sys.stdout.flush() self.send_status(routing_key, op_id, perc, message) return closure store = store(21.0, 79.0, routing_key, op_id) saver = build.ProgressSaver(store) file_paths = buid_request.build('..', branding_options, dir_name, bs, package_types, saver) file_path = file_paths[0] self.send_status(routing_key, op_id, 80.0, 'Loading package to server') try: result = config.post_install_step(file_path, destination) except Exception as ex: raise ex return result