Example #1
0
def creatoropts(args):

    if not args:
        raise errors.Usage("need one argument as the path of ks file")

    if len(args) != 1:
        raise errors.Usage("Extra arguments given")

    creatoropts = configmgr.create
    ksconf = args[0]

    if not os.path.exists(ksconf):
        raise errors.CreatorError("Can't find the file: %s" % ksconf)

    if not 'record_pkgs' in creatoropts:
        creatoropts['record_pkgs'] = []

    if creatoropts['release'] is not None:
        if 'name' not in creatoropts['record_pkgs']:
            creatoropts['record_pkgs'].append('name')

    ksconf = misc.normalize_ksfile(ksconf, creatoropts['tokenmap'])
    configmgr._ksconf = ksconf

    # Called After setting the configmgr._ksconf as the creatoropts['name'] is reset there.
    if creatoropts['release'] is not None:
        creatoropts['outdir'] = "%s/%s/images/%s/" % (
            creatoropts['outdir'], creatoropts['release'], creatoropts['name'])

    # try to find the pkgmgr
    pkgmgr = None
    for (key, pcls) in pluginmgr.get_plugins('backend').items():
        if key == creatoropts['pkgmgr']:
            pkgmgr = pcls
            break

    if not pkgmgr:
        pkgmgrs = list(pluginmgr.get_plugins('backend').keys())
        raise errors.CreatorError(
            "Can't find package manager: %s (availables: %s)" %
            (creatoropts['pkgmgr'], ', '.join(pkgmgrs)))

    creatoropts['pkgmgr_pcls'] = pkgmgr

    if creatoropts['runtime']:
        rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf,
                                  None)

    # Write the normalized kickstart to outdir
    # It has to be done this way in case the source ks is same as dest ks
    mkdir_p(creatoropts['outdir'])
    dst_ks = "%s/%s.ks" % (creatoropts['outdir'], creatoropts['name'])
    with open(configmgr._ksconf, 'r') as src_ksf:
        src_ks = src_ksf.read()
        with open(dst_ks, 'w') as dst_ksf:
            dst_ksf.write(src_ks)

    creatoropts['dst_ks'] = dst_ks

    return creatoropts
Example #2
0
def creatoropts(args):

    if not args:
        raise errors.Usage("need one argument as the path of ks file")

    if len(args) != 1:
        raise errors.Usage("Extra arguments given")

    creatoropts = configmgr.create
    ksconf = args[0]

    if not os.path.exists(ksconf):
        raise errors.CreatorError("Can't find the file: %s" % ksconf)

    if not 'record_pkgs' in creatoropts:
        creatoropts['record_pkgs'] = []

    if creatoropts['release'] is not None:
        if 'name' not in creatoropts['record_pkgs']:
            creatoropts['record_pkgs'].append('name')

    ksconf = misc.normalize_ksfile(ksconf, creatoropts['tokenmap'])
    configmgr._ksconf = ksconf

    # Called After setting the configmgr._ksconf as the creatoropts['name'] is reset there.
    if creatoropts['release'] is not None:
        creatoropts['outdir'] = "%s/%s/images/%s/" % (creatoropts['outdir'], creatoropts['release'], creatoropts['name'])

    # try to find the pkgmgr
    pkgmgr = None
    for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
        if key == creatoropts['pkgmgr']:
            pkgmgr = pcls
            break

    if not pkgmgr:
        pkgmgrs = pluginmgr.get_plugins('backend').keys()
        raise errors.CreatorError("Can't find package manager: %s (availables: %s)" % (creatoropts['pkgmgr'], ', '.join(pkgmgrs)))

    creatoropts['pkgmgr_pcls'] = pkgmgr

    if creatoropts['runtime']:
        rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf, None)

    # Write the normalized kickstart to outdir
    # It has to be done this way in case the source ks is same as dest ks
    mkdir_p(creatoropts['outdir'])
    dst_ks = "%s/%s.ks" % (creatoropts['outdir'], creatoropts['name'])
    with open(configmgr._ksconf, 'r') as src_ksf:
        src_ks = src_ksf.read()
        with open(dst_ks, 'w') as dst_ksf:
            dst_ksf.write(src_ks)

    creatoropts['dst_ks'] = dst_ks

    return creatoropts
