1 |
--- |
2 |
catalyst/targets/snapshot.py | 17 +++++++++-------- |
3 |
1 file changed, 9 insertions(+), 8 deletions(-) |
4 |
|
5 |
diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py |
6 |
index e1ca7b7..d19f4ef 100644 |
7 |
--- a/catalyst/targets/snapshot.py |
8 |
+++ b/catalyst/targets/snapshot.py |
9 |
@@ -8,6 +8,7 @@ from stat import ST_UID, ST_GID, ST_MODE |
10 |
|
11 |
from DeComp.compress import CompressMap |
12 |
|
13 |
+from catalyst import log |
14 |
from catalyst.support import normpath, cmd |
15 |
from catalyst.base.targetbase import TargetBase |
16 |
from catalyst.base.genbase import GenBase |
17 |
@@ -49,8 +50,8 @@ class snapshot(TargetBase, GenBase): |
18 |
|
19 |
success = True |
20 |
self.setup() |
21 |
- print "Creating Portage tree snapshot "+self.settings["version_stamp"]+\ |
22 |
- " from "+self.settings["portdir"]+"..." |
23 |
+ log.notice('Creating Portage tree snapshot %s from %s ...', |
24 |
+ self.settings['version_stamp'], self.settings['portdir']) |
25 |
|
26 |
mytmp=self.settings["tmp_path"] |
27 |
ensure_dirs(mytmp) |
28 |
@@ -61,7 +62,7 @@ class snapshot(TargetBase, GenBase): |
29 |
target_snapshot, |
30 |
"Snapshot failure", env=self.env) |
31 |
|
32 |
- print "Compressing Portage snapshot tarball..." |
33 |
+ log.notice('Compressing Portage snapshot tarball ...') |
34 |
compressor = CompressMap(self.settings["compress_definitions"], |
35 |
env=self.env, default_mode=self.settings['compression_mode']) |
36 |
infodict = compressor.create_infodict( |
37 |
@@ -74,17 +75,17 @@ class snapshot(TargetBase, GenBase): |
38 |
) |
39 |
if not compressor.compress(infodict): |
40 |
success = False |
41 |
- print "Snapshot compression failure" |
42 |
+ log.error('Snapshot compression failure') |
43 |
else: |
44 |
filename = '.'.join([self.settings["snapshot_path"], |
45 |
compressor.extension(self.settings["compression_mode"])]) |
46 |
- print "COMPRESSOR success!!!! filename", filename |
47 |
+ log.notice('Snapshot successfully written to %s', filename) |
48 |
self.gen_contents_file(filename) |
49 |
self.gen_digest_file(filename) |
50 |
|
51 |
self.cleanup() |
52 |
if success: |
53 |
- print "snapshot: complete!" |
54 |
+ log.info('snapshot: complete!') |
55 |
return success |
56 |
|
57 |
def kill_chroot_pids(self): |
58 |
@@ -92,12 +93,12 @@ class snapshot(TargetBase, GenBase): |
59 |
|
60 |
@staticmethod |
61 |
def cleanup(): |
62 |
- print "Cleaning up..." |
63 |
+ log.info('Cleaning up ...') |
64 |
|
65 |
def purge(self): |
66 |
myemp=self.settings["tmp_path"] |
67 |
if os.path.isdir(myemp): |
68 |
- print "Emptying directory",myemp |
69 |
+ log.notice('Emptying directory %s', myemp) |
70 |
# stat the dir, delete the dir, recreate the dir and set |
71 |
# the proper perms and ownership |
72 |
mystat=os.stat(myemp) |
73 |
-- |
74 |
2.5.2 |