Massive pyflakes import cleanup and broken CatalystError calls.
authorBrian Dolbec <dolsen@gentoo.org>
Sun, 20 Jan 2013 04:29:16 +0000 (20:29 -0800)
committerBrian Dolbec <dolsen@gentoo.org>
Thu, 28 Feb 2013 01:38:12 +0000 (17:38 -0800)
Replace "import *" with named imports, remove unused imports.
Fix broken CatalystError usage.

32 files changed:
catalyst/arch/alpha.py
catalyst/arch/arm.py
catalyst/arch/hppa.py
catalyst/arch/ia64.py
catalyst/arch/mips.py
catalyst/arch/powerpc.py
catalyst/arch/s390.py
catalyst/arch/sh.py
catalyst/arch/sparc.py
catalyst/arch/x86.py
catalyst/config.py
catalyst/contents.py
catalyst/defaults.py
catalyst/hash_utils.py
catalyst/lock.py
catalyst/main.py
catalyst/support.py
catalyst/targets/embedded_target.py
catalyst/targets/generic_stage_target.py
catalyst/targets/generic_target.py
catalyst/targets/grp_target.py
catalyst/targets/livecd_stage1_target.py
catalyst/targets/livecd_stage2_target.py
catalyst/targets/netboot2_target.py
catalyst/targets/netboot_target.py
catalyst/targets/snapshot_target.py
catalyst/targets/stage1_target.py
catalyst/targets/stage2_target.py
catalyst/targets/stage3_target.py
catalyst/targets/stage4_target.py
catalyst/targets/tinderbox_target.py
targets/stage1/build.py [changed mode: 0644->0755]

index 724802030d503a3ab67cc8c7cb82897e58000b76..01b6382274edc8153ef3455301d0d91e15a2109c 100644 (file)
@@ -1,8 +1,7 @@
 
-import os
 
 from catalyst import builder
-from catalyst.support import *
+
 
 class generic_alpha(builder.generic):
        "abstract base class for all alpha builders"
index 8f207ffffc4fc451574f5d6e4b2f2e6ccdeb96f3..c0d322ca227506da9faaaab10895aae08179f3d8 100644 (file)
@@ -1,8 +1,6 @@
 
-import os
 
 from catalyst import builder
-from catalyst.support import *
 
 class generic_arm(builder.generic):
        "Abstract base class for all arm (little endian) builders"
index 3aac9b6ad3c9fa9aa4835ad242780cbd23788373..c5589c4f49741792950d6eb8fa96e8fb5db9d381 100644 (file)
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_hppa(builder.generic):
        "Abstract base class for all hppa builders"
index 4003085391f0968b6993231a17830fd279b218d4..3f060404a727579ed81e1f3b5ff7e46a38814a9d 100644 (file)
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class arch_ia64(builder.generic):
        "builder class for ia64"
index 7cce3921b58cfa62759aee52eec059acdeeb689c..5297a4b3270f28159a2b4ee27ae866cf89830c0b 100644 (file)
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_mips(builder.generic):
        "Abstract base class for all mips builders [Big-endian]"
index 6cec58077f02d3f31fd1a3f8af11056ce99f360c..f903b38c071a28738e26de1cc2e6533690353d27 100644 (file)
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_ppc(builder.generic):
        "abstract base class for all 32-bit powerpc builders"
@@ -11,7 +11,8 @@ class generic_ppc(builder.generic):
                self.settings["CHOST"]="powerpc-unknown-linux-gnu"
                if self.settings["buildarch"]=="ppc64":
                        if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
