Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 274337
Collapse All | Expand All

(-)catalyst (+4 lines)
Lines 136-141 Link Here
136
		print "Snapshot cache support enabled."
136
		print "Snapshot cache support enabled."
137
		conf_values["SNAPCACHE"]="1"
137
		conf_values["SNAPCACHE"]="1"
138
138
139
	if "snapsquash" in string.split(conf_values["options"]):
140
		print "Snapshot squashfs support enabled."
141
		conf_values["SNAPSQUASH"]="1"
142
139
	if "metadata_overlay" in conf_values["options"].split():
143
	if "metadata_overlay" in conf_values["options"].split():
140
		print "Use of metadata_overlay module for portage enabled."
144
		print "Use of metadata_overlay module for portage enabled."
141
		conf_values["METADATA_OVERLAY"]="1"
145
		conf_values["METADATA_OVERLAY"]="1"
(-)modules/generic_stage_target.py (-3 / +19 lines)
Lines 425-432 Link Here
425
			"/root/*","/usr/portage"]
425
			"/root/*","/usr/portage"]
426
426
427
	def set_snapshot_path(self):
427
	def set_snapshot_path(self):
428
		self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
428
		if self.settings.has_key("SNAPSQUASH"):
429
			"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
429
			self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
430
				"/snapshots/portage-"+self.settings["snapshot"]+".squashfs")
431
		else:
432
			self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
433
				"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
430
434
431
		if os.path.exists(self.settings["snapshot_path"]):
435
		if os.path.exists(self.settings["snapshot_path"]):
432
			self.settings["snapshot_path_hash"]=\
436
			self.settings["snapshot_path_hash"]=\
Lines 804-809 Link Here
804
			if self.settings["snapshot_path_hash"]==snapshot_cache_hash:
808
			if self.settings["snapshot_path_hash"]==snapshot_cache_hash:
805
				print "Valid snapshot cache, skipping unpack of portage tree..."
809
				print "Valid snapshot cache, skipping unpack of portage tree..."
806
				unpack=False
810
				unpack=False
811
		elif self.settings.has_key("SNAPSQUASH"):
812
			destdir=normpath(self.settings["chroot_path"]+"/usr/portage")
813
			unpack_cmd="mount "+self.settings["snapshot_path"]+" "+\
814
			    destdir+" -o loop -t squashfs"
815
			unpack_errmsg="Error mounting snapshot"
816
			cleanup_errmsg="Error removing existing snapshot directory."
817
			cleanup_msg=\
818
				"Cleaning up existing portage tree (This can take a long time)..."
807
		else:
819
		else:
808
			destdir=normpath(self.settings["chroot_path"]+"/usr/portage")
820
			destdir=normpath(self.settings["chroot_path"]+"/usr/portage")
809
			cleanup_errmsg="Error removing existing snapshot directory."
821
			cleanup_errmsg="Error removing existing snapshot directory."
Lines 1120-1128 Link Here
1120
			print "Resume point detected, skipping clean operation..."
1132
			print "Resume point detected, skipping clean operation..."
1121
		else:
1133
		else:
1122
			for x in self.settings["cleanables"]: 
1134
			for x in self.settings["cleanables"]: 
1135
				if self.settings.has_key("SNAPSQUASH") and x == "/usr/portage":
1136
					print "Unmounting chroot: "+x+"... "
1137
					cmd("umount "+self.settings["chroot_path"]+x,"Couldn't unmount "+\
1138
						    x,env=self.env)
1123
				print "Cleaning chroot: "+x+"... "
1139
				print "Cleaning chroot: "+x+"... "
1124
				cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+\
1140
				cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+\
1125
					x,env=self.env)
1141
					    x,env=self.env)
1126
1142
1127
		""" Put /etc/hosts back into place """
1143
		""" Put /etc/hosts back into place """
1128
		if os.path.exists(self.settings["chroot_path"]+"/etc/hosts.catalyst"):
1144
		if os.path.exists(self.settings["chroot_path"]+"/etc/hosts.catalyst"):
(-)modules/snapshot_target.py (-8 / +16 lines)
Lines 16-23 Link Here
16
		self.settings=myspec
16
		self.settings=myspec
17
		self.settings["target_subpath"]="portage"
17
		self.settings["target_subpath"]="portage"
18
		st=self.settings["storedir"]
18
		st=self.settings["storedir"]