Example #3
0
File: conf.py Project: ronan22/mic
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf, self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf, self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])

        msger.info("Retrieving repo metadata:")
        ksrepos = misc.get_repostrs_from_ks(ks)
        if not ksrepos:
            raise errors.KsError('no valid repos found in ks file')

        for repo in ksrepos:
            if 'baseurl' in repo and repo['baseurl'].startswith("file:"):
                repourl = repo['baseurl'].replace('file:', '')
                repourl = "/%s" % repourl.lstrip('/')
                self.create['localrepos'].append(repourl)

        self.create['repomd'] = misc.get_metadata_from_repos(
            ksrepos, self.create['cachedir'])
        msger.raw(" DONE")

        target_archlist, archlist = misc.get_arch(self.create['repomd'])
        if self.create['arch']:
            if self.create['arch'] not in archlist:
                raise errors.ConfigError("Invalid arch %s for repository. "
                                  "Valid arches: %s" \
                                  % (self.create['arch'], ', '.join(archlist)))
        else:
            if len(target_archlist) == 1:
                self.create['arch'] = str(target_archlist[0])
                msger.info("\nUse detected arch %s." % target_archlist[0])
            else:
                raise errors.ConfigError("Please specify a valid arch, "
                                         "the choice can be: %s" \
                                         % ', '.join(archlist))

        kickstart.resolve_groups(self.create, self.create['repomd'])

        # check selinux, it will block arm and btrfs image creation
        misc.selinux_check(self.create['arch'],
                           [p.fstype for p in ks.handler.partition.partitions])
Example #4
0
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf, self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf, self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])
Example #5
0
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf,
                                       self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf,
                                              self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])
Example #6
0
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf,
                                       self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf,
                                              self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])

        # check selinux, it will block arm and btrfs image creation
        misc.selinux_check(self.create['arch'],
                           [p.fstype for p in ks.handler.partition.partitions])
Example #7
0
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf,
                                       self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf,
                                              self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])

        self.create['destdir'] = self.create['outdir']
        if self.create['release'] is not None:
            self.create['destdir'] = "%s/%s/images/%s/" % (self.create['outdir'],
                                                           self.create['release'],
                                                           self.create['name'])
            self.create['name'] = self.create['release'] + '_' + self.create['name']

            if not self.create['logfile']:
                self.create['logfile'] = os.path.join(self.create['destdir'],
                                                      self.create['name'] + ".log")
                self.create['releaselog'] = True
                self.set_logfile()

        msger.info("Retrieving repo metadata:")
        ksrepos = kickstart.get_repos(ks,
                                      self.create['extrarepos'],
                                      self.create['ignore_ksrepo'])
        if not ksrepos:
            raise errors.KsError('no valid repos found in ks file')

        for repo in ksrepos:
            if hasattr(repo, 'baseurl') and repo.baseurl.startswith("file:"):
                repourl = repo.baseurl.replace('file:', '')
                repourl = "/%s" % repourl.lstrip('/')
                self.create['localrepos'].append(repourl)

        self.create['repomd'] = misc.get_metadata_from_repos(
                                                    ksrepos,
                                                    self.create['cachedir'])
        msger.raw(" DONE")

        target_archlist, archlist = misc.get_arch(self.create['repomd'])
        if self.create['arch']:
            if self.create['arch'] not in archlist:
                raise errors.ConfigError("Invalid arch %s for repository. "
                                  "Valid arches: %s" \
                                  % (self.create['arch'], ', '.join(archlist)))
        else:
            if len(target_archlist) == 1:
                self.create['arch'] = str(target_archlist[0])
                msger.info("Use detected arch %s." % target_archlist[0])
            else:
                raise errors.ConfigError("Please specify a valid arch, "
                                         "the choice can be: %s" \
                                         % ', '.join(archlist))

        kickstart.resolve_groups(self.create, self.create['repomd'])

        # check selinux, it will block arm and btrfs image creation
        misc.selinux_check(self.create['arch'],
                           [p.fstype for p in ks.handler.partition.partitions])
