Esempio n. 1
0
	def __init__(self,myspec,addlargs):
		self.required_values=["version_stamp","target"]
		self.valid_values=["version_stamp","target", "compression_mode"]

		TargetBase.__init__(self, myspec, addlargs)
		GenBase.__init__(self,myspec)
		#self.settings=myspec
		self.settings["target_subpath"]="repos"
		st=self.settings["storedir"]
		self.settings["snapshot_path"] = normpath(st + "/snapshots/"
			+ self.settings["snapshot_name"]
			+ self.settings["version_stamp"])
		self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
Esempio n. 2
0
 def set_pkgcache_path(self):
     if "pkgcache_path" in self.settings:
         if type(self.settings["pkgcache_path"]) != types.StringType:
             self.settings["pkgcache_path"] = normpath(
                 string.join(self.settings["pkgcache_path"]))
     else:
         StageBase.set_pkgcache_path(self)
Esempio n. 3
0
 def set_pkgcache_path(self):
     if "pkgcache_path" in self.settings:
         if not isinstance(self.settings['pkgcache_path'], str):
             self.settings["pkgcache_path"] = normpath(
                 ' '.join(self.settings["pkgcache_path"]))
     else:
         StageBase.set_pkgcache_path(self)
Esempio n. 4
0
	def __init__(self,spec,addlargs):
		self.required_values=[
			"boot/kernel"
		]
		self.valid_values=self.required_values[:]
		self.valid_values.extend([
			"netboot2/packages",
			"netboot2/use",
			"netboot2/extra_files",
			"netboot2/overlay",
			"netboot2/busybox_config",
			"netboot2/root_overlay",
			"netboot2/linuxrc"
		])

		try:
			if "netboot2/packages" in addlargs:
				if isinstance(addlargs['netboot2/packages'], str):
					loopy=[addlargs["netboot2/packages"]]
				else:
					loopy=addlargs["netboot2/packages"]

				for x in loopy:
					self.valid_values.append("netboot2/packages/"+x+"/files")
		except:
			raise CatalystError("configuration error in netboot2/packages.")

		StageBase.__init__(self,spec,addlargs)
		self.settings["merge_path"]=normpath("/tmp/image/")
Esempio n. 5
0
	def set_source_path(self):
		if "seedcache" in self.settings["options"] and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")):
			self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")
		else:
			self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2")
			if os.path.isfile(self.settings["source_path"]):
				if os.path.exists(self.settings["source_path"]):
				# XXX: Is this even necessary if the previous check passes?
					self.settings["source_path_hash"] = \
						self.settings["hash_map"].generate_hash(
							self.settings["source_path"],\
							hash_=self.settings["hash_function"],
							verbose=False)
		print "Source path set to "+self.settings["source_path"]
		if os.path.isdir(self.settings["source_path"]):
			print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf"
			print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"].rstrip('/')+".tar.bz2\n")
Esempio n. 6
0
 def set_source_path(self):
     self.settings["source_path"] = normpath(
         self.settings["storedir"] + "/builds/" +
         self.settings["source_subpath"].rstrip('/') + ".tar.bz2")
     if os.path.isfile(self.settings["source_path"]):
         self.settings["source_path_hash"] = \
          self.settings["hash_map"].generate_hash(
           self.settings["source_path"])
     else:
         self.settings["source_path"] = normpath(
             self.settings["storedir"] + "/tmp/" +
             self.settings["source_subpath"] + '/')
     if not os.path.exists(self.settings["source_path"]):
         raise CatalystError("Source Path: " +
                             self.settings["source_path"] +
                             " does not exist.",
                             print_traceback=True)
