Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/arch/, catalyst/base/, targets/stage1/, catalyst/targets/
Date: Thu, 26 Feb 2015 20:12:53
Message-Id: 1420091886.7d8c62bdf311d774b7d60429c3a72a1fecb7166f.dolsen@gentoo
1 commit: 7d8c62bdf311d774b7d60429c3a72a1fecb7166f
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 20 04:29:16 2013 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 1 05:58:06 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=7d8c62bd
7
8 Pyflakes import cleanup and broken CatalystError calls.
9
10 Replace "import *" with named imports, remove unused imports.
11 Fix broken CatalystError usage.
12
13 Conflicts:
14 catalyst/base/stagebase.py
15 catalyst/defaults.py
16 catalyst/main.py
17 catalyst/support.py
18 catalyst/targets/embedded.py
19 catalyst/targets/generic_target.py
20 catalyst/targets/grp.py
21 catalyst/targets/livecd_stage1.py
22 catalyst/targets/livecd_stage2.py
23 catalyst/targets/netboot.py
24 catalyst/targets/netboot2.py
25 catalyst/targets/snapshot.py
26 catalyst/targets/stage1.py
27 catalyst/targets/stage2.py
28 catalyst/targets/stage3.py
29 catalyst/targets/stage4.py
30 catalyst/targets/tinderbox.py
31
32 ---
33 catalyst/arch/alpha.py | 3 +-
34 catalyst/arch/arm.py | 2 --
35 catalyst/arch/hppa.py | 3 --
36 catalyst/arch/ia64.py | 3 --
37 catalyst/arch/mips.py | 3 --
38 catalyst/arch/powerpc.py | 5 ++--
39 catalyst/arch/s390.py | 3 --
40 catalyst/arch/sh.py | 3 --
41 catalyst/arch/sparc.py | 5 ++--
42 catalyst/arch/x86.py | 5 ++--
43 catalyst/base/stagebase.py | 58 +++++++++++++++++++++------------------
44 catalyst/config.py | 9 +++---
45 catalyst/contents.py | 8 +++---
46 catalyst/hash_utils.py | 4 +--
47 catalyst/lock.py | 5 ++--
48 catalyst/main.py | 13 ++-------
49 catalyst/support.py | 49 +++++++++++++++++----------------
50 catalyst/targets/grp.py | 5 ++--
51 catalyst/targets/livecd_stage1.py | 4 +--
52 catalyst/targets/livecd_stage2.py | 14 ++++++++--
53 catalyst/targets/netboot.py | 15 ++++++----
54 catalyst/targets/netboot2.py | 8 ++++--
55 catalyst/targets/tinderbox.py | 3 +-
56 targets/stage1/build.py | 4 ++-
57 24 files changed, 118 insertions(+), 116 deletions(-)
58
59 diff --git a/catalyst/arch/alpha.py b/catalyst/arch/alpha.py
60 index 7248020..01b6382 100644
61 --- a/catalyst/arch/alpha.py
62 +++ b/catalyst/arch/alpha.py
63 @@ -1,8 +1,7 @@
64
65 -import os
66
67 from catalyst import builder
68 -from catalyst.support import *
69 +
70
71 class generic_alpha(builder.generic):
72 "abstract base class for all alpha builders"
73
74 diff --git a/catalyst/arch/arm.py b/catalyst/arch/arm.py
75 index 8f207ff..c0d322c 100644
76 --- a/catalyst/arch/arm.py
77 +++ b/catalyst/arch/arm.py
78 @@ -1,8 +1,6 @@
79
80 -import os
81
82 from catalyst import builder
83 -from catalyst.support import *
84
85 class generic_arm(builder.generic):
86 "Abstract base class for all arm (little endian) builders"
87
88 diff --git a/catalyst/arch/hppa.py b/catalyst/arch/hppa.py
89 index 3aac9b6..c5589c4 100644
90 --- a/catalyst/arch/hppa.py
91 +++ b/catalyst/arch/hppa.py
92 @@ -1,8 +1,5 @@
93
94 -import os
95 -
96 from catalyst import builder
97 -from catalyst.support import *
98
99 class generic_hppa(builder.generic):
100 "Abstract base class for all hppa builders"
101
102 diff --git a/catalyst/arch/ia64.py b/catalyst/arch/ia64.py
103 index 4003085..3f06040 100644
104 --- a/catalyst/arch/ia64.py
105 +++ b/catalyst/arch/ia64.py
106 @@ -1,8 +1,5 @@
107
108 -import os
109 -
110 from catalyst import builder
111 -from catalyst.support import *
112
113 class arch_ia64(builder.generic):
114 "builder class for ia64"
115
116 diff --git a/catalyst/arch/mips.py b/catalyst/arch/mips.py
117 index 7cce392..5297a4b 100644
118 --- a/catalyst/arch/mips.py
119 +++ b/catalyst/arch/mips.py
120 @@ -1,8 +1,5 @@
121
122 -import os
123 -
124 from catalyst import builder
125 -from catalyst.support import *
126
127 class generic_mips(builder.generic):
128 "Abstract base class for all mips builders [Big-endian]"
129
130 diff --git a/catalyst/arch/powerpc.py b/catalyst/arch/powerpc.py
131 index 6cec580..f903b38 100644
132 --- a/catalyst/arch/powerpc.py
133 +++ b/catalyst/arch/powerpc.py
134 @@ -2,7 +2,7 @@
135 import os
136
137 from catalyst import builder
138 -from catalyst.support import *
139 +from catalyst.support import CatalystError
140
141 class generic_ppc(builder.generic):
142 "abstract base class for all 32-bit powerpc builders"
143 @@ -11,7 +11,8 @@ class generic_ppc(builder.generic):
144 self.settings["CHOST"]="powerpc-unknown-linux-gnu"
145 if self.settings["buildarch"]=="ppc64":
146 if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
147 - raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
148 + raise CatalystError("required executable linux32 not found "
149 + "(\"emerge setarch\" to fix.)", print_traceback=True)
150 self.settings["CHROOT"]="linux32 chroot"
151 self.settings["crosscompile"] = False;
152 else:
153
154 diff --git a/catalyst/arch/s390.py b/catalyst/arch/s390.py
155 index c49e0b7..f2cf80d 100644
156 --- a/catalyst/arch/s390.py
157 +++ b/catalyst/arch/s390.py
158 @@ -1,8 +1,5 @@
159
160 -import os
161 -
162 from catalyst import builder
163 -from catalyst.support import *
164
165 class generic_s390(builder.generic):
166 "abstract base class for all s390 builders"
167
168 diff --git a/catalyst/arch/sh.py b/catalyst/arch/sh.py
169 index 1fa1b0b..64d6e0e 100644
170 --- a/catalyst/arch/sh.py
171 +++ b/catalyst/arch/sh.py
172 @@ -1,8 +1,5 @@
173
174 -import os
175 -
176 from catalyst import builder
177 -from catalyst.support import *
178
179 class generic_sh(builder.generic):
180 "Abstract base class for all sh builders [Little-endian]"
181
182 diff --git a/catalyst/arch/sparc.py b/catalyst/arch/sparc.py
183 index 2889528..da2ad35 100644
184 --- a/catalyst/arch/sparc.py
185 +++ b/catalyst/arch/sparc.py
186 @@ -2,7 +2,7 @@
187 import os
188
189 from catalyst import builder
190 -from catalyst.support import *
191 +from catalyst.support import CatalystError
192
193 class generic_sparc(builder.generic):
194 "abstract base class for all sparc builders"
195 @@ -10,7 +10,8 @@ class generic_sparc(builder.generic):
196 builder.generic.__init__(self,myspec)
197 if self.settings["buildarch"]=="sparc64":
198 if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
199 - raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
200 + raise CatalystError("required executable linux32 not found "
201 + "(\"emerge setarch\" to fix.)", print_traceback=True)
202 self.settings["CHROOT"]="linux32 chroot"
203 self.settings["crosscompile"] = False;
204 else:
205
206 diff --git a/catalyst/arch/x86.py b/catalyst/arch/x86.py
207 index c8d1911..9f1bba2 100644
208 --- a/catalyst/arch/x86.py
209 +++ b/catalyst/arch/x86.py
210 @@ -2,7 +2,7 @@
211 import os
212
213 from catalyst import builder
214 -from catalyst.support import *
215 +from catalyst.support import CatalystError
216
217 class generic_x86(builder.generic):
218 "abstract base class for all x86 builders"
219 @@ -10,7 +10,8 @@ class generic_x86(builder.generic):
220 builder.generic.__init__(self,myspec)
221 if self.settings["buildarch"]=="amd64":
222 if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
223 - raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
224 + raise CatalystError("required executable linux32 not found "
225 + "(\"emerge setarch\" to fix.)", print_traceback=True)
226 self.settings["CHROOT"]="linux32 chroot"
227 self.settings["crosscompile"] = False;
228 else:
229
230 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
231 index daf8e54..c16ef86 100644
232 --- a/catalyst/base/stagebase.py
233 +++ b/catalyst/base/stagebase.py
234 @@ -98,7 +98,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
235 if "chost" in self.settings:
236 hostmachine = self.settings["chost"].split("-")[0]
237 if hostmachine not in machinemap:
238 - raise CatalystError, "Unknown host machine type "+hostmachine
239 + raise CatalystError("Unknown host machine type "+hostmachine)
240 self.settings["hostarch"]=machinemap[hostmachine]
241 else:
242 hostmachine = self.settings["subarch"]
243 @@ -110,7 +110,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
244 else:
245 buildmachine = os.uname()[4]
246 if buildmachine not in machinemap:
247 - raise CatalystError, "Unknown build machine type "+buildmachine
248 + raise CatalystError("Unknown build machine type "+buildmachine)
249 self.settings["buildarch"]=machinemap[buildmachine]
250 self.settings["crosscompile"]=(self.settings["hostarch"]!=\
251 self.settings["buildarch"])
252 @@ -237,9 +237,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
253 else:
254 ccdir="/root/.ccache"
255 if not os.path.isdir(ccdir):
256 - raise CatalystError,\
257 + raise CatalystError(
258 "Compiler cache support can't be enabled (can't find "+\
259 - ccdir+")"
260 + ccdir+")")
261 self.mounts.append("ccache")
262 self.mountmap["ccache"] = ccdir
263 """ for the chroot: """
264 @@ -296,8 +296,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
265
266 def set_source_subpath(self):
267 if type(self.settings["source_subpath"])!=types.StringType:
268 - raise CatalystError,\
269 - "source_subpath should have been a string. Perhaps you have something wrong in your spec file?"
270 + raise CatalystError(
271 + "source_subpath should have been a string. Perhaps you have " +\
272 + "something wrong in your spec file?")
273
274 def set_pkgcache_path(self):
275 if "pkgcache_path" in self.settings:
276 @@ -498,8 +499,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
277 self.settings["iso_volume_id"]=\
278 self.settings[self.settings["spec_prefix"]+"/volid"]
279 if len(self.settings["iso_volume_id"])>32:
280 - raise CatalystError,\
281 - "ISO volume ID must not exceed 32 characters."
282 + raise CatalystError(
283 + "ISO volume ID must not exceed 32 characters.")
284 else:
285 self.settings["iso_volume_id"]="catalyst "+self.settings["snapshot"]
286
287 @@ -658,11 +659,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
288 """ Try to umount stuff ourselves """
289 self.unbind()
290 if ismount(target):
291 - raise CatalystError, "Auto-unbind failed for " + target
292 + raise CatalystError("Auto-unbind failed for " + target)
293 else:
294 print "Auto-unbind successful..."
295 except CatalystError:
296 - raise CatalystError, "Unable to auto-unbind " + target
297 + raise CatalystError("Unable to auto-unbind " + target)
298
299 def unpack(self):
300 unpack=True
301 @@ -755,8 +756,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
302 invalid_snapshot=True
303 elif os.path.isdir(self.settings["source_path"]):
304 """ We should never reach this, so something is very wrong """
305 - raise CatalystError,\
306 - "source path is a dir but seedcache is not enabled"
307 + raise CatalystError(
308 + "source path is a dir but seedcache is not enabled")
309
310 if unpack:
311 self.mount_safety_check()
312 @@ -968,7 +969,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
313 retval=os.system(cmd)
314 if retval!=0:
315 self.unbind()
316 - raise CatalystError,"Couldn't bind mount " + src
317 + raise CatalystError("Couldn't bind mount " + src)
318
319 def unbind(self):
320 ouch=0
321 @@ -1013,8 +1014,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
322 this to potentially prevent an upcoming bash stage cleanup script
323 from wiping our bind mounts.
324 """
325 - raise CatalystError,\
326 - "Couldn't umount one or more bind-mounts; aborting for safety."
327 + raise CatalystError(
328 + "Couldn't umount one or more bind-mounts; aborting for safety.")
329
330 def chroot_setup(self):
331 self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+
332 @@ -1038,8 +1039,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
333 """ Copy over the envscript, if applicable """
334 if "envscript" in self.settings:
335 if not os.path.exists(self.settings["envscript"]):
336 - raise CatalystError,\
337 - "Can't find envscript "+self.settings["envscript"]
338 + raise CatalystError(
339 + "Can't find envscript " + self.settings["envscript"],
340 + print_traceback=True)
341
342 print "\nWarning!!!!"
343 print "\tOverriding certain env variables may cause catastrophic failure."
344 @@ -1250,7 +1252,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
345
346 except:
347 self.unbind()
348 - raise CatalystError, "Build failed, could not execute preclean"
349 + raise CatalystError("Build failed, could not execute preclean")
350
351 def capture(self):
352 capture_resume = pjoin(self.settings["autoresume_path"], "capture")
353 @@ -1293,7 +1295,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
354
355 except CatalystError:
356 self.unbind()
357 - raise CatalystError,"Stage build aborting due to error."
358 + raise CatalystError("Stage build aborting due to error.",
359 + print_traceback=True)
360
361 def setup_environment(self):
362 """
363 @@ -1466,8 +1469,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
364 touch(build_packages_resume)
365 except CatalystError:
366 self.unbind()
367 - raise CatalystError,self.settings["spec_prefix"]+\
368 - "build aborting due to error."
369 + raise CatalystError(self.settings["spec_prefix"]+\
370 + "build aborting due to error.")
371
372 def build_kernel(self):
373 '''Build all configured kernels'''
374 @@ -1493,8 +1496,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
375 touch(build_kernel_resume)
376 except CatalystError:
377 self.unbind()
378 - raise CatalystError,\
379 - "build aborting due to kernel build error."
380 + raise CatalystError(
381 + "build aborting due to kernel build error.",
382 + print_traceback=True)
383
384 def _build_kernel(self, kname):
385 "Build a single configured kernel by name"
386 @@ -1557,10 +1561,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
387 if "boot/kernel/"+kname+"/config" in self.settings:
388 if not os.path.exists(self.settings["boot/kernel/"+kname+"/config"]):
389 self.unbind()
390 - raise CatalystError,\
391 + raise CatalystError(
392 "Can't find kernel config: "+\
393 self.settings["boot/kernel/"+kname+\
394 - "/config"]
395 + "/config"])
396
397 try:
398 cmd("cp "+self.settings["boot/kernel/"+kname+\
399 @@ -1608,7 +1612,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
400 touch(bootloader_resume)
401 except CatalystError:
402 self.unbind()
403 - raise CatalystError,"Script aborting due to error."
404 + raise CatalystError("Script aborting due to error.")
405
406 def livecd_update(self):
407 livecd_update_resume = pjoin(self.settings["autoresume_path"],
408 @@ -1624,6 +1628,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
409
410 except CatalystError:
411 self.unbind()
412 - raise CatalystError,"build aborting due to livecd_update error."
413 + raise CatalystError("build aborting due to livecd_update error.")
414
415 # vim: ts=4 sw=4 sta et sts=4 ai
416
417 diff --git a/catalyst/config.py b/catalyst/config.py
418 index bf3c7c6..c952648 100644
419 --- a/catalyst/config.py
420 +++ b/catalyst/config.py
421 @@ -1,6 +1,6 @@
422
423 import re
424 -from catalyst.support import *
425 +from catalyst.support import CatalystError
426
427 class ParserBase:
428
429 @@ -27,7 +27,8 @@ class ParserBase:
430 try:
431 myf = open(filename, "r")
432 except:
433 - raise CatalystError, "Could not open file " + filename
434 + raise CatalystError("Could not open file " + filename,
435 + print_traceback=True)
436 self.lines = myf.readlines()
437 myf.close()
438 self.filename = filename
439 @@ -42,7 +43,7 @@ class ParserBase:
440 cur_array = []
441
442 trailing_comment=re.compile('\s*#.*$')
443 - white_space=re.compile('\s+')
444 + #white_space=re.compile('\s+')
445
446 for x, myline in enumerate(self.lines):
447 myline = myline.strip()
448 @@ -84,7 +85,7 @@ class ParserBase:
449 # cur_array += mobjs
450 cur_array += myline.split()
451 else:
452 - raise CatalystError, "Syntax error: " + x
453 + raise CatalystError("Syntax error: " + x, print_traceback=True)
454
455 # XXX: Do we really still need this "single value is a string" behavior?
456 if len(cur_array) == 2:
457
458 diff --git a/catalyst/contents.py b/catalyst/contents.py
459 index 79ef9a6..9611890 100644
460 --- a/catalyst/contents.py
461 +++ b/catalyst/contents.py
462 @@ -69,10 +69,10 @@ class ContentsMap(object):
463 func = getattr(self, '_%s_' % self.contents_map[getter].func)
464 return func(file_, self.contents_map[getter].cmd, verbose)
465 except:
466 - raise CatalystError,\
467 - "Error generating contents, is appropriate utility " +\
468 - "(%s) installed on your system?" \
469 - % (self.contents_map[getter].cmd)
470 + raise CatalystError(
471 + "Error generating contents, is appropriate utility " +
472 + "(%s) installed on your system?"
473 + % (self.contents_map[getter].cmd), print_traceback=True)
474
475
476 @staticmethod
477
478 diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
479 index b575ace..39f489b 100644
480 --- a/catalyst/hash_utils.py
481 +++ b/catalyst/hash_utils.py
482 @@ -80,8 +80,8 @@ class HashMap(object):
483 verbose
484 )
485 except:
486 - raise CatalystError,"Error generating hash, is appropriate " + \
487 - "utility installed on your system?"
488 + raise CatalystError("Error generating hash, is appropriate " + \
489 + "utility installed on your system?", traceback=True)
490
491
492 def calc_hash(self, file_, hash_, verbose=False):
493
494 diff --git a/catalyst/lock.py b/catalyst/lock.py
495 index c90f5b8..12d0754 100644
496 --- a/catalyst/lock.py
497 +++ b/catalyst/lock.py
498 @@ -128,7 +128,7 @@ class LockDir:
499 if self.myfd==None:
500 if not os.path.exists(os.path.dirname(self.lockdir)):
501 raise CatalystError("DirectoryNotFound: %s"
502 - % os.path.dirname(self.lockdir))
503 + % os.path.dirname(self.lockdir), print_traceback=True)
504 if not os.path.exists(self.lockfile):
505 old_mask=os.umask(000)
506 self.myfd = os.open(self.lockfile, os.O_CREAT|os.O_RDWR,0660)
507 @@ -275,7 +275,8 @@ class LockDir:
508 self.add_hardlock_file_to_cleanup()
509 if not os.path.exists(self.myhardlock):
510 raise CatalystError("FileNotFound: Created lockfile is missing: "
511 - "%(filename)s" % {"filename":self.myhardlock})
512 + "%(filename)s" % {"filename":self.myhardlock},
513 + print_traceback=True)
514 try:
515 os.link(self.myhardlock, self.lockfile)
516 except SystemExit:
517
518 diff --git a/catalyst/main.py b/catalyst/main.py
519 index 5fa3f1b..56e57c6 100644
520 --- a/catalyst/main.py
521 +++ b/catalyst/main.py
522 @@ -8,10 +8,7 @@
523
524 import os
525 import sys
526 -import imp
527 -import string
528 import getopt
529 -import pdb
530 import os.path
531
532 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
533 @@ -168,7 +165,8 @@ def build_target(addlargs):
534 except:
535 print "Target run() exception: Python traceback output follows:"
536 catalyst.util.print_traceback()
537 - print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
538 + print "!!! catalyst: Error encountered during run of target " + \
539 + addlargs["target"]
540 sys.exit(1)
541
542 def main():
543 @@ -193,14 +191,9 @@ def main():
544 usage()
545 sys.exit(2)
546
547 - # defaults for commandline opts
548 - debug=False
549 - verbose=False
550 - fetch=False
551 myconfig=""
552 myspecfile=""
553 mycmdline=[]
554 - myopts=[]
555
556 # check preconditions
557 if len(opts) == 0:
558 @@ -341,7 +334,7 @@ def main():
559 sys.exit(1)
560
561 if "target" not in addlargs:
562 - raise CatalystError, "Required value \"target\" not specified."
563 + raise CatalystError("Required value \"target\" not specified.")
564
565 # everything is setup, so the build is a go
566 try:
567
568 diff --git a/catalyst/support.py b/catalyst/support.py
569 index aaacaa9..8c4876f 100644
570 --- a/catalyst/support.py
571 +++ b/catalyst/support.py
572 @@ -8,7 +8,6 @@ import traceback
573 import time
574 from subprocess import Popen
575
576 -
577 from catalyst.defaults import verbosity, valid_config_file_values
578
579 selinux_capable = False
580 @@ -50,7 +49,7 @@ def read_from_clst(file):
581 myf=open(file,"r")
582 except:
583 return -1
584 - #raise CatalystError, "Could not open file "+file
585 + #raise CatalystError("Could not open file "+file)
586 for line in myf.readlines():
587 #line = string.replace(line, "\n", "") # drop newline
588 myline = myline + line
589 @@ -85,12 +84,14 @@ def list_to_string(mylist):
590
591
592 class CatalystError(Exception):
593 - def __init__(self, message):
594 + def __init__(self, message, print_traceback=False):
595 if message:
596 - (type,value)=sys.exc_info()[:2]
597 - if value!=None:
598 - print
599 - print traceback.print_exc(file=sys.stdout)
600 + if print_traceback:
601 + (type,value)=sys.exc_info()[:2]
602 + if value!=None:
603 + print
604 + print "Traceback valuse found. listing..."
605 + print traceback.print_exc(file=sys.stdout)
606 print
607 print "!!! catalyst: "+message
608 print
609 @@ -147,17 +148,17 @@ def file_locate(settings,filelist,expand=1):
610 #filenames such as cdtar are optional, so we don't assume the variable is defined.
611 pass
612 else:
613 - if len(settings[myfile])==0:
614 - raise CatalystError("File variable \"" + myfile +
615 - "\" has a length of zero (not specified.)")
616 - if settings[myfile][0]=="/":
617 - if not os.path.exists(settings[myfile]):
618 - raise CatalystError("Cannot locate specified " + myfile +
619 - ": "+settings[myfile])
620 - elif expand and os.path.exists(os.getcwd()+"/"+settings[myfile]):
621 - settings[myfile]=os.getcwd()+"/"+settings[myfile]
622 - else:
623 - raise CatalystError("Cannot locate specified " + myfile +
624 + if len(settings[myfile])==0:
625 + raise CatalystError("File variable \"" + myfile +
626 + "\" has a length of zero (not specified.)", print_traceback=True)
627 + if settings[myfile][0]=="/":
628 + if not os.path.exists(settings[myfile]):
629 + raise CatalystError("Cannot locate specified " + myfile +
630 + ": "+settings[myfile], print_traceback=True)
631 + elif expand and os.path.exists(os.getcwd()+"/"+settings[myfile]):
632 + settings[myfile]=os.getcwd()+"/"+settings[myfile]
633 + else:
634 + raise CatalystError("Cannot locate specified " + myfile +
635 ": "+settings[myfile]+" (2nd try)" +
636 """
637 Spec file format:
638 @@ -178,9 +179,8 @@ would contain an ordered list as well: [ "meep", "bark", "gleep", "moop" ]. It's
639 that the order of multiple-value items is preserved, but the order that the items themselves are
640 defined are not preserved. In other words, "foo", "bar", "oni" ordering is preserved but "item1"
641 "item2" "item3" ordering is not, as the item strings are stored in a dictionary (hash).
642 -"""
643 - )
644 -
645 +""",
646 + print_traceback=True)
647
648 def parse_makeconf(mylines):
649 mymakeconf={}
650 @@ -225,7 +225,8 @@ def read_makeconf(mymakeconffile):
651 myf.close()
652 return parse_makeconf(mylines)
653 except:
654 - raise CatalystError, "Could not parse make.conf file "+mymakeconffile
655 + raise CatalystError("Could not parse make.conf file " +
656 + mymakeconffile, print_traceback=True)
657 else:
658 makeconf={}
659 return makeconf
660 @@ -279,7 +280,7 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
661 messages.append("Required argument \""+x+"\" not specified.")
662
663 if messages:
664 - raise CatalystError, '\n\tAlso: '.join(messages)
665 + raise CatalystError('\n\tAlso: '.join(messages))
666
667
668 def touch(myfile):
669 @@ -287,7 +288,7 @@ def touch(myfile):
670 myf=open(myfile,"w")
671 myf.close()
672 except IOError:
673 - raise CatalystError, "Could not touch "+myfile+"."
674 + raise CatalystError("Could not touch "+myfile+".", print_traceback=True)
675
676
677 def countdown(secs=5, doing="Starting"):
678
679 diff --git a/catalyst/targets/grp.py b/catalyst/targets/grp.py
680 index 0075714..93d30fc 100644
681 --- a/catalyst/targets/grp.py
682 +++ b/catalyst/targets/grp.py
683 @@ -25,7 +25,7 @@ class grp(StageBase):
684 self.valid_values=self.required_values[:]
685 self.valid_values.extend(["grp/use"])
686 if "grp" not in addlargs:
687 - raise CatalystError,"Required value \"grp\" not specified in spec."
688 + raise CatalystError("Required value \"grp\" not specified in spec.")
689
690 self.required_values.extend(["grp"])
691 if type(addlargs["grp"])==types.StringType:
692 @@ -66,7 +66,8 @@ class grp(StageBase):
693
694 except CatalystError:
695 self.unbind()
696 - raise CatalystError,"GRP build aborting due to error."
697 + raise CatalystError("GRP build aborting due to error.",
698 + print_traceback=True)
699
700 def set_use(self):
701 StageBase.set_use(self)
702
703 diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
704 index 661e06e..6cbd91a 100644
705 --- a/catalyst/targets/livecd_stage1.py
706 +++ b/catalyst/targets/livecd_stage1.py
707 @@ -7,6 +7,7 @@ import os
708 import types
709 import string
710
711 +
712 from catalyst.support import (normpath,
713 touch, cmd)
714
715 @@ -45,9 +46,6 @@ class livecd_stage1(StageBase):
716 if not os.path.exists(self.settings["target_path"]):
717 os.makedirs(self.settings["target_path"])
718
719 - def set_target_path(self):
720 - pass
721 -
722 def set_spec_prefix(self):
723 self.settings["spec_prefix"]="livecd"
724
725
726 diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
727 index 20f6014..949ee98 100644
728 --- a/catalyst/targets/livecd_stage2.py
729 +++ b/catalyst/targets/livecd_stage2.py
730 @@ -44,7 +44,9 @@ class livecd_stage2(StageBase):
731 else:
732 self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
733 if not os.path.exists(self.settings["source_path"]):
734 - raise CatalystError,"Source Path: "+self.settings["source_path"]+" does not exist."
735 + raise CatalystError("Source Path: " +
736 + self.settings["source_path"] + " does not exist.",
737 + print_traceback=True)
738
739 def set_spec_prefix(self):
740 self.settings["spec_prefix"]="livecd"
741 @@ -70,7 +72,10 @@ class livecd_stage2(StageBase):
742 myf=open(self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf","a")
743 except:
744 self.unbind()
745 - raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf."
746 + raise CatalystError("Couldn't open " +
747 + self.settings["chroot_path"] +
748 + "/etc/modprobe.d/blacklist.conf.",
749 + print_traceback=True)
750
751 myf.write("\n#Added by Catalyst:")
752 # workaround until config.py is using configparser
753 @@ -122,7 +127,10 @@ class livecd_stage2(StageBase):
754 os.makedirs(self.settings["pkgcache_path"],0755)
755
756 if not display_msg:
757 - raise CatalystError,"Could not find appropriate source. Please check the 'source_subpath' setting in the spec file."
758 + raise CatalystError("Could not find appropriate source.\n"
759 + "Please check the 'source_subpath' "
760 + "setting in the spec file.",
761 + print_traceback=True)
762
763 print display_msg
764 cmd(unpack_cmd,error_msg,env=self.env)
765
766 diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
767 index f753c7f..7ae1d75 100644
768 --- a/catalyst/targets/netboot.py
769 +++ b/catalyst/targets/netboot.py
770 @@ -6,6 +6,7 @@ netboot target, version 1
771 import os
772 import types
773
774 +
775 from catalyst.support import (CatalystError, normpath,
776 cmd, list_bashify, file_locate)
777
778 @@ -39,7 +40,7 @@ class netboot(StageBase):
779 # for x in loopy:
780 # self.required_values.append("netboot/packages/"+x+"/files")
781 except:
782 - raise CatalystError,"configuration error in netboot/packages."
783 + raise CatalystError("configuration error in netboot/packages.")
784
785 StageBase.__init__(self,spec,addlargs)
786 self.set_build_kernel_vars(addlargs)
787 @@ -67,7 +68,8 @@ class netboot(StageBase):
788 # cmd(self.settings["controller_file"]+" packages "+mypack,env=self.env)
789 # except CatalystError:
790 # self.unbind()
791 -# raise CatalystError,"netboot build aborting due to error."
792 +# raise CatalystError("netboot build aborting due to error.",
793 +# print_traceback=True)
794
795 def build_busybox(self):
796 # build busybox
797 @@ -79,7 +81,8 @@ class netboot(StageBase):
798 cmd(self.settings["controller_file"]+" busybox "+ mycmd,env=self.env)
799 except CatalystError:
800 self.unbind()
801 - raise CatalystError,"netboot build aborting due to error."
802 + raise CatalystError("netboot build aborting due to error.",
803 + print_traceback=True)
804
805 def copy_files_to_image(self):
806 # create image
807 @@ -108,7 +111,8 @@ class netboot(StageBase):
808 " image " + list_bashify(myfiles),env=self.env)
809 except CatalystError:
810 self.unbind()
811 - raise CatalystError,"netboot build aborting due to error."
812 + raise CatalystError("netboot build aborting due to error.",
813 + print_traceback=True)
814
815 def create_netboot_files(self):
816 # finish it all up
817 @@ -116,7 +120,8 @@ class netboot(StageBase):
818 cmd(self.settings["controller_file"]+" finish",env=self.env)
819 except CatalystError:
820 self.unbind()
821 - raise CatalystError,"netboot build aborting due to error."
822 + raise CatalystError("netboot build aborting due to error.",
823 + print_traceback=True)
824
825 # end
826 print "netboot: build finished !"
827
828 diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
829 index fc8c64c..dbbb6a9 100644
830 --- a/catalyst/targets/netboot2.py
831 +++ b/catalyst/targets/netboot2.py
832 @@ -43,7 +43,7 @@ class netboot2(StageBase):
833 for x in loopy:
834 self.valid_values.append("netboot2/packages/"+x+"/files")
835 except:
836 - raise CatalystError,"configuration error in netboot2/packages."
837 + raise CatalystError("configuration error in netboot2/packages.")
838
839 StageBase.__init__(self,spec,addlargs)
840 self.set_build_kernel_vars()
841 @@ -98,7 +98,8 @@ class netboot2(StageBase):
842 " image " + list_bashify(myfiles),env=self.env)
843 except CatalystError:
844 self.unbind()
845 - raise CatalystError,"Failed to copy files to image!"
846 + raise CatalystError("Failed to copy files to image!",
847 + print_traceback=True)
848
849 touch(self.settings["autoresume_path"]+"copy_files_to_image")
850
851 @@ -124,7 +125,8 @@ class netboot2(StageBase):
852 print ">>> Netboot Build Finished!"
853 except CatalystError:
854 self.unbind()
855 - raise CatalystError,"Failed to move kernel images!"
856 + raise CatalystError("Failed to move kernel images!",
857 + print_traceback=True)
858
859 def remove(self):
860 if "autoresume" in self.settings["options"] \
861
862 diff --git a/catalyst/targets/tinderbox.py b/catalyst/targets/tinderbox.py
863 index 4cb7537..59e85d0 100644
864 --- a/catalyst/targets/tinderbox.py
865 +++ b/catalyst/targets/tinderbox.py
866 @@ -29,7 +29,8 @@ class tinderbox(StageBase):
867
868 except CatalystError:
869 self.unbind()
870 - raise CatalystError,"Tinderbox aborting due to error."
871 + raise CatalystError("Tinderbox aborting due to error.",
872 + print_traceback=True)
873
874 def set_cleanables(self):
875 self.settings['cleanables'] = [
876
877 diff --git a/targets/stage1/build.py b/targets/stage1/build.py
878 index bf20bcf..b2c8b0f 100755
879 --- a/targets/stage1/build.py
880 +++ b/targets/stage1/build.py
881 @@ -1,6 +1,8 @@
882 #!/usr/bin/python
883
884 -import os,portage,sys
885 +import os
886 +import sys
887 +import portage
888
889 # this loads files from the profiles ...
890 # wrap it here to take care of the different