Пример #1
0
    def build_bootiso(self):
        """ Build boot iso """

        # Read pungi configuration
        config = ConfigParser.SafeConfigParser()
        config.read(self.imageconfig)

        arch = config.get('DEFAULT', 'arch')
        outdir = config.get('boot', 'outdir')
        workdir = config.get('boot', 'workdir')
        product = config.get('boot', 'product')
        release = config.get('boot', 'release')
        version = config.get('boot', 'version')
        proxy = config.get('boot', 'proxy')
    
        if proxy == '':
            proxy = None

        if not arch in self.possible_arches:
            print "ISOs for arch {0:s} are not supported".format(arch)
            sys.exit(1)

        if not product in self.possible_products:
            print "Product {0:s} is not supported".format(product)

        if not release in self.possible_releases:
            print "Release {0:s} is not supported".format(release)
            sys.exit(1)

        # gather repos and mirrors
        repos, mirrors = self.gather_repos(release)

        # Create the side repository if needed
        nvr = config.get('boot', 'nvr')
        bid = config.get('boot', 'bid')

        rpms_nvr = []
        if nvr:
            for rpm in nvr.split(';'):
                rpms_nvr.append(rpm)

        bids = []        
        if bid:
            for rpm in bid.split(';'):
                bids.extend(str(rpm))
            
            rpms_bid = self.get_nvr(bids, arch)
            rpms_nvr.extend(rpms_bid)
    
        # prepare side repository
        rpms = rpms_nvr

        if rpms:
            siderepo = self.prep_siderepo(workdir, rpms, arch)
            repos.append(siderepo)

        boot_builder = Bootiso(arch, release, version, repos, mirrors, proxy, outdir, product)
        boot_builder.make_iso()

        # boot image location
        imgloc = [os.path.abspath(outdir)+'/images/boot.iso']

        return imgloc