Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:pending commit in: modules/catalyst/, /, catalyst/arch/, catalyst/, catalyst/modules/, bin/, arch/, ...
Date: Wed, 22 Jan 2014 17:10:05
Message-Id: 1389559701.4ebd167d0e2f599a0886e51fdb0048d5dd74b80f.dol-sen@gentoo
1 commit: 4ebd167d0e2f599a0886e51fdb0048d5dd74b80f
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 11 02:56:28 2013 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Sun Jan 12 20:48:21 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=4ebd167d
7
8 Initial rearrangement of the python directories
9
10 New minimal start script, moving the original catalyst script to catalyst/main.py.
11 Add __init__.py's to modules and arch sub-pkgs.
12 skip __init__.py when loading the modules.
13 Update the module loading paths for the new locations.
14 Fix catalyst_support import to new location and specify imported modules.
15
16 ---
17 bin/catalyst | 46 +++++++++++++++++++++
18 {modules => catalyst}/__init__.py | 0
19 catalyst/arch/__init__.py | 1 +
20 {arch => catalyst/arch}/alpha.py | 0
21 {arch => catalyst/arch}/amd64.py | 0
22 {arch => catalyst/arch}/arm.py | 0
23 {arch => catalyst/arch}/hppa.py | 0
24 {arch => catalyst/arch}/ia64.py | 0
25 {arch => catalyst/arch}/mips.py | 0
26 {arch => catalyst/arch}/powerpc.py | 0
27 {arch => catalyst/arch}/s390.py | 0
28 {arch => catalyst/arch}/sh.py | 0
29 {arch => catalyst/arch}/sparc.py | 0
30 {arch => catalyst/arch}/x86.py | 0
31 {modules/catalyst => catalyst}/config.py | 0
32 catalyst => catalyst/main.py | 48 +++++++++++++---------
33 catalyst/modules/__init__.py | 1 +
34 {modules => catalyst/modules}/builder.py | 0
35 {modules => catalyst/modules}/catalyst_lock.py | 0
36 {modules => catalyst/modules}/catalyst_support.py | 0
37 {modules => catalyst/modules}/embedded_target.py | 0
38 .../modules}/generic_stage_target.py | 15 +++----
39 {modules => catalyst/modules}/generic_target.py | 0
40 {modules => catalyst/modules}/grp_target.py | 0
41 .../modules}/livecd_stage1_target.py | 0
42 .../modules}/livecd_stage2_target.py | 0
43 {modules => catalyst/modules}/netboot2_target.py | 0
44 {modules => catalyst/modules}/netboot_target.py | 0
45 {modules => catalyst/modules}/snapshot_target.py | 0
46 {modules => catalyst/modules}/stage1_target.py | 0
47 {modules => catalyst/modules}/stage2_target.py | 0
48 {modules => catalyst/modules}/stage3_target.py | 0
49 {modules => catalyst/modules}/stage4_target.py | 0
50 {modules => catalyst/modules}/tinderbox_target.py | 0
51 {modules/catalyst => catalyst}/util.py | 0
52 modules/catalyst/__init__.py | 0
53 36 files changed, 84 insertions(+), 27 deletions(-)
54
55 diff --git a/bin/catalyst b/bin/catalyst
56 new file mode 100755
57 index 0000000..ace43fc
58 --- /dev/null
59 +++ b/bin/catalyst
60 @@ -0,0 +1,46 @@
61 +#!/usr/bin/python2 -OO
62 +
63 +# Maintained in full by:
64 +# Catalyst Team <catalyst@g.o>
65 +# Release Engineering Team <releng@g.o>
66 +# Andrew Gaffney <agaffney@g.o>
67 +# Chris Gianelloni <wolf31o2@××××××××.org>
68 +# $Id$
69 +
70 +
71 +from __future__ import print_function
72 +
73 +import sys
74 +
75 +__maintainer__="Catalyst <catalyst@g.o>"
76 +__version__="2.0.12.2"
77 +
78 +
79 +# This block ensures that ^C interrupts are handled quietly.
80 +try:
81 + import signal
82 +
83 + def exithandler(signum,frame):
84 + signal.signal(signal.SIGINT, signal.SIG_IGN)
85 + signal.signal(signal.SIGTERM, signal.SIG_IGN)
86 + print()
87 + sys.exit(1)
88 +
89 + signal.signal(signal.SIGINT, exithandler)
90 + signal.signal(signal.SIGTERM, exithandler)
91 + signal.signal(signal.SIGPIPE, signal.SIG_DFL)
92 +
93 +except KeyboardInterrupt:
94 + print()
95 + sys.exit(1)
96 +
97 +
98 +from catalyst.main import main
99 +
100 +try:
101 + main()
102 +except KeyboardInterrupt:
103 + print("Aborted.")
104 + sys.exit(130)
105 +sys.exit(0)
106 +
107
108 diff --git a/modules/__init__.py b/catalyst/__init__.py
109 similarity index 100%
110 rename from modules/__init__.py
111 rename to catalyst/__init__.py
112
113 diff --git a/catalyst/arch/__init__.py b/catalyst/arch/__init__.py
114 new file mode 100644
115 index 0000000..8b13789
116 --- /dev/null
117 +++ b/catalyst/arch/__init__.py
118 @@ -0,0 +1 @@
119 +
120
121 diff --git a/arch/alpha.py b/catalyst/arch/alpha.py
122 similarity index 100%
123 rename from arch/alpha.py
124 rename to catalyst/arch/alpha.py
125
126 diff --git a/arch/amd64.py b/catalyst/arch/amd64.py
127 similarity index 100%
128 rename from arch/amd64.py
129 rename to catalyst/arch/amd64.py
130
131 diff --git a/arch/arm.py b/catalyst/arch/arm.py
132 similarity index 100%
133 rename from arch/arm.py
134 rename to catalyst/arch/arm.py
135
136 diff --git a/arch/hppa.py b/catalyst/arch/hppa.py
137 similarity index 100%
138 rename from arch/hppa.py
139 rename to catalyst/arch/hppa.py
140
141 diff --git a/arch/ia64.py b/catalyst/arch/ia64.py
142 similarity index 100%
143 rename from arch/ia64.py
144 rename to catalyst/arch/ia64.py
145
146 diff --git a/arch/mips.py b/catalyst/arch/mips.py
147 similarity index 100%
148 rename from arch/mips.py
149 rename to catalyst/arch/mips.py
150
151 diff --git a/arch/powerpc.py b/catalyst/arch/powerpc.py
152 similarity index 100%
153 rename from arch/powerpc.py
154 rename to catalyst/arch/powerpc.py
155
156 diff --git a/arch/s390.py b/catalyst/arch/s390.py
157 similarity index 100%
158 rename from arch/s390.py
159 rename to catalyst/arch/s390.py
160
161 diff --git a/arch/sh.py b/catalyst/arch/sh.py
162 similarity index 100%
163 rename from arch/sh.py
164 rename to catalyst/arch/sh.py
165
166 diff --git a/arch/sparc.py b/catalyst/arch/sparc.py
167 similarity index 100%
168 rename from arch/sparc.py
169 rename to catalyst/arch/sparc.py
170
171 diff --git a/arch/x86.py b/catalyst/arch/x86.py
172 similarity index 100%
173 rename from arch/x86.py
174 rename to catalyst/arch/x86.py
175
176 diff --git a/modules/catalyst/config.py b/catalyst/config.py
177 similarity index 100%
178 rename from modules/catalyst/config.py
179 rename to catalyst/config.py
180
181 diff --git a/catalyst b/catalyst/main.py
182 old mode 100755
183 new mode 100644
184 similarity index 91%
185 rename from catalyst
186 rename to catalyst/main.py
187 index cb6c022..f6a3e51
188 --- a/catalyst
189 +++ b/catalyst/main.py
190 @@ -1,4 +1,3 @@
191 -#!/usr/bin/python2 -OO
192
193 # Maintained in full by:
194 # Catalyst Team <catalyst@g.o>
195 @@ -15,8 +14,14 @@ import getopt
196 import pdb
197 import os.path
198
199 -import modules.catalyst.config
200 -import modules.catalyst.util
201 +__selfpath__ = os.path.abspath(os.path.dirname(__file__))
202 +
203 +sys.path.append(__selfpath__ + "/modules")
204 +
205 +import catalyst.config
206 +import catalyst.util
207 +from catalyst.modules.catalyst_support import (required_build_targets,
208 + valid_build_targets, CatalystError, hash_map, find_binary, LockInUse)
209
210 __maintainer__="Catalyst <catalyst@g.o>"
211 __version__="2.0.15"
212 @@ -102,7 +107,7 @@ def parse_config(myconfig):
213 # now, try and parse the config file "config_file"
214 try:
215 # execfile(config_file, myconf, myconf)
216 - myconfig = modules.catalyst.config.ConfigParser(config_file)
217 + myconfig = catalyst.config.ConfigParser(config_file)
218 myconf.update(myconfig.get_values())
219
220 except:
221 @@ -118,6 +123,9 @@ def parse_config(myconfig):
222 print "Setting",x,"to default value \""+confdefaults[x]+"\""
223 conf_values[x]=confdefaults[x]
224
225 + # add our python base directory to use for loading target arch's
226 + conf_values["PythonDir"] = __selfpath__
227 +
228 # parse out the rest of the options from the config file
229 if "autoresume" in string.split(conf_values["options"]):
230 print "Autoresuming support enabled."
231 @@ -191,30 +199,32 @@ def import_modules():
232 targetmap={}
233
234 try:
235 + module_dir = __selfpath__ + "/modules/"
236 for x in required_build_targets:
237 try:
238 - fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
239 - module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
240 + fh=open(module_dir + x + ".py")
241 + module=imp.load_module(x, fh,"modules/" + x + ".py",
242 + (".py", "r", imp.PY_SOURCE))
243 fh.close()
244
245 except IOError:
246 - raise CatalystError,"Can't find "+x+".py plugin in "+\
247 - conf_values["sharedir"]+"/modules/"
248 -
249 + raise CatalystError, "Can't find " + x + ".py plugin in " + \
250 + module_dir
251 for x in valid_build_targets:
252 try:
253 - fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
254 - module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
255 + fh=open(module_dir + x + ".py")
256 + module=imp.load_module(x, fh, "modules/" + x + ".py",
257 + (".py", "r", imp.PY_SOURCE))
258 module.register(targetmap)
259 fh.close()
260
261 except IOError:
262 - raise CatalystError,"Can't find "+x+".py plugin in "+\
263 - conf_values["sharedir"]+"/modules/"
264 + raise CatalystError,"Can't find " + x + ".py plugin in " + \
265 + module_dir
266
267 except ImportError:
268 print "!!! catalyst: Python modules not found in "+\
269 - conf_values["sharedir"]+"/modules; exiting."
270 + module_dir + "; exiting."
271 sys.exit(1)
272
273 return targetmap
274 @@ -229,11 +239,11 @@ def build_target(addlargs, targetmap):
275 mytarget.run()
276
277 except:
278 - modules.catalyst.util.print_traceback()
279 + catalyst.util.print_traceback()
280 print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
281 sys.exit(1)
282
283 -if __name__ == "__main__":
284 +def main():
285 targetmap={}
286
287 version()
288 @@ -334,8 +344,6 @@ if __name__ == "__main__":
289
290 # import configuration file and import our main module using those settings
291 parse_config(myconfig)
292 - sys.path.append(conf_values["sharedir"]+"/modules")
293 - from catalyst_support import *
294
295 # Start checking that digests are valid now that the hash_map was imported
296 # from catalyst_support
297 @@ -382,12 +390,12 @@ if __name__ == "__main__":
298 addlargs={}
299
300 if myspecfile:
301 - spec = modules.catalyst.config.SpecParser(myspecfile)
302 + spec = catalyst.config.SpecParser(myspecfile)
303 addlargs.update(spec.get_values())
304
305 if mycmdline:
306 try:
307 - cmdline = modules.catalyst.config.ConfigParser()
308 + cmdline = catalyst.config.ConfigParser()
309 cmdline.parse_lines(mycmdline)
310 addlargs.update(cmdline.get_values())
311 except CatalystError:
312
313 diff --git a/catalyst/modules/__init__.py b/catalyst/modules/__init__.py
314 new file mode 100644
315 index 0000000..8b13789
316 --- /dev/null
317 +++ b/catalyst/modules/__init__.py
318 @@ -0,0 +1 @@
319 +
320
321 diff --git a/modules/builder.py b/catalyst/modules/builder.py
322 similarity index 100%
323 rename from modules/builder.py
324 rename to catalyst/modules/builder.py
325
326 diff --git a/modules/catalyst_lock.py b/catalyst/modules/catalyst_lock.py
327 similarity index 100%
328 rename from modules/catalyst_lock.py
329 rename to catalyst/modules/catalyst_lock.py
330
331 diff --git a/modules/catalyst_support.py b/catalyst/modules/catalyst_support.py
332 similarity index 100%
333 rename from modules/catalyst_support.py
334 rename to catalyst/modules/catalyst_support.py
335
336 diff --git a/modules/embedded_target.py b/catalyst/modules/embedded_target.py
337 similarity index 100%
338 rename from modules/embedded_target.py
339 rename to catalyst/modules/embedded_target.py
340
341 diff --git a/modules/generic_stage_target.py b/catalyst/modules/generic_stage_target.py
342 similarity index 99%
343 rename from modules/generic_stage_target.py
344 rename to catalyst/modules/generic_stage_target.py
345 index 89b891b..f04b186 100644
346 --- a/modules/generic_stage_target.py
347 +++ b/catalyst/modules/generic_stage_target.py
348 @@ -78,16 +78,18 @@ class generic_stage_target(generic_target):
349 self.archmap = {}
350 self.subarchmap = {}
351 machinemap = {}
352 - for x in [x[:-3] for x in os.listdir(self.settings["sharedir"]+\
353 - "/arch/") if x.endswith(".py")]:
354 + arch_dir = self.settings["PythonDir"] + "/arch/"
355 + for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py")]:
356 + if x == "__init__":
357 + continue
358 try:
359 - fh=open(self.settings["sharedir"]+"/arch/"+x+".py")
360 + fh=open(arch_dir + x + ".py")
361 """
362 This next line loads the plugin as a module and assigns it to
363 archmap[x]
364 """
365 - self.archmap[x]=imp.load_module(x,fh,"arch/"+x+\
366 - ".py",(".py","r",imp.PY_SOURCE))
367 + self.archmap[x]=imp.load_module(x,fh,"../arch/" + x + ".py",
368 + (".py", "r", imp.PY_SOURCE))
369 """
370 This next line registers all the subarches supported in the
371 plugin
372 @@ -105,8 +107,7 @@ class generic_stage_target(generic_target):
373 the dir should load just fine. If it doesn't, it's probably a
374 syntax error in the module
375 """
376 - msg("Can't find/load "+x+".py plugin in "+\
377 - self.settings["sharedir"]+"/arch/")
378 + msg("Can't find/load " + x + ".py plugin in " + arch_dir)
379
380 if "chost" in self.settings:
381 hostmachine = self.settings["chost"].split("-")[0]
382
383 diff --git a/modules/generic_target.py b/catalyst/modules/generic_target.py
384 similarity index 100%
385 rename from modules/generic_target.py
386 rename to catalyst/modules/generic_target.py
387
388 diff --git a/modules/grp_target.py b/catalyst/modules/grp_target.py
389 similarity index 100%
390 rename from modules/grp_target.py
391 rename to catalyst/modules/grp_target.py
392
393 diff --git a/modules/livecd_stage1_target.py b/catalyst/modules/livecd_stage1_target.py
394 similarity index 100%
395 rename from modules/livecd_stage1_target.py
396 rename to catalyst/modules/livecd_stage1_target.py
397
398 diff --git a/modules/livecd_stage2_target.py b/catalyst/modules/livecd_stage2_target.py
399 similarity index 100%
400 rename from modules/livecd_stage2_target.py
401 rename to catalyst/modules/livecd_stage2_target.py
402
403 diff --git a/modules/netboot2_target.py b/catalyst/modules/netboot2_target.py
404 similarity index 100%
405 rename from modules/netboot2_target.py
406 rename to catalyst/modules/netboot2_target.py
407
408 diff --git a/modules/netboot_target.py b/catalyst/modules/netboot_target.py
409 similarity index 100%
410 rename from modules/netboot_target.py
411 rename to catalyst/modules/netboot_target.py
412
413 diff --git a/modules/snapshot_target.py b/catalyst/modules/snapshot_target.py
414 similarity index 100%
415 rename from modules/snapshot_target.py
416 rename to catalyst/modules/snapshot_target.py
417
418 diff --git a/modules/stage1_target.py b/catalyst/modules/stage1_target.py
419 similarity index 100%
420 rename from modules/stage1_target.py
421 rename to catalyst/modules/stage1_target.py
422
423 diff --git a/modules/stage2_target.py b/catalyst/modules/stage2_target.py
424 similarity index 100%
425 rename from modules/stage2_target.py
426 rename to catalyst/modules/stage2_target.py
427
428 diff --git a/modules/stage3_target.py b/catalyst/modules/stage3_target.py
429 similarity index 100%
430 rename from modules/stage3_target.py
431 rename to catalyst/modules/stage3_target.py
432
433 diff --git a/modules/stage4_target.py b/catalyst/modules/stage4_target.py
434 similarity index 100%
435 rename from modules/stage4_target.py
436 rename to catalyst/modules/stage4_target.py
437
438 diff --git a/modules/tinderbox_target.py b/catalyst/modules/tinderbox_target.py
439 similarity index 100%
440 rename from modules/tinderbox_target.py
441 rename to catalyst/modules/tinderbox_target.py
442
443 diff --git a/modules/catalyst/util.py b/catalyst/util.py
444 similarity index 100%
445 rename from modules/catalyst/util.py
446 rename to catalyst/util.py
447
448 diff --git a/modules/catalyst/__init__.py b/modules/catalyst/__init__.py
449 deleted file mode 100644
450 index e69de29..0000000