Example #8
0
    def do_create(self, subcmd, opts, *args):
        """${cmd_name}: create loop image

        Usage:
            ${name} ${cmd_name} <ksfile> [OPTS]

        ${cmd_option_list}
        """

        if not args:
            raise errors.Usage("need one argument as the path of ks file")

        if len(args) != 1:
            raise errors.Usage("Extra arguments given")

        creatoropts = configmgr.create
        ksconf = args[0]

        if not os.path.exists(ksconf):
            raise errors.CreatorError("Can't find the file: %s" % ksconf)

        recording_pkgs = []
        if len(creatoropts['record_pkgs']) > 0:
            recording_pkgs = creatoropts['record_pkgs']

        if creatoropts['release'] is not None:
            if 'name' not in recording_pkgs:
                recording_pkgs.append('name')

        ksconf = misc.normalize_ksfile(ksconf,
                                       creatoropts['release'],
                                       creatoropts['arch'])
        configmgr._ksconf = ksconf

        # Called After setting the configmgr._ksconf
        # as the creatoropts['name'] is reset there.
        if creatoropts['release'] is not None:
            creatoropts['outdir'] = "%s/%s/images/%s/" % (creatoropts['outdir'],
                                                          creatoropts['release'],
                                                          creatoropts['name'])

        # try to find the pkgmgr
        pkgmgr = None
        for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
            if key == creatoropts['pkgmgr']:
                pkgmgr = pcls
                break

        if not pkgmgr:
            pkgmgrs = pluginmgr.get_plugins('backend').keys()
            raise errors.CreatorError("Can't find package manager: %s "
                                      "(availables: %s)" \
                                      % (creatoropts['pkgmgr'],
                                         ', '.join(pkgmgrs)))

        if creatoropts['runtime']:
            rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf, None)

        creator = LoopImageCreator(creatoropts,
                                   pkgmgr,
                                   opts.compress_image,
                                   opts.shrink)

        if len(recording_pkgs) > 0:
            creator._recording_pkgs = recording_pkgs

        self.check_image_exists(creator.destdir,
                                creator.pack_to,
                                [creator.name + ".img"],
                                creatoropts['release'])

        try:
            creator.check_depend_tools()
            creator.mount(None, creatoropts["cachedir"])
            creator.install()
            creator.configure(creatoropts["repomd"])
            creator.copy_kernel()
            creator.unmount()
            creator.package(creatoropts["outdir"])

            if creatoropts['release'] is not None:
                creator.release_output(ksconf,
                                       creatoropts['outdir'],
                                       creatoropts['release'])
            creator.print_outimage_info()

        except errors.CreatorError:
            raise
        finally:
            creator.cleanup()

        msger.info("Finished.")
        return 0
