1 |
commit: 12f2040646c17c2145b0685deeed2e46e582f964 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jun 15 16:33:29 2015 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 1 05:54:11 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=12f20406 |
7 |
|
8 |
DeComp bug fixes |
9 |
|
10 |
catalyst/base/genbase.py | 2 +- |
11 |
catalyst/base/stagebase.py | 8 ++++++-- |
12 |
catalyst/main.py | 5 +++-- |
13 |
catalyst/targets/snapshot.py | 34 +++++++++++++++++++++++++--------- |
14 |
4 files changed, 35 insertions(+), 14 deletions(-) |
15 |
|
16 |
diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py |
17 |
index e818781..c05b36d 100644 |
18 |
--- a/catalyst/base/genbase.py |
19 |
+++ b/catalyst/base/genbase.py |
20 |
@@ -24,7 +24,7 @@ class GenBase(object): |
21 |
array=keys.keys() |
22 |
array.sort() |
23 |
for j in array: |
24 |
- contents = contents_map.generate_contents(file, j, |
25 |
+ contents = contents_map.contents(file, j, |
26 |
verbose="VERBOSE" in self.settings) |
27 |
if contents: |
28 |
myf.write(contents) |
29 |
|
30 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
31 |
index e07e2c2..c23c8b7 100644 |
32 |
--- a/catalyst/base/stagebase.py |
33 |
+++ b/catalyst/base/stagebase.py |
34 |
@@ -10,7 +10,7 @@ from stat import ST_UID, ST_GID, ST_MODE |
35 |
# for convienience |
36 |
pjoin = os.path.join |
37 |
|
38 |
-from decomp.compress import CompressMap |
39 |
+from DeComp.compress import CompressMap |
40 |
|
41 |
from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS, |
42 |
PORT_LOGDIR_CLEAN) |
43 |
@@ -36,7 +36,8 @@ class StageBase(TargetBase, ClearBase, GenBase): |
44 |
self.valid_values.extend(["version_stamp","target","subarch",\ |
45 |
"rel_type","profile","snapshot","source_subpath","portage_confdir",\ |
46 |
"cflags","cxxflags","ldflags","cbuild","hostuse","portage_overlay",\ |
47 |
- "distcc_hosts","makeopts","pkgcache_path","kerncache_path"]) |
48 |
+ "distcc_hosts","makeopts","pkgcache_path","kerncache_path", |
49 |
+ "compression_mode", "decompression_mode"]) |
50 |
|
51 |
self.set_valid_build_kernel_vars(addlargs) |
52 |
TargetBase.__init__(self, myspec, addlargs) |
53 |
@@ -1342,6 +1343,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
54 |
# lists in arch/amd64.py and friends. If we wanted self.settigs[var] |
55 |
# of any depth, we should make this function recursive. |
56 |
elif type(self.settings[x]) == types.DictType: |
57 |
+ if x in ["compress_definitions", |
58 |
+ "decompress_definitions"]: |
59 |
+ continue |
60 |
self.env[varname] = string.join(self.settings[x].keys()) |
61 |
for y in self.settings[x].keys(): |
62 |
varname2 = "clst_"+string.replace(y,"/","_") |
63 |
|
64 |
diff --git a/catalyst/main.py b/catalyst/main.py |
65 |
index 7e3b55e..dc9342b 100644 |
66 |
--- a/catalyst/main.py |
67 |
+++ b/catalyst/main.py |
68 |
@@ -13,11 +13,12 @@ import os.path |
69 |
|
70 |
__selfpath__ = os.path.abspath(os.path.dirname(__file__)) |
71 |
|
72 |
-from decomp.compress import COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS |
73 |
+from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, |
74 |
+ CONTENTS_DEFINITIONS) |
75 |
+from DeComp.contents import ContentsMap |
76 |
|
77 |
import catalyst.config |
78 |
import catalyst.util |
79 |
-from catalyst.contents import ContentsMap, CONTENTS_DEFINITIONS |
80 |
from catalyst.defaults import confdefaults, option_messages |
81 |
from catalyst.hash_utils import HashMap, HASH_DEFINITIONS |
82 |
from catalyst.lock import LockInUse |
83 |
|
84 |
diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py |
85 |
index 1887110..ad96d37 100644 |
86 |
--- a/catalyst/targets/snapshot.py |
87 |
+++ b/catalyst/targets/snapshot.py |
88 |
@@ -6,18 +6,21 @@ import os |
89 |
import shutil |
90 |
from stat import ST_UID, ST_GID, ST_MODE |
91 |
|
92 |
+from DeComp.compress import CompressMap |
93 |
|
94 |
from catalyst.support import normpath, cmd |
95 |
from catalyst.base.targetbase import TargetBase |
96 |
from catalyst.base.genbase import GenBase |
97 |
from catalyst.fileops import ensure_dirs |
98 |
+ |
99 |
+ |
100 |
class snapshot(TargetBase, GenBase): |
101 |
""" |
102 |
Builder class for snapshots. |
103 |
""" |
104 |
def __init__(self,myspec,addlargs): |
105 |
self.required_values=["version_stamp","target"] |
106 |
- self.valid_values=["version_stamp","target"] |
107 |
+ self.valid_values=["version_stamp","target", "compression_mode"] |
108 |
|
109 |
TargetBase.__init__(self, myspec, addlargs) |
110 |
GenBase.__init__(self,myspec) |
111 |
@@ -26,7 +29,7 @@ class snapshot(TargetBase, GenBase): |
112 |
st=self.settings["storedir"] |
113 |
self.settings["snapshot_path"] = normpath(st + "/snapshots/" |
114 |
+ self.settings["snapshot_name"] |
115 |
- + self.settings["version_stamp"] + ".tar.bz2") |
116 |
+ + self.settings["version_stamp"]) |
117 |
self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"]) |
118 |
|
119 |
def setup(self): |
120 |
@@ -51,18 +54,31 @@ class snapshot(TargetBase, GenBase): |
121 |
mytmp=self.settings["tmp_path"] |
122 |
ensure_dirs(mytmp) |
123 |
|
124 |
+ target_snapshot = self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"] |
125 |
cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " + |
126 |
"--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* " + |
127 |
- self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"], |
128 |
+ target_snapshot, |
129 |
"Snapshot failure", env=self.env) |
130 |
|
131 |
print "Compressing Portage snapshot tarball..." |
132 |
- cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " + |
133 |
- mytmp + " " + self.settings["repo_name"], |
134 |
- "Snapshot creation failure",env=self.env) |
135 |
- |
136 |
- self.gen_contents_file(self.settings["snapshot_path"]) |
137 |
- self.gen_digest_file(self.settings["snapshot_path"]) |
138 |
+ compressor = CompressMap(self.settings["compress_definitions"], |
139 |
+ env=self.env, default_mode=self.settings['compression_mode']) |
140 |
+ infodict = compressor.create_infodict( |
141 |
+ source=self.settings["repo_name"], |
142 |
+ destination=self.settings["snapshot_path"], |
143 |
+ basedir=mytmp, |
144 |
+ filename=self.settings["snapshot_path"], |
145 |
+ mode=self.settings["compression_mode"], |
146 |
+ auto_extension=True |
147 |
+ ) |
148 |
+ if not compressor.compress(infodict): |
149 |
+ print("Snapshot compression failure") |
150 |
+ else: |
151 |
+ filename = '.'.join([self.settings["snapshot_path"], |
152 |
+ compressor.extension(self.settings["compression_mode"])]) |
153 |
+ print("COMPRESSOR success!!!! filename", filename) |
154 |
+ self.gen_contents_file(filename) |
155 |
+ self.gen_digest_file(filename) |
156 |
|
157 |
self.cleanup() |
158 |
print "snapshot: complete!" |