-                               raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
+                               raise CatalystError("required executable linux32 not found "
+                                       "(\"emerge setarch\" to fix.)", print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:
index c49e0b769d09cb042ed4f68d17adf869f439fe3b..f2cf80de1d63367838e3414c8d84798d62172c08 100644 (file)
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_s390(builder.generic):
        "abstract base class for all s390 builders"
index 1fa1b0b67715635595b1606f40079e27553b0698..64d6e0e8c90306b291d3d0ddbcde493566502734 100644 (file)
@@ -1,8 +1,5 @@
 
-import os
-
 from catalyst import builder
-from catalyst.support import *
 
 class generic_sh(builder.generic):
        "Abstract base class for all sh builders [Little-endian]"
index 28895287f72db5249d6d577b5912ec83d2de3aac..da2ad35267d2a09736d6420e3d0b7df67ba92c84 100644 (file)
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_sparc(builder.generic):
        "abstract base class for all sparc builders"
@@ -10,7 +10,8 @@ class generic_sparc(builder.generic):
                builder.generic.__init__(self,myspec)
                if self.settings["buildarch"]=="sparc64":
                        if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
-                               raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
+                               raise CatalystError("required executable linux32 not found "
+                                       "(\"emerge setarch\" to fix.)", print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:
index c8d19118ecc7cbfd7d5e8b72d5447152fb7c2ebe..9f1bba24df0d2ddc32ccbb86bc48b7ba0dc136b0 100644 (file)
@@ -2,7 +2,7 @@
 import os
 
 from catalyst import builder
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class generic_x86(builder.generic):
        "abstract base class for all x86 builders"
@@ -10,7 +10,8 @@ class generic_x86(builder.generic):
                builder.generic.__init__(self,myspec)
                if self.settings["buildarch"]=="amd64":
                        if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
-                                       raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
+                                       raise CatalystError("required executable linux32 not found "
+                                               "(\"emerge setarch\" to fix.)", print_traceback=True)
                        self.settings["CHROOT"]="linux32 chroot"
                        self.settings["crosscompile"] = False;
                else:
index 0684855daff57a08185a16a06e1a6e2ccc818110..201533576fff0fa041f0654a0f3935fad4287806 100644 (file)
@@ -1,5 +1,5 @@
 import re
-from catalyst.support import *
+from catalyst.support import CatalystError
 
 class ParserBase:
 
@@ -26,7 +26,8 @@ class ParserBase:
                try:
                        myf = open(filename, "r")
                except:
-                       raise CatalystError, "Could not open file " + filename
+                       raise CatalystError("Could not open file " + filename,
+                               print_traceback=True)
                self.lines = myf.readlines()
                myf.close()
                self.filename = filename
@@ -41,7 +42,7 @@ class ParserBase:
                cur_array = []
 
                trailing_comment=re.compile('\s*#.*$')
-               white_space=re.compile('\s+')
+               #white_space=re.compile('\s+')
 
                for x, myline in enumerate(self.lines):
                        myline = myline.strip()
@@ -84,7 +85,7 @@ class ParserBase:
 #                                      cur_array += mobjs
                                        cur_array += myline.split()
                                else:
-                                       raise CatalystError, "Syntax error: " + x
+                                       raise CatalystError("Syntax error: " + x, print_traceback=True)
 
                        # XXX: Do we really still need this "single value is a string" behavior?
                        if len(cur_array) == 2:
index 0ecabbd15f453b59a07feba2d5128e2bcd3789bc..1a9ed28a58cc63ed954ca8bdbcd1b594e8a7f2e5 100644 (file)
@@ -54,10 +54,10 @@ class ContentsMap(object):
                                func = getattr(self, '_%s_' % self.contents_map[getter].func)
                                return func(file_, self.contents_map[getter].cmd, verbose)
                except:
-                       raise CatalystError,\
-                               "Error generating contents, is appropriate utility " +\
-                               "(%s) installed on your system?" \
-                               % (self.contents_map[getter].cmd)
+                       raise CatalystError(
+                               "Error generating contents, is appropriate utility " +
+                               "(%s) installed on your system?"
+                               % (self.contents_map[getter].cmd), print_traceback=True)
 
 
        @staticmethod
index f87bc8bbc11826aade46ff648acc08adbf2883d3..2a0a3ffb04ebf07a774b62256534cfb9663e6ee3 100644 (file)
@@ -1,7 +1,7 @@
 
 
 # these should never be touched
-required_build_targets = ["generic_target", "generic_stage_target"]
+required_build_targets = ["generic_stage_target"]
 
 # new build types should be added here
 valid_build_targets = ["stage1_target", "stage2_target", "stage3_target",
index 0dfe98b6e0e527bd8e1c55fd69d40425b4a2a753..b03c6ed1cd94a28f2a11c80d680ea9e818c36ea8 100644 (file)
@@ -49,8 +49,8 @@ class HashMap(object):
                                verbose
                                )
                except:
-                       raise CatalystError,"Error generating hash, is appropriate " + \
-                               "utility installed on your system?"
+                       raise CatalystError("Error generating hash, is appropriate " + \
+                               "utility installed on your system?", traceback=True)
 
 
        def calc_hash(self, file_, hash_, verbose=False):
@@ -71,7 +71,7 @@ class HashMap(object):
                mylines=mylines[0].split()
                result=mylines[0]
                if verbose:
-                       print _hash_.id + " (%s) = %s" % (file_, result)
+                       print _hash.id + " (%s) = %s" % (file_, result)
                return result
 
 
index ef00b49c52133dccef8a202aff6ff0207942570b..b963af231089e2e8a32d8b8c4bb15edb30f7de65 100644 (file)
@@ -122,7 +122,7 @@ class LockDir:
                if self.myfd==None:
                        if not os.path.exists(os.path.dirname(self.lockdir)):
                                raise CatalystError("DirectoryNotFound: %s"
-                                       % os.path.dirname(self.lockdir))
+                                       % os.path.dirname(self.lockdir), print_traceback=True)
                        if not os.path.exists(self.lockfile):
                                old_mask=os.umask(000)
                                self.myfd = os.open(self.lockfile, os.O_CREAT|os.O_RDWR,0660)
@@ -265,7 +265,8 @@ class LockDir:
                        self.add_hardlock_file_to_cleanup()
                        if not os.path.exists(self.myhardlock):
                                raise CatalystError("FileNotFound: Created lockfile is missing: "
-                                       "%(filename)s" % {"filename":self.myhardlock})
+                                       "%(filename)s" % {"filename":self.myhardlock},
+                                       print_traceback=True)
                        try:
                                os.link(self.myhardlock, self.lockfile)
                        except SystemExit:
