View | Details | Raw Unified
Collapse All | Expand All

(-) modules/stage3_target.py (-7 / +7 lines)
 Lines 12-24    Link Here 
		self.valid_values=[]
		self.valid_values=[]
		generic_stage_target.__init__(self,spec,addlargs)
		generic_stage_target.__init__(self,spec,addlargs)
        def set_portage_overlay(self):
	def set_portage_overlay(self):
			generic_stage_target.set_portage_overlay(self)
		generic_stage_target.set_portage_overlay(self)
			if self.settings.has_key("portage_overlay"):
		if self.settings.has_key("portage_overlay"):
				print "\nWARNING !!!!!"
			print "\nWARNING !!!!!"
				print "\tUsing an overlay for earlier stages could cause build issues."
			print "\tUsing an overlay for earlier stages could cause build issues."
				print "\tIf you break it, you buy it. Don't complain to us about it."
			print "\tIf you break it, you buy it. Don't complain to us about it."
				print "\tDont say we did not warn you\n"
			print "\tDont say we did not warn you\n"
def register(foo):
def register(foo):
	foo.update({"stage3":stage3_target})
	foo.update({"stage3":stage3_target})
(-) modules/grp_target.py (-12 / +12 lines)
 Lines 32-49    Link Here 
		generic_stage_target.__init__(self,spec,addlargs)
		generic_stage_target.__init__(self,spec,addlargs)
	def set_target_path(self):
	def set_target_path(self):
                self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
                if self.settings.has_key("AUTORESUME") \
		if self.settings.has_key("AUTORESUME") \
                        and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
			and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
                                print "Resume point detected, skipping target path setup operation..."
			print "Resume point detected, skipping target path setup operation..."
                else:
		else:
                        # first clean up any existing target stuff
			# first clean up any existing target stuff
                        #if os.path.isdir(self.settings["target_path"]):
			#if os.path.isdir(self.settings["target_path"]):
                                #cmd("rm -rf "+self.settings["target_path"],
				#cmd("rm -rf "+self.settings["target_path"],
                                #"Could not remove existing directory: "+self.settings["target_path"],env=self.env)
				#"Could not remove existing directory: "+self.settings["target_path"],env=self.env)
                        if not os.path.exists(self.settings["target_path"]):
			if not os.path.exists(self.settings["target_path"]):
                                os.makedirs(self.settings["target_path"])
				os.makedirs(self.settings["target_path"])
                        
			touch(self.settings["autoresume_path"]+"setup_target_path")
			touch(self.settings["autoresume_path"]+"setup_target_path")
	def run_local(self):
	def run_local(self):
(-) modules/embedded_target.py (-17 / +17 lines)
 Lines 16-47    Link Here 
class embedded_target(generic_stage_target):
class embedded_target(generic_stage_target):
    def __init__(self,spec,addlargs):
	def __init__(self,spec,addlargs):
        self.required_values=[]
		self.required_values=[]
        self.valid_values=[]
		self.valid_values=[]
        self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/fs-type","embedded/runscript","boot/kernel","embedded/linuxrc"])
		self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/fs-type","embedded/runscript","boot/kernel","embedded/linuxrc"])
	self.valid_values.extend(["embedded/use"])
		self.valid_values.extend(["embedded/use"])
        if addlargs.has_key("embedded/fs-type"):
		if addlargs.has_key("embedded/fs-type"):
            self.valid_values.append("embedded/fs-ops")
			self.valid_values.append("embedded/fs-ops")
	generic_stage_target.__init__(self,spec,addlargs)
		generic_stage_target.__init__(self,spec,addlargs)
	self.set_build_kernel_vars(addlargs)
		self.set_build_kernel_vars(addlargs)
    def set_action_sequence(self):
	def set_action_sequence(self):
	self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
		self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
					"config_profile_link","setup_confdir",\
					"config_profile_link","setup_confdir",\
					"portage_overlay","bind","chroot_setup",\
					"portage_overlay","bind","chroot_setup",\
					"setup_environment","build_kernel","build_packages",\
					"setup_environment","build_kernel","build_packages",\
					"bootloader","root_overlay","fsscript","unmerge",\
					"bootloader","root_overlay","fsscript","unmerge",\
					"unbind","remove","empty","clean","capture","clear_autoresume"]
					"unbind","remove","empty","clean","capture","clear_autoresume"]
    def set_stage_path(self):
	def set_stage_path(self):
        self.settings["stage_path"]=normpath(self.settings["chroot_path"]+"/tmp/mergeroot")
		self.settings["stage_path"]=normpath(self.settings["chroot_path"]+"/tmp/mergeroot")
	print "embedded stage path is "+self.settings["stage_path"]
		print "embedded stage path is "+self.settings["stage_path"]
    def set_root_path(self):
	def set_root_path(self):
        self.settings["root_path"]=normpath("/tmp/mergeroot")
		self.settings["root_path"]=normpath("/tmp/mergeroot")
	print "embedded root path is "+self.settings["root_path"]
		print "embedded root path is "+self.settings["root_path"]
