1 |
On Sun, 2013-01-06 at 17:41 -0800, Brian Dolbec wrote: |
2 |
> This is the first of some untested (but they compile without errors) |
3 |
> patches to catalyst for the pending default tree location changes. |
4 |
> |
5 |
> My current gentoo machine is somewhat limited in capability (memory |
6 |
> shortage, only moderate cpu horespower) for doing proper testing. But I |
7 |
> will try and get it setup better to do some test runs for changes. |
8 |
> |
9 |
> I can also push my catalyst git repo to my dev space for you to checkout |
10 |
> and do some tests on if you like. |
11 |
> |
12 |
> |
13 |
|
14 |
As requested. Separated whitespace cleanup. |
15 |
|
16 |
===================== |
17 |
|
18 |
diff --git a/catalyst b/catalyst |
19 |
index 3d31599..c77658a 100755 |
20 |
@@ -66,7 +66,7 @@ def parse_config(myconfig): |
21 |
"portdir":"/usr/portage","options":"",\ |
22 |
"snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\ |
23 |
"hash_function":"crc32"} |
24 |
- |
25 |
+ |
26 |
# first, try the one passed (presumably from the cmdline) |
27 |
if myconfig: |
28 |
if os.path.exists(myconfig): |
29 |
@@ -77,12 +77,12 @@ def parse_config(myconfig): |
30 |
print "!!! catalyst: Could not use specified configuration file "+\ |
31 |
myconfig |
32 |
sys.exit(1) |
33 |
- |
34 |
+ |
35 |
# next, try the default location |
36 |
elif os.path.exists("/etc/catalyst/catalyst.conf"): |
37 |
print "Using default Catalyst configuration file, /etc/catalyst/catalyst.conf" |
38 |
config_file="/etc/catalyst/catalyst.conf" |
39 |
- |
40 |
+ |
41 |
# can't find a config file (we are screwed), so bail out |
42 |
else: |
43 |
print "!!! catalyst: Could not find a suitable configuration file" |
44 |
@@ -93,11 +93,11 @@ def parse_config(myconfig): |
45 |
# execfile(config_file, myconf, myconf) |
46 |
myconfig = catalyst.config.ConfigParser(config_file) |
47 |
myconf.update(myconfig.get_values()) |
48 |
- |
49 |
+ |
50 |
except: |
51 |
print "!!! catalyst: Unable to parse configuration file, "+myconfig |
52 |
sys.exit(1) |
53 |
- |
54 |
+ |
55 |
# now, load up the values into conf_values so that we can use them |
56 |
for x in confdefaults.keys(): |
57 |
if myconf.has_key(x): |
58 |
@@ -208,9 +208,9 @@ def build_target(addlargs, targetmap): |
59 |
try: |
60 |
if not targetmap.has_key(addlargs["target"]): |
61 |
raise CatalystError,"Target \""+addlargs["target"]+"\" not available." |
62 |
- |
63 |
+ |
64 |
mytarget=targetmap[addlargs["target"]](conf_values, addlargs) |
65 |
- |
66 |
+ |
67 |
mytarget.run() |
68 |
|
69 |
except: |
70 |
@@ -220,7 +220,7 @@ def build_target(addlargs, targetmap): |
71 |
|
72 |
if __name__ == "__main__": |
73 |
targetmap={} |
74 |
- |
75 |
+ |
76 |
version() |
77 |
if os.getuid() != 0: |
78 |
# catalyst cannot be run as a normal user due to chroots, mounts, etc |
79 |
@@ -236,11 +236,11 @@ if __name__ == "__main__": |
80 |
try: |
81 |
opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\ |
82 |
"clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="]) |
83 |
- |
84 |
+ |
85 |
except getopt.GetoptError: |
86 |
usage() |
87 |
sys.exit(2) |
88 |
- |
89 |
+ |
90 |
# defaults for commandline opts |
91 |
debug=False |
92 |
verbose=False |
93 |
@@ -261,7 +261,7 @@ if __name__ == "__main__": |
94 |
if o in ("-h", "--help"): |
95 |
usage() |
96 |
sys.exit(1) |
97 |
- |
98 |
+ |
99 |
if o in ("-V", "--version"): |
100 |
print "Catalyst version "+__version__ |
101 |
sys.exit(1) |
102 |
@@ -279,14 +279,14 @@ if __name__ == "__main__": |
103 |
while x < len(sys.argv): |
104 |
mycmdline.append(sys.argv[x]) |
105 |
x=x+1 |
106 |
- |
107 |
+ |
108 |
if o in ("-f", "--file"): |
109 |
run = True |
110 |
myspecfile=a |
111 |
|
112 |
if o in ("-F", "--fetchonly"): |
113 |
conf_values["FETCH"]="1" |
114 |
- |
115 |
+ |
116 |
if o in ("-v", "--verbose"): |
117 |
conf_values["VERBOSE"]="1" |
118 |
|
119 |
@@ -299,7 +299,7 @@ if __name__ == "__main__": |
120 |
run = True |
121 |
mycmdline.append("target=snapshot") |
122 |
mycmdline.append("version_stamp="+a) |
123 |
- |
124 |
+ |
125 |
if o in ("-p", "--purge"): |
126 |
conf_values["PURGE"] = "1" |
127 |
|
128 |
@@ -321,7 +321,7 @@ if __name__ == "__main__": |
129 |
parse_config(myconfig) |
130 |
sys.path.append(conf_values["sharedir"]+"/modules") |
131 |
from catalyst_support import * |
132 |
- |
133 |
+ |
134 |
# Start checking that digests are valid now that the hash_map was imported |
135 |
# from catalyst_support |
136 |
if conf_values.has_key("digests"): |
137 |
@@ -365,11 +365,11 @@ if __name__ == "__main__": |
138 |
targetmap=import_modules() |
139 |
|
140 |
addlargs={} |
141 |
- |
142 |
+ |
143 |
if myspecfile: |
144 |
spec = catalyst.config.SpecParser(myspecfile) |
145 |
addlargs.update(spec.get_values()) |
146 |
- |
147 |
+ |
148 |
if mycmdline: |
149 |
try: |
150 |
cmdline = catalyst.config.ConfigParser() |
151 |
@@ -385,7 +385,7 @@ if __name__ == "__main__": |
152 |
# everything is setup, so the build is a go |
153 |
try: |
154 |
build_target(addlargs, targetmap) |
155 |
- |
156 |
+ |
157 |
except CatalystError: |
158 |
print |
159 |
print "Catalyst aborting...." |
160 |
|
161 |
|
162 |
===================== |
163 |
-- |
164 |
Brian Dolbec <dolsen@g.o> |