def stage(self, staging_dir):
     """Implement method from PayloadImage ABC."""
     assert len(self.archived_paths) == 1
     upi.stage_single_file_with_compression(
         staging_dir,
         uutil.ArchivedFileSpec(self._path, self.archived_paths[0]),
     )
 def stage(self, staging_dir):
     """Implement method from PayloadImage ABC."""
     assert len(self.archived_paths) == 1
     upi.stage_multi_file_component(
         staging_dir,
         self.archived_paths[0],
         [uutil.ArchivedFileSpec(self._path, self.image_base_type)],
     )
Beispiel #3
0
    def __init__(self, app_paths):
        """
        Create an AppsImage object.

        Args:
        * app_paths list<str>: list of paths to the ipk files to add to the
          payload.

        """
        self._apps = [uutil.ArchivedFileSpec(app) for app in app_paths]
        _validate_app_paths(self._apps)
Beispiel #4
0
 def stage(self, staging_dir):
     """Implement method from PayloadImage ABC."""
     boot_files_with_BOOT = [
         uutil.ArchivedFileSpec(
             afs.path, pathlib.Path("BOOT", afs.archived_path)
         )
         for afs in self._boot_files
     ]
     assert len(self.archived_paths) == 1
     upi.stage_multi_file_component(
         staging_dir, self.archived_paths[0], boot_files_with_BOOT
     )
Beispiel #5
0
def _img_boot_files_val_to_archived_file_specs(img_bf_val, deploy_dir):
    """
    Convert a value from the IMAGE_BOOT_FILES var to a list ArchivedFileSpecs.

    The values in the IMAGE_BOOT_FILES var can be a string filename,
    a filename with an 'output name' separated by a semi-colon, or a directory
    with a glob expression. This function will convert an IMAGE_BOOT_FILES
    entry into a list of ArchivedFileSpec objects according to the following
    rules:

    * dir with glob, e.g mbl-bootfiles/*: Each ArchivedFileSpec has:
      - path: absolute path for a file in the glob. The glob is intepreted
        relative to deploy_dir.
      - archived_path: basename of the file in the glob.

    * filename: The single ArchivedFileSpec in the returned list has:
      - path: absolute path for file. filename is interpreted relative to
        deploy_dir.
      - archived_path: basename of the file.

    * filename with output name, e.g uImage;kernel: The single ArchivedFileSpec
      in the returned list has:
      - path: absolute path of the file. filename is interpreted relative to
        deploy_dir.
      - archived_path: the "output name" (the part after the semicolon in the
        IMAGE_BOOT_FILES entry)

    :param img_bf_val str: the IMAGE_BOOT_FILES value.
    :param deploy_dir_img Path: path to the image deploy dir.
    """
    installed_name_delim = ";"
    if img_bf_val.endswith(r"/*"):
        matched_files = deploy_dir.glob(img_bf_val)
        return [uutil.ArchivedFileSpec(p) for p in matched_files]
    elif installed_name_delim in img_bf_val:
        orig_name, installed_name = img_bf_val.split(installed_name_delim)
        return [uutil.ArchivedFileSpec(deploy_dir / orig_name, installed_name)]
    elif img_bf_val:
        return [uutil.ArchivedFileSpec(deploy_dir / img_bf_val)]
Beispiel #6
0
    def __init__(self, bootloader_slot_name, deploy_dir, tinfoil):
        """
        Create a WksBootloaderSlotImage object.

        Args:
        * bootloader_slot_name str: name of the bootloader slot/partition.
        * deploy_dir Path: path to the directory containing build artifacts.
        * tinfoil Tinfoil: BitBake Tinfoil object.

        """
        self._bootloader_slot_name = bootloader_slot_name
        filename_var_name = "MBL_{}_FILENAME".format(bootloader_slot_name)
        filename = tutil.get_bitbake_conf_var(filename_var_name, tinfoil)
        self._archived_file_spec = uutil.ArchivedFileSpec(
            deploy_dir / filename, "{}.xz".format(self.image_type))
Beispiel #7
0
    def __init__(self, image_name, deploy_dir, tinfoil):
        """
        Create a RootfsImage object.

        Args:
        * image_name str: name of the BitBake image recipe that was used to
          create the rootfs image.
        * deploy_dir Path: path to the directory containing build artifacts.
        * tinfoil Tinfoil: BitBake Tinfoil object.

        """
        machine = tutil.get_bitbake_conf_var("MACHINE", tinfoil)
        rootfs_filename = "{}-{}.tar.xz".format(image_name, machine)
        self._archived_file_spec = uutil.ArchivedFileSpec(
            deploy_dir / rootfs_filename, "{}.tar.xz".format(self.image_type))