def register(foo):
def register(foo):
	foo.update({"embedded":embedded_target})
	foo.update({"embedded":embedded_target})
(-) modules/tinderbox_target.py (-10 / +10 lines)
 Lines 26-46    Link Here 
			raise CatalystError,"Tinderbox aborting due to error."
			raise CatalystError,"Tinderbox aborting due to error."
	def set_pkgcache_path(self):
	def set_pkgcache_path(self):
            if self.settings.has_key("pkgcache_path"):
		if self.settings.has_key("pkgcache_path"):
                if type(self.settings["pkgcache_path"]) != types.StringType:
			if type(self.settings["pkgcache_path"]) != types.StringType:
                    self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
            else:
			else:
                generic_stage_target.set_pkgcache_path(self)
				generic_stage_target.set_pkgcache_path(self)
	
	
	def set_cleanables(self):
	def set_cleanables(self):
	    self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
	    self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
					"/usr/portage"]
					"/usr/portage"]
	def set_action_sequence(self):
	def set_action_sequence(self):
                #Default action sequence for run method
		#Default action sequence for run method
                self.settings["action_sequence"]=["unpack","unpack_snapshot",\
		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
                                "config_profile_link","setup_confdir","bind","chroot_setup",\
		              "config_profile_link","setup_confdir","bind","chroot_setup",\
                                "setup_environment","run_local","preclean","unbind","clean",\
		              "setup_environment","run_local","preclean","unbind","clean",\
				"clear_autoresume"]
		              "clear_autoresume"]
	
	
def register(foo):
def register(foo):
	foo.update({"tinderbox":tinderbox_target})
	foo.update({"tinderbox":tinderbox_target})
(-) modules/generic_stage_target.py (-2 / +2 lines)
 Lines 263-270    Link Here 
			# first clean up any existing target stuff
			# first clean up any existing target stuff
			if os.path.isfile(self.settings["target_path"]):
			if os.path.isfile(self.settings["target_path"]):
				cmd("rm -f "+self.settings["target_path"], \
				cmd("rm -f "+self.settings["target_path"], \
					"Could not remove existing file: "+self.settings["target_path"],env=self.env)
				"Could not remove existing file: "+self.settings["target_path"],env=self.env)
		    		touch(self.settings["autoresume_path"]+"setup_target_path")
				touch(self.settings["autoresume_path"]+"setup_target_path")
		
		
			if not os.path.exists(self.settings["storedir"]+"/builds/"):
			if not os.path.exists(self.settings["storedir"]+"/builds/"):
				os.makedirs(self.settings["storedir"]+"/builds/")
				os.makedirs(self.settings["storedir"]+"/builds/")
(-) modules/catalyst_support.py (-6 / +6 lines)
 Lines 54-65    Link Here 
# a function to turn a string of non-printable characters into a string of
# a function to turn a string of non-printable characters into a string of
# hex characters
# hex characters
def hexify(str):
def hexify(str):
    hexStr = string.hexdigits
	hexStr = string.hexdigits
    r = ''
	r = ''
    for ch in str:
	for ch in str:
	i = ord(ch)
		i = ord(ch)
	r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
		r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
    return r
	return r
# hexify()
# hexify()
def generate_hash(file,hash_function="crc32",verbose=False):
def generate_hash(file,hash_function="crc32",verbose=False):
(-) modules/livecd_stage1_target.py (-2 / +2 lines)
 Lines 56-65    Link Here 
		self.settings[self.settings["spec_prefix"]+"/packages"].append("app-misc/livecd-tools")
		self.settings[self.settings["spec_prefix"]+"/packages"].append("app-misc/livecd-tools")
	def set_pkgcache_path(self):
	def set_pkgcache_path(self):
	    if self.settings.has_key("pkgcache_path"):
		if self.settings.has_key("pkgcache_path"):
			if type(self.settings["pkgcache_path"]) != types.StringType:
			if type(self.settings["pkgcache_path"]) != types.StringType:
				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
				self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
	    else:
		else:
			generic_stage_target.set_pkgcache_path(self)
			generic_stage_target.set_pkgcache_path(self)