Esempio n. 7
0
	def generate_digests(self):
		for pkgset in self.settings["grp"]:
			if self.settings["grp/"+pkgset+"/type"] == "pkgset":
				destdir=normpath(self.settings["target_path"]+"/"+pkgset+"/All")
				log.notice('Digesting files in the pkgset...')
				digests=glob.glob(destdir+'/*.DIGESTS')
				for i in digests:
					if os.path.exists(i):
						os.remove(i)

				files=os.listdir(destdir)
				#ignore files starting with '.' using list comprehension
				files=[filename for filename in files if filename[0] != '.']
				for i in files:
					if os.path.isfile(normpath(destdir+"/"+i)):
						self.gen_contents_file(normpath(destdir+"/"+i))
						self.gen_digest_file(normpath(destdir+"/"+i))
			else:
				destdir=normpath(self.settings["target_path"]+"/"+pkgset)
				log.notice('Digesting files in the srcset...')

				digests=glob.glob(destdir+'/*.DIGESTS')
				for i in digests:
					if os.path.exists(i):
						os.remove(i)

				files=os.listdir(destdir)
				#ignore files starting with '.' using list comprehension
				files=[filename for filename in files if filename[0] != '.']
				for i in files:
					if os.path.isfile(normpath(destdir+"/"+i)):
						#self.gen_contents_file(normpath(destdir+"/"+i))
						self.gen_digest_file(normpath(destdir+"/"+i))
Esempio n. 8
0
    def generate_digests(self):
        for pkgset in self.settings["grp"]:
            if self.settings["grp/" + pkgset + "/type"] == "pkgset":
                destdir = normpath(self.settings["target_path"] + "/" +
                                   pkgset + "/All")
                print "Digesting files in the pkgset....."
                digests = glob.glob(destdir + '/*.DIGESTS')
                for i in digests:
                    if os.path.exists(i):
                        os.remove(i)

                files = os.listdir(destdir)
                #ignore files starting with '.' using list comprehension
                files = [filename for filename in files if filename[0] != '.']
                for i in files:
                    if os.path.isfile(normpath(destdir + "/" + i)):
                        self.gen_contents_file(normpath(destdir + "/" + i))
                        self.gen_digest_file(normpath(destdir + "/" + i))
            else:
                destdir = normpath(self.settings["target_path"] + "/" + pkgset)
                print "Digesting files in the srcset....."

                digests = glob.glob(destdir + '/*.DIGESTS')
                for i in digests:
                    if os.path.exists(i):
                        os.remove(i)

                files = os.listdir(destdir)
                #ignore files starting with '.' using list comprehension
                files = [filename for filename in files if filename[0] != '.']
                for i in files:
                    if os.path.isfile(normpath(destdir + "/" + i)):
                        #self.gen_contents_file(normpath(destdir+"/"+i))
                        self.gen_digest_file(normpath(destdir + "/" + i))
Esempio n. 9
0
	def set_target_path(self):
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
			self.settings["target_subpath"])
		if "autoresume" in self.settings["options"] \
			and self.resume.is_enabled("setup_target_path"):
			log.notice('Resume point detected, skipping target path setup operation...')
		else:
			# first clean up any existing target stuff
			clear_path(self.settings['target_path'])
			self.resume.enable("setup_target_path")
		ensure_dirs(self.settings["storedir"]+"/builds/")
Esempio n. 10
0
    def __init__(self, spec, addlargs):
        if "netboot/packages" in addlargs:
            if isinstance(addlargs['netboot/packages'], str):
                loopy = [addlargs["netboot/packages"]]
            else:
                loopy = addlargs["netboot/packages"]

            for x in loopy:
                self.valid_values |= {"netboot/packages/" + x + "/files"}

        StageBase.__init__(self, spec, addlargs)
        self.settings["merge_path"] = normpath("/tmp/image/")
Esempio n. 11
0
    def set_lockdir(self, lockdir):
        if not os.path.exists(lockdir):
            os.makedirs(lockdir)
        if os.path.isdir(lockdir):
            if not self.islocked():
                if lockdir[-1] == "/":
                    lockdir = lockdir[:-1]
                self.lockdir = normpath(lockdir)
#				if "DEBUG" in self.settings:
#					print "setting lockdir to", self.lockdir
        else:
            raise "the lock object needs a path to a dir"