Example #9
0
    def do_create(self, subcmd, opts, *args):
        """${cmd_name}: create loop image

        Usage:
            ${name} ${cmd_name} <ksfile> [OPTS]

        ${cmd_option_list}
        """

        if not args:
            raise errors.Usage("need one argument as the path of ks file")

        if len(args) != 1:
            raise errors.Usage("Extra arguments given")

        creatoropts = configmgr.create
        ksconf = args[0]

        if not os.path.exists(ksconf):
            raise errors.CreatorError("Can't find the file: %s" % ksconf)

        recording_pkgs = []
        if len(creatoropts['record_pkgs']) > 0:
            recording_pkgs = creatoropts['record_pkgs']

        if creatoropts['release'] is not None:
            if 'name' not in recording_pkgs:
                recording_pkgs.append('name')

        ksconf = misc.normalize_ksfile(ksconf, creatoropts['release'],
                                       creatoropts['arch'])
        configmgr._ksconf = ksconf

        # Called After setting the configmgr._ksconf
        # as the creatoropts['name'] is reset there.
        if creatoropts['release'] is not None:
            creatoropts['outdir'] = "%s/%s/images/%s/" % (
                creatoropts['outdir'], creatoropts['release'],
                creatoropts['name'])

        # try to find the pkgmgr
        pkgmgr = None
        for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
            if key == creatoropts['pkgmgr']:
                pkgmgr = pcls
                break

        if not pkgmgr:
            pkgmgrs = pluginmgr.get_plugins('backend').keys()
            raise errors.CreatorError("Can't find package manager: %s "
                                      "(availables: %s)" \
                                      % (creatoropts['pkgmgr'],
                                         ', '.join(pkgmgrs)))

        if creatoropts['runtime']:
            rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts,
                                      ksconf, None)

        creator = LoopImageCreator(creatoropts, pkgmgr, opts.compress_image,
                                   opts.shrink)

        if len(recording_pkgs) > 0:
            creator._recording_pkgs = recording_pkgs

        self.check_image_exists(creator.destdir, creator.pack_to,
                                [creator.name + ".img"],
                                creatoropts['release'])

        try:
            creator.check_depend_tools()
            creator.mount(None, creatoropts["cachedir"])
            creator.install()
            creator.configure(creatoropts["repomd"])
            creator.copy_kernel()
            creator.unmount()
            creator.package(creatoropts["outdir"])

            if creatoropts['release'] is not None:
                creator.release_output(ksconf, creatoropts['outdir'],
                                       creatoropts['release'])
            creator.print_outimage_info()

        except errors.CreatorError:
            raise
        finally:
            creator.cleanup()

        msger.info("Finished.")
        return 0
Example #10
0
    def do_create(self, subcmd, opts, *args):
        """${cmd_name}: create liveusb image

        Usage:
            ${name} ${cmd_name} <ksfile> [OPTS]

        ${cmd_option_list}
        """

        if not args:
            raise errors.Usage("need one argument as the path of ks file")

        if len(args) != 1:
            raise errors.Usage("Extra arguments given")

        creatoropts = configmgr.create
        ksconf = args[0]

        if not os.path.exists(ksconf):
            raise errors.CreatorError("Can't find the file: %s" % ksconf)

        if creatoropts["arch"] and creatoropts["arch"].startswith("arm"):
            msger.warning("liveusb cannot support arm images, Quit")
            return

        recording_pkgs = []
        if len(creatoropts["record_pkgs"]) > 0:
            recording_pkgs = creatoropts["record_pkgs"]

        if creatoropts["release"] is not None:
            if "name" not in recording_pkgs:
                recording_pkgs.append("name")

        ksconf = misc.normalize_ksfile(ksconf, creatoropts["release"], creatoropts["arch"])

        configmgr._ksconf = ksconf

        # Called After setting the configmgr._ksconf as the creatoropts['name'] is reset there.
        if creatoropts["release"] is not None:
            creatoropts["outdir"] = "%s/%s/images/%s/" % (
                creatoropts["outdir"],
                creatoropts["release"],
                creatoropts["name"],
            )

        # try to find the pkgmgr
        pkgmgr = None
        for (key, pcls) in pluginmgr.get_plugins("backend").iteritems():
            if key == creatoropts["pkgmgr"]:
                pkgmgr = pcls
                break

        if not pkgmgr:
            pkgmgrs = pluginmgr.get_plugins("backend").keys()
            raise errors.CreatorError(
                "Can't find package manager: %s (availables: %s)" % (creatoropts["pkgmgr"], ", ".join(pkgmgrs))
            )

        if creatoropts["runtime"]:
            rt_util.runmic_in_runtime(creatoropts["runtime"], creatoropts, ksconf, None)

        creator = liveusb.LiveUSBImageCreator(creatoropts, pkgmgr)

        if len(recording_pkgs) > 0:
            creator._recording_pkgs = recording_pkgs

        self.check_image_exists(creator.destdir, creator.pack_to, [creator.name + ".usbimg"], creatoropts["release"])
        try:
            creator.check_depend_tools()
            creator.mount(None, creatoropts["cachedir"])
            creator.install()
            creator.configure(creatoropts["repomd"])
            creator.copy_kernel()
            creator.unmount()
            creator.package(creatoropts["outdir"])
            if creatoropts["release"] is not None:
                creator.release_output(ksconf, creatoropts["outdir"], creatoropts["release"])
            creator.print_outimage_info()

        except errors.CreatorError:
            raise
        finally:
            creator.cleanup()

        msger.info("Finished.")
        return 0
