Index: catalyst =================================================================== --- catalyst (revision 1411) +++ catalyst (working copy) @@ -136,6 +136,10 @@ print "Snapshot cache support enabled." conf_values["SNAPCACHE"]="1" + if "snapsquash" in string.split(conf_values["options"]): + print "Snapshot squashfs support enabled." + conf_values["SNAPSQUASH"]="1" + if "metadata_overlay" in conf_values["options"].split(): print "Use of metadata_overlay module for portage enabled." conf_values["METADATA_OVERLAY"]="1" Index: modules/generic_stage_target.py =================================================================== --- modules/generic_stage_target.py (revision 1411) +++ modules/generic_stage_target.py (working copy) @@ -425,8 +425,12 @@ "/root/*","/usr/portage"] def set_snapshot_path(self): - self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2") + if self.settings.has_key("SNAPSQUASH"): + self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ + "/snapshots/portage-"+self.settings["snapshot"]+".squashfs") + else: + self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ + "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2") if os.path.exists(self.settings["snapshot_path"]): self.settings["snapshot_path_hash"]=\ @@ -804,6 +808,14 @@ if self.settings["snapshot_path_hash"]==snapshot_cache_hash: print "Valid snapshot cache, skipping unpack of portage tree..." unpack=False + elif self.settings.has_key("SNAPSQUASH"): + destdir=normpath(self.settings["chroot_path"]+"/usr/portage") + unpack_cmd="mount "+self.settings["snapshot_path"]+" "+\ + destdir+" -o loop -t squashfs" + unpack_errmsg="Error mounting snapshot" + cleanup_errmsg="Error removing existing snapshot directory." + cleanup_msg=\ + "Cleaning up existing portage tree (This can take a long time)..." else: destdir=normpath(self.settings["chroot_path"]+"/usr/portage") cleanup_errmsg="Error removing existing snapshot directory." @@ -1120,9 +1132,13 @@ print "Resume point detected, skipping clean operation..." else: for x in self.settings["cleanables"]: + if self.settings.has_key("SNAPSQUASH") and x == "/usr/portage": + print "Unmounting chroot: "+x+"... " + cmd("umount "+self.settings["chroot_path"]+x,"Couldn't unmount "+\ + x,env=self.env) print "Cleaning chroot: "+x+"... " cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+\ - x,env=self.env) + x,env=self.env) """ Put /etc/hosts back into place """ if os.path.exists(self.settings["chroot_path"]+"/etc/hosts.catalyst"): Index: modules/snapshot_target.py =================================================================== --- modules/snapshot_target.py (revision 1411) +++ modules/snapshot_target.py (working copy) @@ -16,8 +16,10 @@ self.settings=myspec self.settings["target_subpath"]="portage" st=self.settings["storedir"] - self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\ - +".tar.bz2") + if self.settings.has_key("SNAPSQUASH"): + self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]+".squashfs") + else: + self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]+".tar.bz2") self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"]) if self.settings.has_key("portdir_overlay"): print "\nWarning!!!!" @@ -44,13 +46,19 @@ if not os.path.exists(mytmp): os.makedirs(mytmp) - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\ - self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env) + if self.settings.has_key("SNAPSQUASH"): + print "Building Portage snapshot squashfs..." + cmd("mksquashfs "+self.settings["portdir"]+"/ "+\ + self.settings["snapshot_path"]+\ + " -wildcards -noappend -e packages/* -e distfiles/* -e local/* -e CVS/ *-e .svn",\ + "Snapshot creation failure",env=self.env) + else: + cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\ + self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env) - print "Compressing Portage snapshot tarball..." - cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\ - "Snapshot creation failure",env=self.env) - + print "Compressing Portage snapshot tarball..." + cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\ + "Snapshot creation failure",env=self.env) self.gen_contents_file(self.settings["snapshot_path"]) self.gen_digest_file(self.settings["snapshot_path"]) Index: modules/catalyst_support.py =================================================================== --- modules/catalyst_support.py (revision 1411) +++ modules/catalyst_support.py (working copy) @@ -65,6 +65,8 @@ def generate_contents(file,contents_function="auto",verbose=False): try: _ = contents_function + if _ == 'auto' and file.endswith('.squashfs'): + _ = 'squashfs-l' if _ == 'auto' and file.endswith('.iso'): _ = 'isoinfo-l' if (_ in ['tar-tv','auto']): @@ -109,6 +111,7 @@ "tar-tv":[calc_contents,"tar tvf %(file)s"], "tar-tvz":[calc_contents,"tar tvzf %(file)s"], "tar-tvj":[calc_contents,"tar tvjf %(file)s"], + "squashfs-l":[calc_contents,"/usr/bin/unsquashfs -ll -d portage %(file)s | awk 'NR > 3 {print $0}'"], "isoinfo-l":[calc_contents,"isoinfo -l -i %(file)s"], # isoinfo-f should be a last resort only "isoinfo-f":[calc_contents,"isoinfo -f -i %(file)s"], @@ -216,6 +219,7 @@ valid_config_file_values.append("VERBOSE") valid_config_file_values.append("PURGE") valid_config_file_values.append("SNAPCACHE") +valid_config_file_values.append("SNAPSQUASH") valid_config_file_values.append("snapshot_cache") valid_config_file_values.append("hash_function") valid_config_file_values.append("digests")