示例#1
0
	def spanDisks(self, files, disks=[]):
		"""Given the pallet RPMS and compute the size
		of all the files and return a list of files for each disk of 
		the pallet.  The intention is for almost all pallets to be one
		CD but for our OS pallet this is not the case."""
		
		# Set the pallet size to 0 to bypass the disk spanning
		# logic.  The updates pallet does this.
		
		avail = self.config.getISOMaxSize()
		if avail <= 0:
			infinite = 1
		else:
			infinite = 0
		consumed = []
		remaining = []
		
		# Fill the CDs
		
		for file in files:
			if file and infinite:
				consumed.append(file)
			elif file and (avail - file.getSize()) > 0:
				consumed.append(file)
				avail -= file.getSize()
			else:
				remaining.append(file)
		
		id	= len(disks) + 1
		name	= 'disk%d' % id
		size	= self.config.getISOMaxSize() - avail
		disks.append((name, id, size, consumed))
		if len(remaining):
			self.spanDisks(remaining, disks)
		return disks
示例#2
0
    def spanDisks(self, files, disks=[]):
        """Given the pallet RPMS and backend the size
		of all the files and return a list of files for each disk of 
		the pallet.  The intention is for almost all pallets to be one
		CD but for our OS pallet this is not the case."""

        # Set the pallet size to 0 to bypass the disk spanning
        # logic.  The updates pallet does this.

        avail = self.config.getISOMaxSize()
        if avail <= 0:
            infinite = 1
        else:
            infinite = 0
        consumed = []
        remaining = []

        # Fill the CDs

        for file in files:
            if file and infinite:
                consumed.append(file)
            elif file and (avail - file.getSize()) > 0:
                consumed.append(file)
                avail -= file.getSize()
            else:
                remaining.append(file)

        id = len(disks) + 1
        name = 'disk%d' % id
        size = self.config.getISOMaxSize() - avail
        disks.append((name, id, size, consumed))
        if len(remaining):
            self.spanDisks(remaining, disks)
        return disks