Beispiel #1
0
	def run(self, params, args):
		license = os.path.join(eval(self.__module__).__path__[0],
			'license.txt')
		file = open(license, 'r')
		for line in file.readlines():
			self.addText(line)
		file.close()
Beispiel #2
0
 def run(self, params, args):
     license = os.path.join(
         eval(self.__module__).__path__[0], 'license.txt')
     file = open(license, 'r')
     for line in file.readlines():
         self.addText(line)
     file.close()
Beispiel #3
0
    def copy_foreign_cd_sunos(self, clean):
        """Copy a standard Solaris CD"""

        cmd = '/opt/rocks/bin/rocks report distro'
        for line in os.popen(cmd).readlines():
            js_dir = line[:-1]

        js_dir = os.path.join(js_dir, 'jumpstart')

        # For now, hardcode the architecture, because we only support
        # one architecture. No others. This should really be obtained
        # from the database.
        arch = 'i386'
        roll_os = 'sunos'

        # Make sure it's a Solaris CD/DVD
        file = open(os.path.join(self.cdrom_mount, '.cdtoc'), 'r')
        for i in file.readlines():
            if i.startswith('#'):
                continue
            if i.startswith('PRODNAME'):
                prod_name = i.split('=')[1].strip()
            if i.startswith('PRODVERS'):
                prod_vers = i.split('=')[1].strip()
        if not prod_name.startswith('Solaris'):
            print "Not Valid Solaris CD"
            return

        # If we've got this far, that means that we can continue
        # and copy the Solaris DVD.
        print prod_name, prod_vers
        roll_dir = os.path.join(js_dir, 'rolls', prod_name, prod_vers, arch)

        # Set the source and destination directories for cpio
        # These default to the CDROM for source and the roll directory
        # for destination
        cpio_src_dir = self.cdrom_mount
        cpio_dest_dir = roll_dir

        # If clean flag is specified, remove the roll directory
        if clean:
            if os.path.exists(roll_dir):
                str = 'Cleaning %s version %s ' % \
                 (prod_name, prod_vers)
                str += 'for %s from Rolls directory' % arch
                print str
                self.clean_dir(roll_dir)

            os.makedirs(roll_dir)

        # If it's the companion DVD, the filesystem layout is a
        # tad bit different. Treat it as such, and set cpio source
        # and destination directories appropriately.
        if prod_name == 'Solaris_Software_Companion':
            cpio_src_dir = os.path.join(self.cdrom_mount,
                                        'Solaris_Software_Companion',
                                        'Solaris_%s' % arch, 'Packages')
            cpio_dest_dir = os.path.join(roll_dir, 'Solaris_10', 'Product')

        if not os.path.exists(cpio_dest_dir):
            os.makedirs(cpio_dest_dir)

        # Now that we know it's some sort of Solaris CD,
        # add an entry to the database
        rows = self.db.execute(
            "select * from rolls where"
            " name='%s' and Arch='%s' and OS='%s' and version='%s'" %
            (prod_name, arch, roll_os, prod_vers))
        if rows:
            pass
        else:
            self.db.execute("insert into rolls (name, arch, os, version)"
                            " values ('%s','%s','%s', '%s')" %
                            (prod_name, arch, roll_os, prod_vers))

        # ... and now copy the CD over to the HDD.
        cwd = os.getcwd()
        os.chdir(cpio_src_dir)
        subprocess.call('find . -print | cpio -mpud %s' % cpio_dest_dir,
                        shell=True)
        os.chdir(cwd)
        return
