Gentoo Archives: gentoo-commits

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