commit:     12f2040646c17c2145b0685deeed2e46e582f964
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 15 16:33:29 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Sep  1 05:54:11 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=12f20406

DeComp bug fixes

 catalyst/base/genbase.py     |  2 +-
 catalyst/base/stagebase.py   |  8 ++++++--
 catalyst/main.py             |  5 +++--
 catalyst/targets/snapshot.py | 34 +++++++++++++++++++++++++---------
 4 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index e818781..c05b36d 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -24,7 +24,7 @@ class GenBase(object):
                                        array=keys.keys()
                                        array.sort()
                                for j in array:
-                                       contents = 
contents_map.generate_contents(file, j,
+                                       contents = contents_map.contents(file, 
j,
                                                verbose="VERBOSE" in 
self.settings)
                                        if contents:
                                                myf.write(contents)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index e07e2c2..c23c8b7 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -10,7 +10,7 @@ from stat import ST_UID, ST_GID, ST_MODE
 # for convienience
 pjoin = os.path.join
 
-from decomp.compress import CompressMap
+from DeComp.compress import CompressMap
 
 from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
        PORT_LOGDIR_CLEAN)
@@ -36,7 +36,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                self.valid_values.extend(["version_stamp","target","subarch",\
                        
"rel_type","profile","snapshot","source_subpath","portage_confdir",\
                        
"cflags","cxxflags","ldflags","cbuild","hostuse","portage_overlay",\
-                       
"distcc_hosts","makeopts","pkgcache_path","kerncache_path"])
+                       
"distcc_hosts","makeopts","pkgcache_path","kerncache_path",
+                       "compression_mode", "decompression_mode"])
 
                self.set_valid_build_kernel_vars(addlargs)
                TargetBase.__init__(self, myspec, addlargs)
@@ -1342,6 +1343,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        # lists in arch/amd64.py and friends.  If we wanted 
self.settigs[var]
                        # of any depth, we should make this function recursive.
                        elif type(self.settings[x]) == types.DictType:
+                               if x in ["compress_definitions",
+                                       "decompress_definitions"]:
+                                       continue
                                self.env[varname] = 
string.join(self.settings[x].keys())
                                for y in self.settings[x].keys():
                                        varname2 = 
"clst_"+string.replace(y,"/","_")

diff --git a/catalyst/main.py b/catalyst/main.py
index 7e3b55e..dc9342b 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -13,11 +13,12 @@ import os.path
 
 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
 
-from decomp.compress import COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS
+from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
+       CONTENTS_DEFINITIONS)
+from DeComp.contents import ContentsMap
 
 import catalyst.config
 import catalyst.util
-from catalyst.contents import ContentsMap, CONTENTS_DEFINITIONS
 from catalyst.defaults import confdefaults, option_messages
 from catalyst.hash_utils import HashMap, HASH_DEFINITIONS
 from catalyst.lock import LockInUse

diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 1887110..ad96d37 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -6,18 +6,21 @@ import os
 import shutil
 from stat import ST_UID, ST_GID, ST_MODE
 
+from DeComp.compress import CompressMap
 
 from catalyst.support import normpath, cmd
 from catalyst.base.targetbase import TargetBase
 from catalyst.base.genbase import GenBase
 from catalyst.fileops import ensure_dirs
+
+
 class snapshot(TargetBase, GenBase):
        """
        Builder class for snapshots.
        """
        def __init__(self,myspec,addlargs):
                self.required_values=["version_stamp","target"]
-               self.valid_values=["version_stamp","target"]
+               self.valid_values=["version_stamp","target", "compression_mode"]
 
                TargetBase.__init__(self, myspec, addlargs)
                GenBase.__init__(self,myspec)
@@ -26,7 +29,7 @@ class snapshot(TargetBase, GenBase):
                st=self.settings["storedir"]
                self.settings["snapshot_path"] = normpath(st + "/snapshots/"
                        + self.settings["snapshot_name"]
-                       + self.settings["version_stamp"] + ".tar.bz2")
+                       + self.settings["version_stamp"])
                
self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
 
        def setup(self):
@@ -51,18 +54,31 @@ class snapshot(TargetBase, GenBase):
                mytmp=self.settings["tmp_path"]
                ensure_dirs(mytmp)
 
+               target_snapshot = self.settings["portdir"] + "/ " + mytmp + 
"/%s/" % self.settings["repo_name"]
                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"],
+                       target_snapshot,
                        "Snapshot failure", env=self.env)
 
                print "Compressing Portage snapshot tarball..."
-               cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " 
-C " +
-                       mytmp + " " + self.settings["repo_name"],
-                       "Snapshot creation failure",env=self.env)
-
-               self.gen_contents_file(self.settings["snapshot_path"])
-               self.gen_digest_file(self.settings["snapshot_path"])
+               compressor = CompressMap(self.settings["compress_definitions"],
+                       env=self.env, 
default_mode=self.settings['compression_mode'])
+               infodict = compressor.create_infodict(
+                       source=self.settings["repo_name"],
+                       destination=self.settings["snapshot_path"],
+                       basedir=mytmp,
+                       filename=self.settings["snapshot_path"],
+                       mode=self.settings["compression_mode"],
+                       auto_extension=True
+                       )
+               if not compressor.compress(infodict):
+                       print("Snapshot compression failure")
+               else:
+                       filename = '.'.join([self.settings["snapshot_path"],
+                               
compressor.extension(self.settings["compression_mode"])])
+                       print("COMPRESSOR success!!!! filename", filename)
+                       self.gen_contents_file(filename)
+                       self.gen_digest_file(filename)
 
                self.cleanup()
                print "snapshot: complete!"

Reply via email to