Esempio n. 12
0
	def set_target_path(self):
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+\
			self.settings["target_subpath"])
		if "autoresume" in self.settings["options"] \
			and self.resume.is_enabled("setup_target_path"):
			log.notice('Resume point detected, skipping target path setup operation...')
		else:
			# first clean up any existing target stuff
			if os.path.isfile(self.settings["target_path"]):
				cmd("rm -f "+self.settings["target_path"], \
					"Could not remove existing file: "+self.settings["target_path"],env=self.env)
				self.resume.enable("setup_target_path")
		ensure_dirs(self.settings["storedir"]+"/builds/")
Esempio n. 13
0
 def set_target_path(self):
     self.settings["target_path"] = normpath(
         self.settings["storedir"] + "/builds/" +
         self.settings["target_subpath"] + '/')
     if "autoresume" in self.settings["options"] \
      and self.resume.is_enabled("setup_target_path"):
         print "Resume point detected, skipping target path setup operation..."
     else:
         # first clean up any existing target stuff
         if os.path.exists(self.settings["target_path"]):
             cmd("rm -rf "+self.settings["target_path"],\
              "Could not remove existing directory: "+self.settings["target_path"],env=self.env)
             self.resume.enable("setup_target_path")
         ensure_dirs(self.settings["target_path"])
Esempio n. 14
0
    def __init__(self, spec, addlargs):
        try:
            if "netboot/packages" in addlargs:
                if isinstance(addlargs['netboot/packages'], str):
                    loopy = [addlargs["netboot/packages"]]
                else:
                    loopy = addlargs["netboot/packages"]

                for x in loopy:
                    self.valid_values |= {"netboot/packages/" + x + "/files"}
        except:
            raise CatalystError("configuration error in netboot/packages.")

        StageBase.__init__(self, spec, addlargs)
        self.settings["merge_path"] = normpath("/tmp/image/")
Esempio n. 15
0
 def run_local(self):
     # what modules do we want to blacklist?
     if "livecd/modblacklist" in self.settings:
         path = normpath(self.settings["chroot_path"] +
                         "/etc/modprobe.d/blacklist.conf")
         try:
             with open(path, "a") as myf:
                 myf.write("\n#Added by Catalyst:")
                 # workaround until config.py is using configparser
                 if isinstance(self.settings["livecd/modblacklist"], str):
                     self.settings["livecd/modblacklist"] = self.settings[
                         "livecd/modblacklist"].split()
                 for x in self.settings["livecd/modblacklist"]:
                     myf.write("\nblacklist " + x)
         except Exception as e:
             raise CatalystError("Couldn't open " +
                                 self.settings["chroot_path"] +
                                 "/etc/modprobe.d/blacklist.conf.",
                                 print_traceback=True) from e
Esempio n. 16
0
	def run_local(self):
		# what modules do we want to blacklist?
		if "livecd/modblacklist" in self.settings:
			path = normpath(self.settings["chroot_path"] +
							"/etc/modprobe.d/blacklist.conf")
			try:
				with open(path, "a") as myf:
					myf.write("\n#Added by Catalyst:")
					# workaround until config.py is using configparser
					if isinstance(self.settings["livecd/modblacklist"], str):
						self.settings["livecd/modblacklist"] = self.settings[
								"livecd/modblacklist"].split()
					for x in self.settings["livecd/modblacklist"]:
						myf.write("\nblacklist "+x)
			except:
				self.unbind()
				raise CatalystError("Couldn't open " +
					self.settings["chroot_path"] +
					"/etc/modprobe.d/blacklist.conf.",
					print_traceback=True)
Esempio n. 17
0
 def clean_stage1(self):
     '''seedcache is enabled, so salvage the /tmp/stage1root,
     remove the seed chroot'''
     log.notice('Salvaging the stage1root from the chroot path ...')
     # move the self.settings["stage_path"] outside of the self.settings["chroot_path"]
     tmp_path = normpath(self.settings["storedir"] + "/tmp/" + "stage1root")
     if move_path(self.settings["stage_path"], tmp_path):
         self.remove_chroot()
         # move it to self.settings["chroot_path"]
         if not move_path(tmp_path, self.settings["chroot_path"]):
             log.error(
                 'clean_stage1 failed, see previous log messages for details'
             )
             return False
         log.notice(
             'Successfully moved and cleaned the stage1root for the seedcache'
         )
         return True
     log.error(
         'clean_stage1 failed to move the stage1root to a temporary loation'
     )
     return False
