Example #1
0
    def builder(self, path, file, root):
        if not root:
            root = self.dist.getReleasePath()
        dir = os.path.join(root, path)
        fullname = os.path.join(dir, file.getName())

        if file.getFullName() == fullname:
            return

        if not os.path.isdir(dir):
            os.makedirs(dir)

        # Create the new distribution either with all symbolic links
        # into the mirror, contrib, and local rpms.  Or copy
        # everything.  The idea is local distributions should be all
        # symlinks, but a published base distribution (like the NPACI
        # Rocks master) should be copys.  This keeps the FTP chroot
        # environment happy, extends the lifetime of the release past
        # that of scattered RPMS.  It may also make sense to have your
        # master distribution for your cluster done by copy.

        if self.useLinks:
            file.symlink(fullname, self.dist.getRootPath())
        else:

            # For copied distributions, the timestamps of the new
            # files are forced to that of the source files.  This
            # keeps wget happy.

            if os.path.islink(file.getFullName()):
                os.symlink(os.readlink(file.getFullName()), fullname)
            else:
                shutil.copy(file.getFullName(), fullname)
                os.utime(fullname, (file.getTimestamp(), file.getTimestamp()))
Example #2
0
    def builder(self, path, file, root):
        if not root:
            root = self.dist.getReleasePath()
        dir	 = os.path.join(root, path)
        fullname = os.path.join(dir, file.getName())

        if file.getFullName() == fullname:
            return

        if not os.path.isdir(dir):
            os.makedirs(dir)

        # Create the new distribution either with all symbolic links
        # into the mirror, contrib, and local rpms.  Or copy
        # everything.  The idea is local distributions should be all
        # symlinks, but a published base distribution (like the NPACI
        # Rocks master) should be copys.  This keeps the FTP chroot
        # environment happy, extends the lifetime of the release past
        # that of scattered RPMS.  It may also make sense to have your
        # master distribution for your cluster done by copy.
        
        if self.useLinks:
            file.symlink(fullname, self.dist.getRootPath())
        else:

            # For copied distributions, the timestamps of the new
            # files are forced to that of the source files.  This
            # keeps wget happy.

            if os.path.islink(file.getFullName()):
                os.symlink(os.readlink(file.getFullName()), fullname)
            else:
                shutil.copy(file.getFullName(), fullname)
                os.utime(fullname, (file.getTimestamp(), file.getTimestamp()))
Example #3
0
	def run(self):

		# Make a list of all the files that we need to copy onto the
		# pallets cds.  Don't worry about what the file types are right
		# now, we can figure that out later.
			
		list = []
		if self.config.hasRPMS():
			list.extend(self.getRPMS('RPMS'))
		for rpm in list:
			self.signRPM(rpm)

		# Make a list of both required and optional packages.  The copy
		# code is here since python is by-reference for everything.
		# After we segregate the packages add
		# any local rpms to the required list.  This makes sure we
		# pick up the roll-os-kickstart package.
		
		required = []
		if self.config.hasRolls():
			(required, optional) = self.getExternalRPMS()
			for file in list:
				required.append(file)
			print 'Required Packages', len(required)
			print 'Optional Packages', len(optional)
			for file in required: # make a copy of the list
				list.append(file)
			list.extend(optional)


		optional = 0
		for (name, id, size, files) in self.spanDisks(list):
			print 'Creating %s (%.2fMB)...' % (name, size),
			if optional:
				print ' This disk is optional (extra rpms)'
			else:
				print 
				
			if self.config.getRollInterface() == '4.0':
				# old style
				root = os.path.join(name,
						    self.config.getRollName(),
						    self.config.getRollVersion(),
						    self.config.getRollArch())
				rpmsdir = os.path.join('RedHat', 'RPMS')
			else:
				root = os.path.join(name,
						    self.config.getRollName(),
						    self.config.getRollVersion(),
						    'redhat',
						    self.config.getRollArch())
				rpmsdir = 'RPMS'

			os.makedirs(root)
			os.makedirs(os.path.join(root, rpmsdir))
			
			# Symlink in all the RPMS
			
			for file in files:
				try:
					#
					# not RPM files will throw an exception
					# in getPackageArch()
					#
					arch = file.getPackageArch()
				except:
					continue

				if arch != 'src':
					file.symlink(
						os.path.join(root, rpmsdir,
							     file.getName()))
				if file in required:
					del required[required.index(file)]
					
			if len(required) == 0:
				optional = 1
				
			# Copy the pallet XML file onto all the disks
			shutil.copy(self.config.getFullName(), root)
			
			# Create the .discinfo file
					
			self.stampDisk(name, self.config.getRollName(), 
				self.config.getRollArch(), id)
				
			# write repo data 
			self.writerepo()
			
			# make the ISO.  This code will change and move into
			# the base class, and supported bootable pallets.  Get
			# this working here and then test on the bootable
			# kernel pallet.
			
			isoname = '%s-%s-%s.%s.%s.iso' % (
				self.config.getRollName(),
				self.config.getRollVersion(),
				self.config.getRollRelease(),
				self.config.getRollArch(),
				name)
				
			if id == 1 and self.config.isBootable() == 1:
				self.makeBootable(name)
			
			self.mkisofs(isoname, self.config.getRollName(), name)
