def extract_tarball(self, tarball_url, partition, directory='/'): logging.info('extracting %s to target', tarball_url) self._check_power_state() with image_partition_mounted(self._sd_image, partition) as mntdir: tb = download_image(tarball_url, self.context, decompress=False) extract_tar(tb, '%s/%s' % (mntdir, directory))
def _extract_firmware_from_tarball(self, tarball): extract_tar(tarball, self.scratch_dir) self.test_bl1 = self._copy_first_find_from_list(self.scratch_dir, self.scratch_dir, self.config.bl1_image_files, self.config.bl1_image_filename) self.test_fip = self._copy_first_find_from_list(self.scratch_dir, self.scratch_dir, self.config.fip_image_files, self.config.fip_image_filename)
def _extract_firmware_from_tarball(self, tarball): extract_tar(tarball, self.scratch_dir) self.test_bl1 = self._copy_first_find_from_list( self.scratch_dir, self.scratch_dir, self.config.bl1_image_files, self.config.bl1_image_filename) self.test_fip = self._copy_first_find_from_list( self.scratch_dir, self.scratch_dir, self.config.fip_image_files, self.config.fip_image_filename)
def _extract_firmware_from_tarball(self, tarball): extract_tar(tarball, self.scratch_dir) if self.config.vexpress_requires_trusted_firmware: self.test_bl1 = self._copy_first_find_from_list(self.scratch_dir, self.scratch_dir, self.config.vexpress_bl1_image_files, self.config.vexpress_bl1_image_filename) self.test_uefi = self._copy_first_find_from_list(self.scratch_dir, self.scratch_dir, self.config.vexpress_uefi_image_files, self.config.vexpress_uefi_image_filename)
def _extract_firmware_from_tarball(self, tarball): extract_tar(tarball, self.scratch_dir) if self.config.vexpress_requires_trusted_firmware: self.test_bl1 = self._copy_first_find_from_list( self.scratch_dir, self.scratch_dir, self.config.vexpress_bl1_image_files, self.config.vexpress_bl1_image_filename) self.test_uefi = self._copy_first_find_from_list( self.scratch_dir, self.scratch_dir, self.config.vexpress_uefi_image_files, self.config.vexpress_uefi_image_filename)
def _get_bundles_from_device(self, result_disk): bundles = [] try: result_path = self.client.retrieve_results(result_disk) if result_path is not None: d = tempfile.mkdtemp(dir=self.client.target_device.scratch_dir) files = utils.extract_tar(result_path, d) bundles = self._get_bundles(files) except KeyboardInterrupt: raise KeyboardInterrupt except GatherResultsError: raise except: msg = 'unable to retrieve results from target' logging.exception(msg) raise GatherResultsError(msg) return bundles
def _read_boot_cmds(self, image=None, boot_tgz=None): boot_file_path = None if not self.config.read_boot_cmds_from_image: return # If we have already obtained boot commands dynamically, then return. if self.__boot_cmds_dynamic__ is not None: logging.debug("We already have boot commands in place.") return if image: boot_part = self.config.boot_part # Read boot related file from the boot partition of image. with image_partition_mounted(image, boot_part) as mnt: for boot_file in self.config.boot_files: boot_path = os.path.join(mnt, boot_file) if os.path.exists(boot_path): boot_file_path = boot_path break elif boot_tgz: tmp_dir = mkdtemp() extracted_files = extract_tar(boot_tgz, tmp_dir) for boot_file in self.config.boot_files: for file_path in extracted_files: if boot_file == os.path.basename(file_path): boot_file_path = file_path break if boot_file_path and os.path.exists(boot_file_path): with open(boot_file_path, 'r') as f: boot_cmds = self._rewrite_boot_cmds(f.read()) self.__boot_cmds_dynamic__ = boot_cmds else: logging.debug("Unable to read boot commands dynamically.")
def _extract_android_firmware(self, tarball): extract_tar(tarball, self.scratch_dir) firmware_tarball = self._find_file( self.scratch_dir, self.config.vexpress_firmware_path_android) self._extract_compressed_firmware(firmware_tarball)
def _extract_uncompressed_firmware(self, tarball): extract_tar(tarball, self.scratch_dir) self.complete_firmware_test = self._find_dir( self.scratch_dir, self.config.vexpress_firmware_path_hwpack)
def _extract_compressed_firmware(self, tarball): firmdir = self.scratch_dir + "/board-recovery-image-test" self.context.run_command('mkdir -p %s' % firmdir) self.context.run_command('rm -r %s/*' % firmdir) extract_tar(tarball, firmdir) self.complete_firmware_test = firmdir
def extract_tarball(self, tarball_url, partition, directory='/'): logging.info('extracting %s to target', tarball_url) with self.file_system(partition, directory) as mntdir: tb = download_image(tarball_url, self.context, decompress=False) extract_tar(tb, '%s/%s' % (mntdir, directory))
def _extract_android_firmware(self, tarball): extract_tar(tarball, self.scratch_dir) firmware_tarball = self._find_file(self.scratch_dir, self.config.vexpress_firmware_path_android) self._extract_compressed_firmware(firmware_tarball)
def _extract_uncompressed_firmware(self, tarball): extract_tar(tarball, self.scratch_dir) self.complete_firmware_test = self._find_dir(self.scratch_dir, self.config.vexpress_firmware_path_hwpack)