index 21815455eee5a1ee0d49999ef52165849e28bb35..936a9960589650de33ecbc8b0d587e324f988301 100644 (file)
@@ -7,8 +7,10 @@
 # Chris Gianelloni <wolf31o2@wolf31o2.org>
 # $Id$
 
-import os, sys, imp, string, getopt
-import pdb
+import os
+import sys
+import imp
+import getopt
 import os.path
 
 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
@@ -154,8 +156,8 @@ def import_modules():
                                fh.close()
 
                        except IOError:
-                               raise CatalystError, "Can't find " + x + ".py plugin in " + \
-                                       module_dir
+                               raise CatalystError("Can't find " + x + ".py plugin in " +
+                                       module_dir, print_traceback=True)
                for x in valid_build_targets:
                        try:
                                fh=open(module_dir + x + ".py")
@@ -165,8 +167,8 @@ def import_modules():
                                fh.close()
 
                        except IOError:
-                               raise CatalystError,"Can't find " + x + ".py plugin in " + \
-                                       module_dir
+                               raise CatalystError("Can't find " + x + ".py plugin in " +
+                                       module_dir, print_traceback=True)
 
        except ImportError as e:
                print "!!! catalyst: Python modules not found in "+\
@@ -179,15 +181,18 @@ def import_modules():
 def build_target(addlargs, targetmap):
        try:
                if addlargs["target"] not in targetmap:
-                       raise CatalystError, \
-                               "Target \"%s\" not available." % addlargs["target"]
+                       raise CatalystError(
+                               "Target \"%s\" not available." % addlargs["target"],
+                               print_traceback=True)
 
                mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
 
                mytarget.run()
 
        except:
+               print "Python traceback output follows:"
                catalyst.util.print_traceback()
+               print
                print "!!! catalyst: Error encountered during run of target " + \
                        addlargs["target"]
                sys.exit(1)
@@ -219,14 +224,9 @@ def main():
                usage()
                sys.exit(2)
 
-       # defaults for commandline opts
-       debug=False
-       verbose=False
-       fetch=False
        myconfig=""
        myspecfile=""
        mycmdline=[]
-       myopts=[]
 
        # check preconditions
        if len(opts) == 0:
@@ -367,7 +367,7 @@ def main():
                        sys.exit(1)
 
        if "target" not in addlargs:
-               raise CatalystError, "Required value \"target\" not specified."
+               raise CatalystError("Required value \"target\" not specified.")
 
        # everything is setup, so the build is a go
        try:
index 0940db58daf46d2a5059265d44e5b96e8b36c6e5..2c394186202629cc110d7acbb0dd598f8f374778 100644 (file)
@@ -2,7 +2,7 @@
 import sys,string,os,types,re,signal,traceback,time
 #import md5,sha
 
-from catalyst.defaults import verbosity
+from catalyst.defaults import verbosity, valid_config_file_values
 
 selinux_capable = False
 #userpriv_capable = (os.getuid() == 0)
@@ -71,7 +71,7 @@ def read_from_clst(file):
                myf=open(file,"r")
        except:
                return -1
-               #raise CatalystError, "Could not open file "+file
+               #raise CatalystError("Could not open file "+file)
        for line in myf.readlines():
            #line = string.replace(line, "\n", "") # drop newline
            myline = myline + line
@@ -104,12 +104,14 @@ def list_to_string(mylist):
        return mypack
 
 class CatalystError(Exception):
-       def __init__(self, message):
+       def __init__(self, message, print_traceback=False):
                if message:
-                       (type,value)=sys.exc_info()[:2]
-                       if value!=None:
-                               print
-                               print traceback.print_exc(file=sys.stdout)
+                       if print_traceback:
+                               (type,value)=sys.exc_info()[:2]
+                               if value!=None:
+                                       print
+                                       print "Traceback valuse found.  listing..."
+                                       print traceback.print_exc(file=sys.stdout)
                        print
                        print "!!! catalyst: "+message
                        print