Example #4
0
    def run(self):

        # Make a list of all the files that we need to copy onto the
        # pallets cds.	Don't worry about what the file types are right
        # now, we can figure that out later.

        list = []
        if self.config.hasRPMS():
            list.extend(self.getRPMS('RPMS'))

        # Make a list of both required and optional packages.  The copy
        # code is here since python is by-reference for everything.
        # After we segregate the packages add
        # any local rpms to the required list.	This makes sure we
        # pick up the roll-os-kickstart package.

        required = []
        if self.config.hasRolls():
            (required, optional) = self.getExternalRPMS()
            for file in list:
                required.append(file)
            print('Required Packages', len(required))
            print('Optional Packages', len(optional))
            for file in required:  # make a copy of the list
                list.append(file)
            list.extend(optional)

        optional = 0
        for (name, id, size, files) in self.spanDisks(list):
            print('Creating %s (%.2fMB)...' % (name, size), end=' ')
            if optional:
                print(' This disk is optional (extra rpms)')
            else:
                print()

            root = os.path.join(name, self.config.getRollName(),
                                self.config.getRollVersion(),
                                self.config.getRollRelease(),
                                self.config.getRollOS(),
                                self.config.getRollArch())

            rpmsdir = 'RPMS'

            os.makedirs(root)
            if self.config.getRollOS() in ['redhat', 'sles']:
                os.makedirs(os.path.join(root, rpmsdir))

            # Symlink in all the RPMS

            for file in files:
                try:
                    #
                    # not RPM files will throw an exception
                    # in getPackageArch()
                    #
                    arch = file.getPackageArch()
                except:
                    continue

                if arch != 'src':
                    file.symlink(os.path.join(root, rpmsdir, file.getName()))
                if file in required:
                    del required[required.index(file)]

            if len(required) == 0:
                optional = 1

            # Copy the pallet XML file onto all the disks
            shutil.copy(self.config.getFullName(), root)

            # Create the .discinfo file

            self.stampDisk(name, self.config.getRollName(),
                           self.config.getRollArch(), id)

            # write repodata
            if self.config.getRollOS() in ['redhat', 'sles']:
                self.writerepo(self.config.getRollName(),
                               self.config.getRollVersion(),
                               self.config.getRollRelease(),
                               self.config.getRollOS(),
                               self.config.getRollArch())

            # copy the graph and node XMLs files into the pallet
            self.copyXMLs(self.config.getRollOS(), self.config.getRollName(),
                          self.config.getRollVersion(),
                          self.config.getRollRelease(),
                          self.config.getRollArch())

            # make the ISO.	 This code will change and move into
            # the base class, and supported bootable pallets.  Get
            # this working here and then test on the bootable
            # kernel pallet.

            isoname = '%s-%s-%s.%s.%s.iso' % (
                self.config.getRollName(), self.config.getRollVersion(),
                self.config.getRollRelease(), self.config.getRollArch(), name)

            if id == 1 and self.config.isBootable() == 1:
                try:
                    self.makeBootable(self.config.getRollName(),
                                      self.config.getRollVersion(),
                                      self.config.getRollRelease(),
                                      self.config.getRollArch())
                except ValueError as msg:
                    print('ERROR -', msg)
                    print('Pallet is not bootable')
                    self.config.setBootable(False)

            self.mkisofs(isoname, self.config.getRollName(), name)