Esempio n. 18
0
 def set_root_path(self):
     self.settings["root_path"] = normpath("/tmp/mergeroot")
     print "embedded root path is " + self.settings["root_path"]
Esempio n. 19
0
 def set_stage_path(self):
     self.settings["stage_path"] = normpath(self.settings["chroot_path"] +
                                            "/tmp/mergeroot")
     print "embedded stage path is " + self.settings["stage_path"]
Esempio n. 20
0
	def set_stage_path(self):
		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+"/tmp/mergeroot")
		log.info('embedded stage path is %s', self.settings['stage_path'])
Esempio n. 21
0
 def set_lockfile(self):
     if not self.islocked():
         self.lockfile = normpath(self.lockdir + '/' + self.lockfilename)
Esempio n. 22
0
	def set_pkgcache_path(self):
		if "pkgcache_path" in self.settings:
			if not isinstance(self.settings['pkgcache_path'], str):
				self.settings["pkgcache_path"] = normpath(' '.join(self.settings["pkgcache_path"]))
		else:
			StageBase.set_pkgcache_path(self)
Esempio n. 23
0
 def set_stage_path(self):
     self.settings["stage_path"] = normpath(self.settings["chroot_path"] +
                                            self.settings["root_path"])
     print "stage1 stage path is " + self.settings["stage_path"]
Esempio n. 24
0
 def set_root_path(self):
     # sets the root path, relative to 'chroot_path', of the stage1 root
     self.settings["root_path"] = normpath("/tmp/stage1root")
     print "stage1 root path is " + self.settings["root_path"]
Esempio n. 25
0
 def set_root_path(self):
     # sets the root path, relative to 'chroot_path', of the stage1 root
     self.settings["root_path"] = normpath("/tmp/stage1root")
     log.info('stage1 root path is %s', self.settings['root_path'])
Esempio n. 26
0
 def set_stage_path(self):
     self.settings["stage_path"] = normpath(self.settings["chroot_path"] +
                                            self.settings["root_path"])
     log.notice('stage1 stage path is %s', self.settings['stage_path'])
Esempio n. 27
0
 def set_root_path(self):
     # ROOT= variable for emerges
     self.settings["root_path"] = normpath("/tmp/image")
     log.info('netboot root path is %s', self.settings['root_path'])
Esempio n. 28
0
	def set_root_path(self):
		# sets the root path, relative to 'chroot_path', of the stage1 root
		self.settings["root_path"]=normpath("/tmp/stage1root")
		log.info('stage1 root path is %s', self.settings['root_path'])
Esempio n. 29
0
 def set_root_path(self):
     # ROOT= variable for emerges
     self.settings["root_path"] = normpath("/tmp/image")
     print "netboot root path is " + self.settings["root_path"]
Esempio n. 30
0
 def set_stage_path(self):
     self.settings["stage_path"] = normpath(self.settings["chroot_path"] +
                                            "/tmp/mergeroot")
     log.info('embedded stage path is %s', self.settings['stage_path'])
Esempio n. 31
0
 def set_root_path(self):
     self.settings["root_path"] = normpath("/tmp/mergeroot")
     log.info('embedded root path is %s', self.settings['root_path'])
Esempio n. 32
0
	def set_root_path(self):
		# ROOT= variable for emerges
		self.settings["root_path"]=normpath("/tmp/image")
		log.info('netboot root path is %s', self.settings['root_path'])
Esempio n. 33
0
 def setup(self):
     x = normpath(self.settings["storedir"] + "/snapshots")
     ensure_dirs(x)
Esempio n. 34
0
	def set_root_path(self):
		self.settings["root_path"]=normpath("/tmp/mergeroot")
		log.info('embedded root path is %s', self.settings['root_path'])
Esempio n. 35
0
	def set_stage_path(self):
		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
		log.notice('stage1 stage path is %s', self.settings['stage_path'])
Esempio n. 36
0
	def setup(self):
		x=normpath(self.settings["storedir"]+"/snapshots")
		ensure_dirs(x)