@@ -371,7 +373,8 @@ def cmd(mycmd,myexc="",env={}):
                sys.stdout.flush()
                retval=spawn_bash(mycmd,env)
                if retval != 0:
-                       raise CatalystError,myexc
+                       raise CatalystError("cmd() NON-zero return value from: %s" % myexc,
+                               print_traceback=True)
        except:
                raise
 
@@ -398,14 +401,17 @@ def file_locate(settings,filelist,expand=1):
                        pass
                else:
                    if len(settings[myfile])==0:
-                           raise CatalystError, "File variable \""+myfile+"\" has a length of zero (not specified.)"
+                           raise CatalystError("File variable \"" + myfile +
+                                       "\" has a length of zero (not specified.)", print_traceback=True)
                    if settings[myfile][0]=="/":
                            if not os.path.exists(settings[myfile]):
-                                   raise CatalystError, "Cannot locate specified "+myfile+": "+settings[myfile]
+                                   raise CatalystError("Cannot locate specified " + myfile +
+                                               ": "+settings[myfile], print_traceback=True)
                    elif expand and os.path.exists(os.getcwd()+"/"+settings[myfile]):
                            settings[myfile]=os.getcwd()+"/"+settings[myfile]
                    else:
-                           raise CatalystError, "Cannot locate specified "+myfile+": "+settings[myfile]+" (2nd try)"
+                           raise CatalystError("Cannot locate specified " + myfile +
+                                       ": "+settings[myfile]+" (2nd try)" +
 """
 Spec file format:
 
@@ -426,6 +432,7 @@ that the order of multiple-value items is preserved, but the order that the item
 defined are not preserved. In other words, "foo", "bar", "oni" ordering is preserved but "item1"
 "item2" "item3" ordering is not, as the item strings are stored in a dictionary (hash).
 """
+, print_traceback=True)
 
 def parse_makeconf(mylines):
        mymakeconf={}
@@ -469,7 +476,8 @@ def read_makeconf(mymakeconffile):
                                                myf.close()
                                                return parse_makeconf(mylines)
                except:
-                       raise CatalystError, "Could not parse make.conf file "+mymakeconffile
+                       raise CatalystError("Could not parse make.conf file " +
+                               mymakeconffile, print_traceback=True)
        else:
                makeconf={}
                return makeconf
@@ -519,14 +527,14 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
                        messages.append("Required argument \""+x+"\" not specified.")
 
        if messages:
-               raise CatalystError, '\n\tAlso: '.join(messages)
+               raise CatalystError('\n\tAlso: '.join(messages))
 
 def touch(myfile):
        try:
                myf=open(myfile,"w")
                myf.close()
        except IOError:
-               raise CatalystError, "Could not touch "+myfile+"."
+               raise CatalystError("Could not touch "+myfile+".", print_traceback=True)
 
 def countdown(secs=5, doing="Starting"):
         if secs:
