示例#1
0
	def run(self):
	
		name = []
		arch = []
		for roll in self.rolls:
			if roll.getRollName() not in name:
				name.append(roll.getRollName())
			if roll.getRollArch() not in arch:
				arch.append(roll.getRollArch())

		if not self.rollname:
			name.sort()
			rollName = string.join(name, '+')
		else:
			rollName = self.rollname
	
		if len(arch) == 1:
			arch = arch[0]
		else:
			arch = 'any'
		name = "%s-%s.%s" % (rollName, self.version, arch)

    		# Create the meta pallet
					
		print 'Building %s ...' % name
		tmp = self.mktemp()
		os.makedirs(tmp)
		for roll in self.rolls:
			print '\tcopying %s' % roll.getRollName()
			self.copyRoll(roll, tmp)
		isoname = '%s.disk1.iso' % (name)

		# Find a pallet config file for the meta pallet. If any of
		# the pallets are bootable grab the config file for the
		# bootable pallet.  Otherwise just use the file from
		# the first pallet specified on the command line.

		for roll in self.rolls:
			xml = os.path.join(tmp, roll.getRollName(), 
				roll.getRollVersionString(), 
				'redhat',
				roll.getRollArch(),
				'roll-%s.xml' % roll.getRollName())
			
			if not os.path.exists(xml):
				xml = os.path.join(tmp,
					roll.getRollName(),
					roll.getRollVersionString(),
					roll.getRollArch(),
					'roll-%s.xml' % roll.getRollName())

			config = stack.file.RollInfoFile(xml)
			if not self.config:
				self.config = config
			elif config.isBootable():
				self.config = config
				break

		# Build the ISO.
		
		tree = stack.file.Tree(tmp)
		size = tree.getSize()
		print 'Pallet is %.1fMB' % size

		self.stampDisk(tmp, rollName, arch)
		self.mkisofs(isoname, rollName, 'disk1', tmp)

		shutil.rmtree(tmp)
示例#2
0
    def run(self):

        name = []
        arch = []
        for roll in self.rolls:
            if roll.getRollName() not in name:
                name.append(roll.getRollName())
            if roll.getRollArch() not in arch:
                arch.append(roll.getRollArch())

        if not self.rollname:
            rollName = '+'.join(name)
        else:
            rollName = self.rollname

        if len(arch) == 1:
            arch = arch[0]
        else:
            arch = 'any'
        name = "%s-%s-%s.%s" % (rollName, self.version, self.release, arch)

        # Create the meta pallet

        print('Building %s ...' % name)
        tmp = self.mktemp()
        os.makedirs(tmp)
        for roll in self.rolls:
            print('\tcopying %s' % roll.getRollName())
            self.copyRoll(roll, tmp)
        isoname = '%s.disk1.iso' % (name)

        # Find a pallet config file for the meta pallet. If any of
        # the pallets are bootable grab the config file for the
        # bootable pallet.  Otherwise just use the file from
        # the first pallet specified on the command line.

        for roll in self.rolls:
            xml = os.path.join(tmp, roll.getRollName(),
                               roll.getRollVersionString(),
                               roll.getRollRelease(), 'redhat',
                               roll.getRollArch(),
                               'roll-%s.xml' % roll.getRollName())

            if not os.path.exists(xml):
                xml = os.path.join(tmp, roll.getRollName(),
                                   roll.getRollVersionString(),
                                   roll.getRollRelease(), roll.getRollArch(),
                                   'roll-%s.xml' % roll.getRollName())

            config = stack.file.RollInfoFile(xml)
            if not self.config:
                self.config = config
            elif config.isBootable():
                self.config = config
                break

        # Build the ISO.

        tree = stack.file.Tree(tmp)
        size = tree.getSize()
        print('Pallet is %.1fMB' % size)

        self.stampDisk(tmp, rollName, arch)
        self.mkisofs(isoname, rollName, 'disk1', tmp)

        shutil.rmtree(tmp)