Beispiel #4
0
	def copy_foreign_cd_sunos(self, clean):
		"""Copy a standard Solaris CD"""
		
		cmd = '/opt/rocks/bin/rocks report distro'
		for line in os.popen(cmd).readlines():
			 js_dir = line[:-1]

		js_dir = os.path.join(js_dir, 'jumpstart')

		# For now, hardcode the architecture, because we only support
		# one architecture. No others. This should really be obtained
		# from the database.
		arch = 'i386'
		roll_os = 'sunos'

		# Make sure it's a Solaris CD/DVD
		file = open(os.path.join(self.cdrom_mount, '.cdtoc'), 'r')
		for i in file.readlines():
			if i.startswith('#'):
				continue
			if i.startswith('PRODNAME'):
				prod_name = i.split('=')[1].strip()
			if i.startswith('PRODVERS'):
				prod_vers = i.split('=')[1].strip()
		if not prod_name.startswith('Solaris'):
			print "Not Valid Solaris CD"
			return

		# If we've got this far, that means that we can continue
		# and copy the Solaris DVD.
		print prod_name, prod_vers
		roll_dir = os.path.join(js_dir, 'rolls', prod_name, prod_vers, arch)
		
		# Set the source and destination directories for cpio
		# These default to the CDROM for source and the roll directory
		# for destination
		cpio_src_dir = self.cdrom_mount
		cpio_dest_dir = roll_dir

		# If clean flag is specified, remove the roll directory
		if clean:
			if os.path.exists(roll_dir):
				str = 'Cleaning %s version %s ' % \
					(prod_name, prod_vers)
				str += 'for %s from Rolls directory' % arch
				print str
				self.clean_dir(roll_dir)

			os.makedirs(roll_dir)

		# If it's the companion DVD, the filesystem layout is a 
		# tad bit different. Treat it as such, and set cpio source
		# and destination directories appropriately.
		if prod_name == 'Solaris_Software_Companion':
			cpio_src_dir = os.path.join(self.cdrom_mount, 
					'Solaris_Software_Companion',
					'Solaris_%s' % arch, 'Packages')
			cpio_dest_dir = os.path.join(roll_dir, 'Solaris_10','Product')
			
		if not os.path.exists(cpio_dest_dir):
			os.makedirs(cpio_dest_dir)

		# Now that we know it's some sort of Solaris CD,
		# add an entry to the database
		rows = self.db.execute(
				"select * from rolls where"
				" name='%s' and Arch='%s' and OS='%s' and version='%s'"
				% (prod_name, arch, roll_os, prod_vers))
		if rows:
			pass
		else:
			self.db.execute("insert into rolls (name, arch, os, version)"
					" values ('%s','%s','%s', '%s')" %
					(prod_name, arch, roll_os, prod_vers))

		# ... and now copy the CD over to the HDD.
		cwd = os.getcwd()
		os.chdir(cpio_src_dir)
		subprocess.call('find . -print | cpio -mpud %s' % cpio_dest_dir, shell=True)
		os.chdir(cwd)
		return
Beispiel #5
0
#


import os
import rocks.file
import rocks.util

tree = rocks.file.Tree(os.getcwd())

builtfiles = tree.getFiles(os.path.join('RPMS', 'noarch'))
builtfiles += tree.getFiles(os.path.join('RPMS', rocks.util.getNativeArch()))

manifest = []

file = open('manifest', 'r')
for line in file.readlines():
	l = line.strip()
	if len(l) == 0 or (len(l) > 0 and l[0] == '#'):
		continue

	manifest.append(l)

notmanifest = []

for rpm in builtfiles:
	try:
		pkg = rpm.getPackageName()
		if pkg in manifest:
			manifest.remove(pkg)
		else:
			notmanifest.append(pkg)
#
#

import os
import rocks.file
import rocks.util

tree = rocks.file.Tree(os.getcwd())

builtfiles = tree.getFiles(os.path.join('RPMS', 'noarch'))
builtfiles += tree.getFiles(os.path.join('RPMS', rocks.util.getNativeArch()))

manifest = []

file = open('manifest', 'r')
for line in file.readlines():
    l = line.strip()
    if len(l) == 0 or (len(l) > 0 and l[0] == '#'):
        continue

    manifest.append(l)

notmanifest = []

for rpm in builtfiles:
    try:
        pkg = rpm.getPackageName()
        if pkg in manifest:
            manifest.remove(pkg)
        else:
            notmanifest.append(pkg)