index 7cee7a66aa93cf13ec466b8e7390351fd93eb852..cbc2684da2c93fe6b9a0556d7d6b1d26cf3d7c08 100644 (file)
@@ -10,10 +10,10 @@ ROOT=/tmp/submerge emerge --something foo bar .
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_stage_target import *
-from stat import *
+
+from catalyst.support import normpath
+
+from generic_stage_target import generic_stage_target
 
 class embedded_target(generic_stage_target):
        """
index 078e6b503ad35da999063252800e8860b8b83799..8c209b7c92d22040e7fb86a898c69c40382f4d13 100644 (file)
@@ -1,7 +1,18 @@
-import os,string,imp,types,shutil
-from catalyst.support import *
-from generic_target import *
-from stat import *
+
+import os
+import string
+import imp
+import types
+import shutil
+import sys
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import (CatalystError, msg, file_locate, normpath,
+       touch, cmd, warn, list_bashify, countdown, read_makeconf, read_from_clst,
+       ismount)
+
+from generic_target import generic_target
 from catalyst.lock import LockDir
 
 
@@ -81,7 +92,7 @@ class generic_stage_target(generic_target):
                if "chost" in self.settings:
                        hostmachine = self.settings["chost"].split("-")[0]
                        if hostmachine not in machinemap:
-                               raise CatalystError, "Unknown host machine type "+hostmachine
+                               raise CatalystError("Unknown host machine type "+hostmachine)
                        self.settings["hostarch"]=machinemap[hostmachine]
                else:
                        hostmachine = self.settings["subarch"]
@@ -93,7 +104,7 @@ class generic_stage_target(generic_target):
                else:
                        buildmachine = os.uname()[4]
                if buildmachine not in machinemap:
-                       raise CatalystError, "Unknown build machine type "+buildmachine
+                       raise CatalystError("Unknown build machine type "+buildmachine)
                self.settings["buildarch"]=machinemap[buildmachine]
                self.settings["crosscompile"]=(self.settings["hostarch"]!=\
                        self.settings["buildarch"])
@@ -212,9 +223,9 @@ class generic_stage_target(generic_target):
                        else:
                                ccdir="/root/.ccache"
                        if not os.path.isdir(ccdir):
-                               raise CatalystError,\
+                               raise CatalystError(
                                        "Compiler cache support can't be enabled (can't find "+\
-                                       ccdir+")"
+                                       ccdir+")")
                        self.mounts.append("ccache")
                        self.mountmap["ccache"]=ccdir
                        """ for the chroot: """
@@ -270,8 +281,9 @@ class generic_stage_target(generic_target):
 
        def set_source_subpath(self):
                if type(self.settings["source_subpath"])!=types.StringType:
-                       raise CatalystError,\
-                               "source_subpath should have been a string. Perhaps you have something wrong in your spec file?"
+                       raise CatalystError(
+                               "source_subpath should have been a string. Perhaps you have " +\
+                               "something wrong in your spec file?")
 
        def set_pkgcache_path(self):
                if "pkgcache_path" in self.settings:
@@ -464,8 +476,8 @@ class generic_stage_target(generic_target):
                        self.settings["iso_volume_id"]=\
                                self.settings[self.settings["spec_prefix"]+"/volid"]
                        if len(self.settings["iso_volume_id"])>32:
-                               raise CatalystError,\
-                                       "ISO volume ID must not exceed 32 characters."
+                               raise CatalystError(
+                                       "ISO volume ID must not exceed 32 characters.")
                else:
                        self.settings["iso_volume_id"]="catalyst "+self.settings["snapshot"]
 
@@ -624,11 +636,13 @@ class generic_stage_target(generic_target):
                                        """ Try to umount stuff ourselves """
                                        self.unbind()
                                        if ismount(mypath + self.mountmap[x]):
-                                               raise CatalystError, "Auto-unbind failed for " + self.mountmap[x]
+                                               raise CatalystError("Auto-unbind failed for " +
+                                                       self.mountmap[x])
                                        else:
                                                print "Auto-unbind successful..."
                                except CatalystError:
-                                       raise CatalystError, "Unable to auto-unbind " + self.mountmap[x]
+                                       raise CatalystError("Unable to auto-unbind " +
+                                               self.mountmap[x])
 
        def unpack(self):
                unpack=True
@@ -722,8 +736,8 @@ class generic_stage_target(generic_target):
                                        invalid_snapshot=True
                                elif os.path.isdir(self.settings["source_path"]):
                                        """ We should never reach this, so something is very wrong """
-                                       raise CatalystError,\
-                                               "source path is a dir but seedcache is not enabled"
+                                       raise CatalystError(
+                                               "source path is a dir but seedcache is not enabled")
 
                if unpack:
                        self.mount_safety_check()
@@ -924,7 +938,7 @@ class generic_stage_target(generic_target):
                                                self.settings["chroot_path"] + src)
                        if retval!=0:
                                self.unbind()
-                               raise CatalystError,"Couldn't bind mount " + src
+                               raise CatalystError("Couldn't bind mount " + src)
 
        def unbind(self):
                ouch=0
@@ -970,8 +984,8 @@ class generic_stage_target(generic_target):
                        this to potentially prevent an upcoming bash stage cleanup script
                        from wiping our bind mounts.
                        """
