Exemplo n.º 1
0
	def run(self):
		roll = self.roll
		isoname = '%s-%s-%s.%s.disk%d.iso'  % \
			(roll.getRollName(),
			roll.getRollVersionString(),
			roll.getRollReleaseString(),
			self.getArch(),
			roll.getRollDiskID())

		print 'Re-Arching %s ...' % roll.getRollName()
		tmp = self.mktemp()
		os.makedirs(tmp)
		print '\tcopying %s' % roll.getRollName()
		self.copyRoll(roll, tmp)
		
		# Fix the directory structure for the new Roll architecture
		
		src = os.path.join(tmp, roll.getRollName(), 
			roll.getRollVersionString(), roll.getRollArch())
		dst = os.path.join(tmp, roll.getRollName(),
			roll.getRollVersionString(), self.getArch())
		shutil.move(src, dst)
		
		# Fix the arch attribute in the roll XML file, and 
		# initialize the self.config to the new XML file.  We
		# unlink the file before writing to avoid any read-only
		# permission error (non-root can run this code)
		
		xml = rocks.file.RollInfoFile(os.path.join(dst, 
			'roll-%s.xml' % roll.getRollName()))
		xml.setRollArch(self.getArch())
		
		os.unlink(xml.getFullName())
		file = open(xml.getFullName(), 'w')
		file.write(xml.getXML())
		file.close()
		
		self.config = rocks.file.RollInfoFile(xml.getFullName())
		
		
		# Create a new .discinfo file and create the ISO 

		self.stampDisk(tmp, roll.getRollName(), self.getArch(), 
			roll.getRollDiskID())
		self.mkisofs(isoname, roll.getRollName(), 
			'disk%d' % roll.getRollDiskID(), tmp)

		shutil.rmtree(tmp)
Exemplo n.º 2
0
    def run(self):
        roll = self.roll
        isoname = '%s-%s-%s.%s.disk%d.iso'  % \
         (roll.getRollName(),
         roll.getRollVersionString(),
         roll.getRollReleaseString(),
         self.getArch(),
         roll.getRollDiskID())

        print 'Re-Arching %s ...' % roll.getRollName()
        tmp = self.mktemp()
        os.makedirs(tmp)
        print '\tcopying %s' % roll.getRollName()
        self.copyRoll(roll, tmp)

        # Fix the directory structure for the new Roll architecture

        src = os.path.join(tmp, roll.getRollName(),
                           roll.getRollVersionString(), roll.getRollArch())
        dst = os.path.join(tmp, roll.getRollName(),
                           roll.getRollVersionString(), self.getArch())
        shutil.move(src, dst)

        # Fix the arch attribute in the roll XML file, and
        # initialize the self.config to the new XML file.  We
        # unlink the file before writing to avoid any read-only
        # permission error (non-root can run this code)

        xml = rocks.file.RollInfoFile(
            os.path.join(dst, 'roll-%s.xml' % roll.getRollName()))
        xml.setRollArch(self.getArch())

        os.unlink(xml.getFullName())
        file = open(xml.getFullName(), 'w')
        file.write(xml.getXML())
        file.close()

        self.config = rocks.file.RollInfoFile(xml.getFullName())

        # Create a new .discinfo file and create the ISO

        self.stampDisk(tmp, roll.getRollName(), self.getArch(),
                       roll.getRollDiskID())
        self.mkisofs(isoname, roll.getRollName(),
                     'disk%d' % roll.getRollDiskID(), tmp)

        shutil.rmtree(tmp)
Exemplo n.º 3
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())

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

    		# Create the meta roll
					
		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 roll config file for the meta roll.  If any of
		# the rolls are bootable grab the config file for the
		# bootable roll.  Otherwise just use the file from
		# the first roll specified on the command line.

		for roll in self.rolls:
			xml = os.path.join(tmp, roll.getRollName(), 
				roll.getRollVersionString(), 
				roll.getRollArch(),
				'roll-%s.xml' % roll.getRollName())
			config = rocks.file.RollInfoFile(xml)
			if not self.config:
				self.config = config
			elif config.isBootable():
				self.config = config

		#
		# meta rolls can be arbitrarily large, but complain if it
		# is larger than the config found in the code block above
		#
		isosize = self.config.getISOMaxSize()
		self.config.setISOMaxSize(0)

		
		# Build the ISO. complain if we detect that it's too big.
		
		tree = rocks.file.Tree(tmp)
		size = tree.getSize()
		print 'Roll is %.1fMB' % size

		if isosize < size:
			print 'WARNING: Roll %.1fMB is ' % (tree.getSize()) + \
				'larger than computed max ' + \
				'size %.1fMB' % (isosize)
			
		self.stampDisk(tmp, rollName, arch)
		self.mkisofs(isoname, rollName, 'disk1', tmp)

		shutil.rmtree(tmp)
Exemplo n.º 4
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())

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

        # Create the meta roll

        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 roll config file for the meta roll.  If any of
        # the rolls are bootable grab the config file for the
        # bootable roll.  Otherwise just use the file from
        # the first roll specified on the command line.

        for roll in self.rolls:
            xml = os.path.join(tmp, roll.getRollName(),
                               roll.getRollVersionString(), roll.getRollArch(),
                               'roll-%s.xml' % roll.getRollName())
            config = rocks.file.RollInfoFile(xml)
            if not self.config:
                self.config = config
            elif config.isBootable():
                self.config = config

        #
        # meta rolls can be arbitrarily large, but complain if it
        # is larger than the config found in the code block above
        #
        isosize = self.config.getISOMaxSize()
        self.config.setISOMaxSize(0)

        # Build the ISO. complain if we detect that it's too big.

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

        if isosize < size:
            print 'WARNING: Roll %.1fMB is ' % (tree.getSize()) + \
             'larger than computed max ' + \
             'size %.1fMB' % (isosize)

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

        shutil.rmtree(tmp)