1 |
commit: 08c84b0ad645c0166bbedf26d3972d8dee23db74 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 04:26:38 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 9 00:23:49 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=08c84b0a |
7 |
|
8 |
stagebase: replace read_from_clst with snakeoil |
9 |
|
10 |
The read_from_clst function is used in one place, and this function is |
11 |
an overwrought "read all the data from a file" function. Replace it |
12 |
with a snakeoil function. |
13 |
|
14 |
catalyst/base/stagebase.py | 5 ++--- |
15 |
catalyst/support.py | 15 --------------- |
16 |
2 files changed, 2 insertions(+), 18 deletions(-) |
17 |
|
18 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
19 |
index 7d069fa..bffafb7 100644 |
20 |
--- a/catalyst/base/stagebase.py |
21 |
+++ b/catalyst/base/stagebase.py |
22 |
@@ -16,8 +16,7 @@ from DeComp.compress import CompressMap |
23 |
from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS, |
24 |
PORT_LOGDIR_CLEAN) |
25 |
from catalyst.support import (CatalystError, msg, file_locate, normpath, |
26 |
- cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount, |
27 |
- file_check) |
28 |
+ cmd, warn, list_bashify, read_makeconf, ismount, file_check) |
29 |
from catalyst.base.targetbase import TargetBase |
30 |
from catalyst.base.clearbase import ClearBase |
31 |
from catalyst.base.genbase import GenBase |
32 |
@@ -817,7 +816,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
33 |
if "snapcache" in self.settings["options"]: |
34 |
snapshot_cache_hash_path = pjoin( |
35 |
self.settings['snapshot_cache_path'], 'catalyst-hash') |
36 |
- snapshot_cache_hash = read_from_clst(snapshot_cache_hash_path) |
37 |
+ snapshot_cache_hash = fileutils.readfile(snapshot_cache_hash_path, True) |
38 |
unpack_info['mode'] = self.decompressor.determine_mode( |
39 |
unpack_info['source']) |
40 |
|
41 |
|
42 |
diff --git a/catalyst/support.py b/catalyst/support.py |
43 |
index 960a91d..c629025 100644 |
44 |
--- a/catalyst/support.py |
45 |
+++ b/catalyst/support.py |
46 |
@@ -13,21 +13,6 @@ from catalyst.defaults import verbosity, valid_config_file_values |
47 |
BASH_BINARY = "/bin/bash" |
48 |
|
49 |
|
50 |
-def read_from_clst(path): |
51 |
- line = '' |
52 |
- myline = '' |
53 |
- try: |
54 |
- myf = open(path, "r") |
55 |
- except Exception: |
56 |
- return -1 |
57 |
- #raise CatalystError("Could not open file " + path) |
58 |
- for line in myf.readlines(): |
59 |
- #line = line.replace("\n", "") # drop newline |
60 |
- myline = myline + line |
61 |
- myf.close() |
62 |
- return myline |
63 |
- |
64 |
- |
65 |
def list_bashify(mylist): |
66 |
if type(mylist)==types.StringType: |
67 |
mypack=[mylist] |