-                       raise CatalystError,\
-                               "Couldn't umount one or more bind-mounts; aborting for safety."
+                       raise CatalystError(
+                               "Couldn't umount one or more bind-mounts; aborting for safety.")
 
        def chroot_setup(self):
                self.makeconf=read_makeconf(self.settings["chroot_path"]+\
@@ -995,8 +1009,9 @@ class generic_stage_target(generic_target):
                        """ Copy over the envscript, if applicable """
                        if "envscript" in self.settings:
                                if not os.path.exists(self.settings["envscript"]):
-                                       raise CatalystError,\
-                                               "Can't find envscript "+self.settings["envscript"]
+                                       raise CatalystError(
+                                               "Can't find envscript " + self.settings["envscript"],
+                                               print_traceback=True)
 
                                print "\nWarning!!!!"
                                print "\tOverriding certain env variables may cause catastrophic failure."
@@ -1195,7 +1210,7 @@ class generic_stage_target(generic_target):
 
                        except:
                                self.unbind()
-                               raise CatalystError, "Build failed, could not execute preclean"
+                               raise CatalystError("Build failed, could not execute preclean")
 
        def capture(self):
                if "autoresume" in self.settings["options"] \
@@ -1235,7 +1250,8 @@ class generic_stage_target(generic_target):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Stage build aborting due to error."
+                               raise CatalystError("Stage build aborting due to error.",
+                                       print_traceback=True)
 
        def setup_environment(self):
                """
@@ -1393,8 +1409,8 @@ class generic_stage_target(generic_target):
                                                touch(self.settings["autoresume_path"]+"build_packages")
                                        except CatalystError:
                                                self.unbind()
-                                               raise CatalystError,self.settings["spec_prefix"]+\
-                                                       "build aborting due to error."
+                                               raise CatalystError(self.settings["spec_prefix"]+\
+                                                       "build aborting due to error.")
 
        def build_kernel(self):
                if "autoresume" in self.settings["options"] \
@@ -1417,8 +1433,9 @@ class generic_stage_target(generic_target):
                                        touch(self.settings["autoresume_path"]+"build_kernel")
                                except CatalystError:
                                        self.unbind()
-                                       raise CatalystError,\
-                                               "build aborting due to kernel build error."
+                                       raise CatalystError(
+                                               "build aborting due to kernel build error.",
+                                               print_traceback=True)
 
        def _build_kernel(self, kname):
                "Build a single configured kernel by name"
@@ -1531,7 +1548,7 @@ class generic_stage_target(generic_target):
                                touch(self.settings["autoresume_path"]+"bootloader")
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Script aborting due to error."
+                               raise CatalystError("Script aborting due to error.")
 
        def livecd_update(self):
                if "autoresume" in self.settings["options"] \
@@ -1546,7 +1563,7 @@ class generic_stage_target(generic_target):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"build aborting due to livecd_update error."
+                               raise CatalystError("build aborting due to livecd_update error.")
 
        def clear_chroot(self):
                myemp=self.settings["chroot_path"]
index de519942063da6fb479f66bdf145c4cb6ec84b77..d3b9511ec5e1e1a2498bc67737199e991be9b0dd 100644 (file)
@@ -1,4 +1,6 @@
-from catalyst.support import *
+
+
+from catalyst.support import addl_arg_parse
 
 class generic_target:
        """
index a8309a81a653abf28dd6f86b3011a66ae4b25db0..7c9213341abb3163e0759239fedfea4a7d87f58b 100644 (file)
@@ -3,9 +3,16 @@ Gentoo Reference Platform (GRP) target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,types,glob
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import glob
+
+
+from catalyst.support import (CatalystError, normpath,
+       touch, cmd, list_bashify)
+
+from generic_stage_target import generic_stage_target
+
 
 class grp_target(generic_stage_target):
        """
@@ -18,7 +25,7 @@ class grp_target(generic_stage_target):
                self.valid_values=self.required_values[:]
                self.valid_values.extend(["grp/use"])
                if "grp" not in addlargs:
-                       raise CatalystError,"Required value \"grp\" not specified in spec."
+                       raise CatalystError("Required value \"grp\" not specified in spec.")
 
                self.required_values.extend(["grp"])
                if type(addlargs["grp"])==types.StringType:
@@ -59,7 +66,8 @@ class grp_target(generic_stage_target):
 
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"GRP build aborting due to error."
+                               raise CatalystError("GRP build aborting due to error.",
+                                       print_traceback=True)
 
        def set_use(self):
                generic_stage_target.set_use(self)
index 6273c9e81f2fabc3925d5c43a1b6cae9df912075..9a53fd13f87a3f2a0153c6abd09b80a7c6df5a6c 100644 (file)
@@ -3,8 +3,16 @@ LiveCD stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import string
+
+
+from catalyst.support import (normpath,
+       touch, cmd)
+
+from generic_stage_target import generic_stage_target
+
 
 class livecd_stage1_target(generic_stage_target):
        """
@@ -38,9 +46,6 @@ class livecd_stage1_target(generic_stage_target):
                        if not os.path.exists(self.settings["target_path"]):
                                os.makedirs(self.settings["target_path"])
 
-       def set_target_path(self):
-               pass
-
        def set_spec_prefix(self):
                        self.settings["spec_prefix"]="livecd"
 
index e89ed73b38b2294386dff78bc73c97ebad69630b..ed398578657f5fc01dff67184712fcc39c28b481 100644 (file)
@@ -3,9 +3,13 @@ LiveCD stage2 target, builds upon previous LiveCD stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types,stat,shutil
-from catalyst.support import *
-from generic_stage_target import *
+import os
+
+
+from catalyst.support import (normpath, file_locate, CatalystError, cmd,
+       read_from_clst, touch)
+from generic_stage_target import generic_stage_target
+
 
 class livecd_stage2_target(generic_stage_target):
        """
@@ -35,11 +39,15 @@ class livecd_stage2_target(generic_stage_target):
        def set_source_path(self):
                self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
                if os.path.isfile(self.settings["source_path"]):
-                       self.settings["source_path_hash"]=generate_hash(self.settings["source_path"])
+                       self.settings["source_path_hash"] = \
+                               self.settings["hash_map"].generate_hash(
+                                       self.settings["source_path"])
                else:
                        self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/")
                if not os.path.exists(self.settings["source_path"]):
-                       raise CatalystError,"Source Path: "+self.settings["source_path"]+" does not exist."
+                       raise CatalystError("Source Path: " +
+                               self.settings["source_path"] + " does not exist.",
+                                       print_traceback=True)
 
        def set_spec_prefix(self):
            self.settings["spec_prefix"]="livecd"
@@ -65,7 +73,10 @@ class livecd_stage2_target(generic_stage_target):
                                myf=open(self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf","a")
                        except:
                                self.unbind()
-                               raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/modprobe.d/blacklist.conf."
+                               raise CatalystError("Couldn't open " +
+                                       self.settings["chroot_path"] +
+                                       "/etc/modprobe.d/blacklist.conf.",
+                                       print_traceback=True)
 
                        myf.write("\n#Added by Catalyst:")
                        for x in self.settings["livecd/modblacklist"]:
@@ -114,7 +125,10 @@ class livecd_stage2_target(generic_stage_target):
                                        os.makedirs(self.settings["pkgcache_path"],0755)
 
                        if not display_msg:
-                               raise CatalystError,"Could not find appropriate source. Please check the 'source_subpath' setting in the spec file."
+                               raise CatalystError("Could not find appropriate source.\n"
+                                       "Please check the 'source_subpath' "
+                                       "setting in the spec file.",
+                                       print_traceback=True)
 
                        print display_msg
                        cmd(unpack_cmd,error_msg,env=self.env)
index 8809dd0ff9230e19101a24ae19d5170dd5eb9da5..3077cf7070a3d3914039a5eecd5f3cd04fbac75e 100644 (file)
@@ -3,9 +3,17 @@ netboot target, version 2
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import (CatalystError, normpath,
+       touch, cmd, list_bashify)
+
+from generic_stage_target import generic_stage_target
+
 
 class netboot2_target(generic_stage_target):
        """
@@ -36,7 +44,7 @@ class netboot2_target(generic_stage_target):
                                for x in loopy:
                                        self.valid_values.append("netboot2/packages/"+x+"/files")
                except:
-                       raise CatalystError,"configuration error in netboot2/packages."
+                       raise CatalystError("configuration error in netboot2/packages.")
 
                generic_stage_target.__init__(self,spec,addlargs)
                self.set_build_kernel_vars()
@@ -91,7 +99,8 @@ class netboot2_target(generic_stage_target):
                                        " image " + list_bashify(myfiles),env=self.env)
                        except CatalystError:
                                self.unbind()