19
		self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\
19
		if self.settings.has_key("SNAPSQUASH"):
20
			+".tar.bz2")
20
			self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]+".squashfs")
21
		else:
22
			self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]+".tar.bz2")
21
		self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
23
		self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
22
		if self.settings.has_key("portdir_overlay"):
24
		if self.settings.has_key("portdir_overlay"):
23
			print "\nWarning!!!!"
25
			print "\nWarning!!!!"
Lines 44-56 Link Here
44
		if not os.path.exists(mytmp):
46
		if not os.path.exists(mytmp):
45
			os.makedirs(mytmp)
47
			os.makedirs(mytmp)
46
		
48
		
47
		cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
49
		if self.settings.has_key("SNAPSQUASH"):
48
			self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
50
			print "Building Portage snapshot squashfs..."
51
			cmd("mksquashfs "+self.settings["portdir"]+"/ "+\
52
				    self.settings["snapshot_path"]+\
53
				    " -wildcards -noappend -e packages/* -e distfiles/* -e local/* -e CVS/ *-e .svn",\
54
				    "Snapshot creation failure",env=self.env)
55
		else:
56
			cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
57
				    self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
49
		
58
		
50
		print "Compressing Portage snapshot tarball..."
59
			print "Compressing Portage snapshot tarball..."
51
		cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
60
			cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
52
			"Snapshot creation failure",env=self.env)
61
				    "Snapshot creation failure",env=self.env)
53
		
54
		self.gen_contents_file(self.settings["snapshot_path"])
62
		self.gen_contents_file(self.settings["snapshot_path"])
55
		self.gen_digest_file(self.settings["snapshot_path"])
63
		self.gen_digest_file(self.settings["snapshot_path"])
56
64
(-)modules/catalyst_support.py (+4 lines)
Lines 65-70 Link Here
65
def generate_contents(file,contents_function="auto",verbose=False):
65
def generate_contents(file,contents_function="auto",verbose=False):
66
	try:
66
	try:
67
		_ = contents_function
67
		_ = contents_function
68
		if _ == 'auto' and file.endswith('.squashfs'):
69
			_ = 'squashfs-l'
68
		if _ == 'auto' and file.endswith('.iso'):
70
		if _ == 'auto' and file.endswith('.iso'):
69
			_ = 'isoinfo-l'
71
			_ = 'isoinfo-l'
70
		if (_ in ['tar-tv','auto']):
72
		if (_ in ['tar-tv','auto']):
Lines 109-114 Link Here
109
	"tar-tv":[calc_contents,"tar tvf %(file)s"],
111
	"tar-tv":[calc_contents,"tar tvf %(file)s"],
110
	"tar-tvz":[calc_contents,"tar tvzf %(file)s"],
112
	"tar-tvz":[calc_contents,"tar tvzf %(file)s"],
111
	"tar-tvj":[calc_contents,"tar tvjf %(file)s"],
113
	"tar-tvj":[calc_contents,"tar tvjf %(file)s"],
114
	"squashfs-l":[calc_contents,"/usr/bin/unsquashfs -ll -d portage %(file)s | awk 'NR > 3 {print $0}'"],
112
	"isoinfo-l":[calc_contents,"isoinfo -l -i %(file)s"],
115
	"isoinfo-l":[calc_contents,"isoinfo -l -i %(file)s"],
113
	# isoinfo-f should be a last resort only
116
	# isoinfo-f should be a last resort only
114
	"isoinfo-f":[calc_contents,"isoinfo -f -i %(file)s"],
117
	"isoinfo-f":[calc_contents,"isoinfo -f -i %(file)s"],
Lines 216-221 Link Here
216
valid_config_file_values.append("VERBOSE")
219
valid_config_file_values.append("VERBOSE")
217
valid_config_file_values.append("PURGE")
220
valid_config_file_values.append("PURGE")
218
valid_config_file_values.append("SNAPCACHE")
221
valid_config_file_values.append("SNAPCACHE")
222
valid_config_file_values.append("SNAPSQUASH")
219
valid_config_file_values.append("snapshot_cache")
223
valid_config_file_values.append("snapshot_cache")
220
valid_config_file_values.append("hash_function")
224
valid_config_file_values.append("hash_function")
221
valid_config_file_values.append("digests")
225
valid_config_file_values.append("digests")

Return to bug 274337