Beispiel #1
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
                kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        self.sourceparams_dict = {}

        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error("The %s partition has a size of zero.  Please "
                            "specify a non-zero --size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       creator, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     creator, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)
Beispiel #2
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error("The %s partition has a size of zero.  Please "
                            "specify a non-zero --size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       creator, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     creator, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)
Beispiel #3
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size and not self.fixed_size:
                msger.error("The %s partition has a size of zero. Please "
                            "specify a non-zero --size/--fixed-size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](
            self, self.sourceparams_dict, creator, cr_workdir, oe_builddir,
            bootimg_dir, kernel_dir, native_sysroot)
        self._source_methods["do_stage_partition"](self,
                                                   self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir, bootimg_dir,
                                                   kernel_dir, native_sysroot)
        self._source_methods["do_prepare_partition"](
            self, self.sourceparams_dict, creator, cr_workdir, oe_builddir,
            bootimg_dir, kernel_dir, rootfs_dir, native_sysroot)

        # further processing required Partition.size to be an integer, make
        # sure that it is one
        if type(self.size) is not int:
            msger.error("Partition %s internal size is not an integer. " \
                          "This a bug in source plugin %s and needs to be fixed." \
                          % (self.mountpoint, self.source))

        if self.fixed_size and self.size > self.fixed_size:
            msger.error("File system image of partition %s is larger (%d kB) than its"\
                        "allowed size %d kB" % (self.mountpoint,
                                                self.size, self.fixed_size))
Beispiel #4
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size and not self.fixed_size:
                msger.error("The %s partition has a size of zero. Please "
                            "specify a non-zero --size/--fixed-size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       creator, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     creator, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)

        # further processing required Partition.size to be an integer, make
        # sure that it is one
        if type(self.size) is not int:
            msger.error("Partition %s internal size is not an integer. " \
                          "This a bug in source plugin %s and needs to be fixed." \
                          % (self.mountpoint, self.source))

        if self.fixed_size and self.size > self.fixed_size:
            msger.error("File system image of partition %s is larger (%d kB) than its"\
                        "allowed size %d kB" % (self.mountpoint,
                                                self.size, self.fixed_size))