-                               raise CatalystError,"Failed to copy files to image!"
+                               raise CatalystError("Failed to copy files to image!",
+                                       print_traceback=True)
 
                        touch(self.settings["autoresume_path"]+"copy_files_to_image")
 
@@ -117,7 +126,8 @@ class netboot2_target(generic_stage_target):
                        print ">>> Netboot Build Finished!"
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"Failed to move kernel images!"
+                       raise CatalystError("Failed to move kernel images!",
+                               print_traceback=True)
 
        def remove(self):
                if "autoresume" in self.settings["options"] \
index 9d01b7e2e21bb4287b81eecbc7b245609528b6be..c2e40b61d65b6f55bd9855f14c9661e0ca1d2d56 100644 (file)
@@ -3,9 +3,15 @@ netboot target, version 1
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os,string,types
-from catalyst.support import *
-from generic_stage_target import *
+import os
+import types
+
+
+from catalyst.support import (CatalystError, normpath,
+       cmd, list_bashify, file_locate)
+
+from generic_stage_target import generic_stage_target
+
 
 class netboot_target(generic_stage_target):
        """
@@ -34,7 +40,7 @@ class netboot_target(generic_stage_target):
                #       for x in loopy:
                #               self.required_values.append("netboot/packages/"+x+"/files")
                except:
-                       raise CatalystError,"configuration error in netboot/packages."
+                       raise CatalystError("configuration error in netboot/packages.")
 
                generic_stage_target.__init__(self,spec,addlargs)
                self.set_build_kernel_vars(addlargs)
@@ -62,7 +68,8 @@ class netboot_target(generic_stage_target):
 #                      cmd("/bin/bash "+self.settings["controller_file"]+" packages "+mypack,env=self.env)
 #              except CatalystError:
 #                      self.unbind()
-#                      raise CatalystError,"netboot build aborting due to error."
+#                      raise CatalystError("netboot build aborting due to error.",
+#                                      print_traceback=True)
 
        def build_busybox(self):
                # build busybox
@@ -74,7 +81,8 @@ class netboot_target(generic_stage_target):
                        cmd("/bin/bash "+self.settings["controller_file"]+" busybox "+ mycmd,env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
+                       raise CatalystError("netboot build aborting due to error.",
+                               print_traceback=True)
 
        def copy_files_to_image(self):
                # create image
@@ -103,7 +111,8 @@ class netboot_target(generic_stage_target):
                                " image " + list_bashify(myfiles),env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
+                       raise CatalystError("netboot build aborting due to error.",
+                               print_traceback=True)
 
        def create_netboot_files(self):
                # finish it all up
@@ -111,7 +120,8 @@ class netboot_target(generic_stage_target):
                        cmd("/bin/bash "+self.settings["controller_file"]+" finish",env=self.env)
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"netboot build aborting due to error."
+                       raise CatalystError("netboot build aborting due to error.",
+                               print_traceback=True)
 
                # end
                print "netboot: build finished !"
index 0329a61220ec6ee9ae57a9158ad2e847d6df4079..4fecef39dc135be243a338b39064777524c8ac28 100644 (file)
@@ -3,8 +3,12 @@ Snapshot target
 """
 
 import os