Example #11
0
    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        ksconf = misc.normalize_ksfile(ksconf,
                                       self.create['release'],
                                       self.create['arch'])

        ks = kickstart.read_kickstart(ksconf)

        self.create['ks'] = ks
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf,
                                              self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])

        self.create['destdir'] = self.create['outdir']
        if self.create['release'] is not None:
            self.create['destdir'] = "%s/%s/images/%s/" % (self.create['outdir'],
                                                           self.create['release'],
                                                           self.create['name'])
            self.create['name'] = self.create['release'] + '_' + self.create['name']
            if self.create['pack_to'] is not None:
                if '@NAME@' in self.create['pack_to']:
                    self.create['pack_to'] = self.create['pack_to'].replace('@NAME@', self.create['name'])
                self.create['name'] = misc.strip_archive_suffix(self.create['pack_to'])
                if self.create['name'] is None:
                    raise errors.CreatorError("Not supported archive file format: %s" % self.create['pack_to'])

            if not self.create['logfile']:
                self.create['logfile'] = os.path.join(self.create['destdir'],
                                                      self.create['name'] + ".log")
                self.create['releaselog'] = True
                self.set_logfile()

        elif self.create['pack_to'] is not None:
            if '@NAME@' in self.create['pack_to']:
                self.create['pack_to'] = self.create['pack_to'].replace('@NAME@', self.create['name'])
            self.create['name'] = misc.strip_archive_suffix(self.create['pack_to'])
            if self.create['name'] is None:
                raise errors.CreatorError("Not supported archive file format: %s" % self.create['pack_to'])

        msger.info("Retrieving repo metadata:")
        ksrepos = kickstart.get_repos(ks,
                                      self.create['extrarepos'],
                                      self.create['ignore_ksrepo'])
        if not ksrepos:
            raise errors.KsError('no valid repos found in ks file')

        for repo in ksrepos:
            if hasattr(repo, 'baseurl') and repo.baseurl.startswith("file:"):
                repourl = repo.baseurl.replace('file:', '')
                repourl = "/%s" % repourl.lstrip('/')
                self.create['localrepos'].append(repourl)

        self.create['repomd'] = misc.get_metadata_from_repos(
                                                    ksrepos,
                                                    self.create['cachedir'])
        kstpkrepos = kickstart.get_tpkrepos(ks)
        if kstpkrepos:
            for tpk_repo in kstpkrepos:
                if hasattr(tpk_repo,'baseurl') and tpk_repo.baseurl.startswith("file:"):
                    tpk_repourl = tpk_repo.baseurl.replace('file:','')
                    tpk_repourl = "/%s" % tpk_repourl.lstrip('/')
                    self.create['localtpkrepos'].append(tpk_repourl)

        msger.raw(" DONE")

        target_archlist, archlist = misc.get_arch(self.create['repomd'])
        if self.create['arch']:
            if self.create['arch'] not in archlist:
                raise errors.ConfigError("Invalid arch %s for repository. "
                                  "Valid arches: %s" \
                                  % (self.create['arch'], ', '.join(archlist)))
        else:
            if len(target_archlist) == 1:
                self.create['arch'] = str(target_archlist[0])
                msger.info("Use detected arch %s." % target_archlist[0])
            else:
                raise errors.ConfigError("Please specify a valid arch, "
                                         "the choice can be: %s" \
                                         % ', '.join(archlist))

        kickstart.resolve_groups(self.create, self.create['repomd'])

        # check selinux, it will block arm and btrfs image creation
        misc.selinux_check(self.create['arch'],
                           [p.fstype for p in ks.handler.partition.partitions])
