3 Builder class for snapshots.
7 from catalyst_support import *
8 from generic_stage_target import *
10 class snapshot_target(generic_stage_target):
11 def __init__(self,myspec,addlargs):
12 self.required_values=["version_stamp","target"]
13 self.valid_values=["version_stamp","target","portdir_overlay"]
15 generic_target.__init__(self,myspec,addlargs)
17 self.settings["target_subpath"]="portage"
18 st=self.settings["storedir"]
19 self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\
21 self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
22 if self.settings.has_key("portdir_overlay"):
24 print "\tThis feature is deprecated no overlay will be added to the snapshot."
25 print "\tIf you need an overlay feature please use portage_overlay in the other spec files"
26 print "\tOtherwise add your files to the normal snapshot and redigest .. you should know what"
28 print "\tThis was removed due to digesting issues that are incompatible with portage."
31 x=normpath(self.settings["storedir"]+"/snapshots")
32 if not os.path.exists(x):
35 def mount_safety_check(self):
40 print "Creating Portage tree snapshot "+self.settings["version_stamp"]+\
41 " from "+self.settings["portdir"]+"..."
43 mytmp=self.settings["tmp_path"]
44 if not os.path.exists(mytmp):
47 cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
48 self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
50 print "Compressing Portage snapshot tarball..."
51 cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
52 "Snapshot creation failure",env=self.env)
54 self.gen_contents_file(self.settings["snapshot_path"])
55 self.gen_digest_file(self.settings["snapshot_path"])
58 print "snapshot: complete!"
60 def kill_chroot_pids(self):
64 print "Cleaning up..."
67 foo.update({"snapshot":snapshot_target})