-from catalyst.support import *
-from generic_stage_target import *
+import shutil
+from stat import ST_UID, ST_GID, ST_MODE
+
+
+from catalyst.support import normpath, cmd
+from generic_stage_target import generic_stage_target
 
 class snapshot_target(generic_stage_target):
        """
@@ -14,7 +18,7 @@ class snapshot_target(generic_stage_target):
                self.required_values=["version_stamp","target"]
                self.valid_values=["version_stamp","target"]
 
-               generic_target.__init__(self,myspec,addlargs)
+               generic_stage_target.__init__(self,myspec,addlargs)
                self.settings=myspec
                self.settings["target_subpath"]="portage"
                st=self.settings["storedir"]
index 25f7116e6613bef84bfdba70fe0d9515db2d69e9..57d2b6aa8b3f0da3f452f9ff3052a63b2326a533 100644 (file)
@@ -3,8 +3,13 @@ stage1 target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+
+import os
+
+
+from catalyst.support import normpath, list_to_string
+from generic_stage_target import generic_stage_target
+
 
 class stage1_target(generic_stage_target):
        """
index 94d4a1e79d31229eb00ecf172d6c619663b104cf..ad06935f4cff5a04e8620b9d0f6564cc65efe424 100644 (file)
@@ -3,8 +3,12 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+import os
+
+
+from catalyst.support import normpath, list_to_string
+from generic_stage_target import generic_stage_target
+
 
 class stage2_target(generic_stage_target):
        """
index 89edd6613b932c396d8cbc2751e5b93eb5261f70..63b9ebc79168a7c0897bdf72ec1acf00323bfa95 100644 (file)
@@ -3,8 +3,9 @@ stage3 target, builds upon previous stage2/stage3 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+
+from generic_stage_target import generic_stage_target
+
 
 class stage3_target(generic_stage_target):
        """
index e2b8a79a24e546c1d6eb287a24fbdadcd94df7ba..9b48e6f95e2056b3314a2718466717c24106394c 100644 (file)
@@ -3,8 +3,9 @@ stage4 target, builds upon previous stage3/stage4 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+
+from generic_stage_target import generic_stage_target
+
 
 class stage4_target(generic_stage_target):
        """
index 5985c5bbd7d1bab92b2d1733f276117c07b2dab6..8ebca21f410100f976341cb609b4054687552b36 100644 (file)
@@ -3,8 +3,13 @@ Tinderbox target
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-from catalyst.support import *
-from generic_stage_target import *
+
+import os
+
+
+from catalyst.support import cmd, list_bashify, CatalystError
+from generic_stage_target import generic_stage_target
+
 
 class tinderbox_target(generic_stage_target):
        """
@@ -26,7 +31,8 @@ class tinderbox_target(generic_stage_target):
 
                except CatalystError:
                        self.unbind()
-                       raise CatalystError,"Tinderbox aborting due to error."
+                       raise CatalystError("Tinderbox aborting due to error.",
+                               print_traceback=True)
 
        def set_cleanables(self):
            self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
old mode 100644 (file)
new mode 100755 (executable)
index bf20bcf..b2c8b0f
@@ -1,6 +1,8 @@
 #!/usr/bin/python
 
-import os,portage,sys
+import os
+import sys
+import portage
 
 # this loads files from the profiles ...
 # wrap it here to take care of the different