def register(foo):
def register(foo):
(-) modules/livecd_stage2_target.py (-40 / +39 lines)
 Lines 71-130    Link Here 
			myf.close()
			myf.close()
	
	
	def unpack(self):
	def unpack(self):
                unpack=True
		unpack=True
		display_msg=None
		display_msg=None
                clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+"unpack")
		clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+"unpack")
                if os.path.isdir(self.settings["source_path"]):
		if os.path.isdir(self.settings["source_path"]):
                        unpack_cmd="rsync -a --delete "+self.settings["source_path"]+" "+self.settings["chroot_path"]
			unpack_cmd="rsync -a --delete "+self.settings["source_path"]+" "+self.settings["chroot_path"]
                        display_msg="\nStarting rsync from "+self.settings["source_path"]+"\nto "+\
			display_msg="\nStarting rsync from "+self.settings["source_path"]+"\nto "+\
                                self.settings["chroot_path"]+" (This may take some time) ...\n"
				self.settings["chroot_path"]+" (This may take some time) ...\n"
                        error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
			error_msg="Rsync of "+self.settings["source_path"]+" to "+self.settings["chroot_path"]+" failed."
                        invalid_snapshot=False
			invalid_snapshot=False
                if self.settings.has_key("AUTORESUME"):
		if self.settings.has_key("AUTORESUME"):
                    if os.path.isdir(self.settings["source_path"]) and \
			if os.path.isdir(self.settings["source_path"]) and \
                            os.path.exists(self.settings["autoresume_path"]+"unpack"):
				os.path.exists(self.settings["autoresume_path"]+"unpack"):
                                print "Resume point detected, skipping unpack operation..."
				print "Resume point detected, skipping unpack operation..."
                                unpack=False
				unpack=False
                    elif self.settings.has_key("source_path_hash"):
			elif self.settings.has_key("source_path_hash"):
                        if self.settings["source_path_hash"] != clst_unpack_hash:
				if self.settings["source_path_hash"] != clst_unpack_hash:
                                invalid_snapshot=True
					invalid_snapshot=True
                if unpack:
		if unpack:
                        self.mount_safety_check()
			self.mount_safety_check()
                        if invalid_snapshot:
			if invalid_snapshot:
                                print "No Valid Resume point detected, cleaning up  ..."
				print "No Valid Resume point detected, cleaning up  ..."
                                #os.remove(self.settings["autoresume_path"]+"dir_setup")
				#os.remove(self.settings["autoresume_path"]+"dir_setup")
                                self.clear_autoresume()
				self.clear_autoresume()
                                self.clear_chroot()
				self.clear_chroot()
                                #self.dir_setup()
				#self.dir_setup()
                        if not os.path.exists(self.settings["chroot_path"]):
			if not os.path.exists(self.settings["chroot_path"]):
                                os.makedirs(self.settings["chroot_path"])
				os.makedirs(self.settings["chroot_path"])
                        if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
			if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
                                os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
				os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
                        if self.settings.has_key("PKGCACHE"):
			if self.settings.has_key("PKGCACHE"):
                                if not os.path.exists(self.settings["pkgcache_path"]):
				if not os.path.exists(self.settings["pkgcache_path"]):
                                        os.makedirs(self.settings["pkgcache_path"],0755)
					os.makedirs(self.settings["pkgcache_path"],0755)
			if not display_msg:
			if not display_msg:
				raise CatalystError,"Could not find appropriate source. Please check the 'source_subpath' setting in the spec file."
				raise CatalystError,"Could not find appropriate source. Please check the 'source_subpath' setting in the spec file."
                        print display_msg
			print display_msg
                        cmd(unpack_cmd,error_msg,env=self.env)
			cmd(unpack_cmd,error_msg,env=self.env)
                        if self.settings.has_key("source_path_hash"):
			if self.settings.has_key("source_path_hash"):
                                myf=open(self.settings["autoresume_path"]+"unpack","w")
				myf=open(self.settings["autoresume_path"]+"unpack","w")
                                myf.write(self.settings["source_path_hash"])
				myf.write(self.settings["source_path_hash"])
                                myf.close()
				myf.close()
                        else:
			else:
                                touch(self.settings["autoresume_path"]+"unpack")
				touch(self.settings["autoresume_path"]+"unpack")
	def set_action_sequence(self):
	def set_action_sequence(self):
		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
		self.settings["action_sequence"]=["unpack","unpack_snapshot",\
				"config_profile_link","setup_confdir","portage_overlay",\
				"config_profile_link","setup_confdir","portage_overlay",\