Add more configured defaults
authorBrian Dolbec <dolsen@gentoo.org>
Tue, 8 Jan 2013 07:17:22 +0000 (23:17 -0800)
committerBrian Dolbec <dolsen@gentoo.org>
Wed, 27 Feb 2013 08:55:28 +0000 (00:55 -0800)
Use the new configured snapshot_name and portdir settings
Use the portdir setting rather than hard-coded path

catalyst
modules/generic_stage_target.py
modules/snapshot_target.py
modules/tinderbox_target.py

index c29c814f734c885886c88375e475e2e0559d4b40..0878ce4bb6dc8dd0b57e677cf25614e54587df25 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -61,11 +61,19 @@ def parse_config(myconfig):
        myconf={}
        config_file=""
 
-       confdefaults={ "storedir":"/var/tmp/catalyst",\
-               "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\
-               "portdir":"/usr/portage","options":"",\
-               "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
-               "hash_function":"crc32"}
+       confdefaults={
+               "storedir": "/var/tmp/catalyst",
+               "sharedir": "/usr/lib/catalyst",
+               "distdir": "/usr/portage/distfiles",
+               "repo_name": "portage",
+               "portdir": "/usr/portage",
+               "packagedir": "/usr/portage/packages",
+               "port_tmpdir": "/var/tmp/portage",
+               "options": "",
+               "snapshot_name": "portage-",
+               "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
+               "hash_function": "crc32",
+               }
 
        # first, try the one passed (presumably from the cmdline)
        if myconfig:
index 31cb025e6745a3858acacdf583d6df7dbaaf330c..c79f8ae014cf77eae58b385c576ba8b23f63141b 100644 (file)
@@ -410,7 +410,8 @@ class generic_stage_target(generic_target):
 
        def set_snapshot_path(self):
                self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
-                       "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
+                       "/snapshots/" + self.settings["snapshot_name"] +
+                       self.settings["snapshot"]+".tar.xz")
 
                if os.path.exists(self.settings["snapshot_path"]):
                        self.settings["snapshot_path_hash"]=\
@@ -418,7 +419,8 @@ class generic_stage_target(generic_target):
                                hash_function=self.settings["hash_function"],verbose=False)
                else:
                        self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
-                               "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
+                               "/snapshots/" + self.settings["snapshot_name"] +
+                               self.settings["snapshot"]+".tar.bz2")
 
                        if os.path.exists(self.settings["snapshot_path"]):
                                self.settings["snapshot_path_hash"]=\
index e93a86a5b375442ee4971704c071a95230059a6e..79c1f03fa7d75a232cb404680d5add2293f1e403 100644 (file)
@@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target):
                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")
+               self.settings["snapshot_path"]=normpath(st + "/snapshots/"
+                       + self.settings["snapshot_name"]
+                       + self.settings["version_stamp"] + ".tar.bz2")
                self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
 
        def setup(self):
@@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target):
                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)
+               cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " + \
+                       "--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
+                       self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"],
+                       "Snapshot failure",env=self.env)
 
                print "Compressing Portage snapshot tarball..."
-               cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
+               cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " +
+                       mytmp + " %s" % self.settings["repo_name"],
                        "Snapshot creation failure",env=self.env)
 
                self.gen_contents_file(self.settings["snapshot_path"])
index 46fe08299d44c41b749eba990256501da0840b4e..d6d3ea30a7a6998120335bab541c12936f33cc06 100644 (file)
@@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target):
                        raise CatalystError,"Tinderbox aborting due to error."
 
        def set_cleanables(self):
-           self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
-                                       "/usr/portage"]
+           self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
+                                       self.settings['portdir']]
 
        def set_action_sequence(self):
                #Default action sequence for run method