Example #12
0
    def do_create(self, subcmd, opts, *args):
        """${cmd_name}: create fs image

        Usage:
            ${name} ${cmd_name} <ksfile> [OPTS]

        ${cmd_option_list}
        """

        if not args:
            raise errors.Usage("need one argument as the path of ks file")

        if len(args) != 1:
            raise errors.Usage("Extra arguments given")

        creatoropts = configmgr.create
        ksconf = args[0]

        if not os.path.exists(ksconf):
            raise errors.CreatorError("Can't find the file: %s" % ksconf)

        recording_pkgs = []
        if len(creatoropts['record_pkgs']) > 0:
            recording_pkgs = creatoropts['record_pkgs']

        if creatoropts['release'] is not None:
            if 'name' not in recording_pkgs:
                recording_pkgs.append('name')

        ksconf = misc.normalize_ksfile(ksconf,
                                       creatoropts['release'],
                                       creatoropts['arch'])

        configmgr._ksconf = ksconf

        # Called After setting the configmgr._ksconf as the creatoropts['name'] is reset there.
        if creatoropts['release'] is not None:
            creatoropts['outdir'] = "%s/%s/images/%s/" % (creatoropts['outdir'], creatoropts['release'], creatoropts['name'])

        # try to find the pkgmgr
        pkgmgr = None
        for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
            if key == creatoropts['pkgmgr']:
                pkgmgr = pcls
                break

        if not pkgmgr:
            pkgmgrs = pluginmgr.get_plugins('backend').keys()
            raise errors.CreatorError("Can't find package manager: %s (availables: %s)" % (creatoropts['pkgmgr'], ', '.join(pkgmgrs)))

        if creatoropts['runtime']:
            rt_util.runmic_in_runtime(creatoropts['runtime'], creatoropts, ksconf, None)

        creator = fs.FsImageCreator(creatoropts, pkgmgr)
        creator._include_src = opts.include_src

        if len(recording_pkgs) > 0:
            creator._recording_pkgs = recording_pkgs

        self.check_image_exists(creator.destdir,
                                creator.pack_to,
                                [creator.name],
                                creatoropts['release'])

        try:
            creator.check_depend_tools()
            creator.mount(None, creatoropts["cachedir"])
            creator.install()
            #Download the source packages ###private options
            if opts.include_src:
                installed_pkgs =  creator.get_installed_packages()
                msger.info('--------------------------------------------------')
                msger.info('Generating the image with source rpms included ...')
                if not misc.SrcpkgsDownload(installed_pkgs, creatoropts["repomd"], creator._instroot, creatoropts["cachedir"]):
                    msger.warning("Source packages can't be downloaded")

            creator.configure(creatoropts["repomd"])
            creator.copy_kernel()
            creator.unmount()
            creator.package(creatoropts["outdir"])
            if creatoropts['release'] is not None:
                creator.release_output(ksconf, creatoropts['outdir'], creatoropts['release'])
            creator.print_outimage_info()
        except errors.CreatorError:
            raise
        finally:
            creator.cleanup()

        msger.info("Finished.")
        return 0