# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 12 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+ modules/catalyst/__init__.py, modules/catalyst/arch/__init__.py,
+ modules/catalyst/arch/alpha.py, modules/catalyst/arch/arm.py,
+ modules/catalyst/arch/hppa.py, modules/catalyst/arch/ia64.py,
+ modules/catalyst/arch/mips.py, modules/catalyst/arch/s390.py,
+ modules/catalyst/arch/sh.py, modules/catalyst/config.py,
+ modules/catalyst/error.py, modules/catalyst/hash.py,
+ modules/catalyst/output.py, modules/catalyst/spawn.py,
+ modules/catalyst/support.py, modules/catalyst/target/__init__.py,
+ modules/catalyst/target/embedded.py,
+ modules/catalyst/target/generic_stage.py,
+ modules/catalyst/target/livecd_stage1.py,
+ modules/catalyst/target/livecd_stage2.py,
+ modules/catalyst/target/netboot.py, modules/catalyst/util.py:
+ Small cleanups to make pychecker happy
+
11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
modules/catalyst/support.py, modules/catalyst/util.py:
import cleanups
+import catalyst.hash
+import catalyst.arch
+import catalyst.lock
+import catalyst.util
+import catalyst.error
+import catalyst.spawn
+import catalyst.target
+
+hash = catalyst.hash
+arch = catalyst.arch
+lock = catalyst.lock
+util = catalyst.util
+error = catalyst.error
+spawn = catalyst.spawn
+target = catalyst.target
"""
import os
-import imp
import catalyst.util
from catalyst.output import warn
-def find_arch_modules(self):
+def find_arch_modules():
search_dir = os.path.abspath(os.path.dirname(__file__))
arch_module_list = [x[:-3] for x in os.listdir(search_dir) \
if x.endswith('.py') and not x.startswith('__')]
return arch_module_list
-def get_arches(self):
+def get_arches():
arch_modules = {}
for x in find_arch_modules():
arch_modules[x] = catalyst.util.load_module("catalyst.arch." + x)
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_alpha(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_arm(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_hppa(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class arch_ia64(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_mips(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_s390(catalyst.arch.generic_arch):
-import catalyst.arch,os
+import catalyst.arch
from catalyst.support import *
class generic_sh(catalyst.arch.generic_arch):
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()
class CatalystError(Exception):
def __init__(self, message):
if message:
- (type,value)=sys.exc_info()[:2]
+ (extype,value)=sys.exc_info()[:2]
if value!=None:
print
print traceback.print_exc(file=sys.stdout)
class LockInUse(Exception):
def __init__(self, message):
if message:
- #(type,value)=sys.exc_info()[:2]
+ #(extype,value)=sys.exc_info()[:2]
#if value!=None:
#print
#kprint traceback.print_exc(file=sys.stdout)
import os
from catalyst.error import *
+from catalyst.output import warn
def generate_contents(file, contents_function="auto", verbose=False):
try:
header = a.readline()
myline = a.readline().split()
a.close()
- hash = myline[0]
+ tmphash = myline[0]
short_file = os.path.split(myline[1])[1]
- result = header + hash + " " + short_file + "\n"
+ result = header + tmphash + " " + short_file + "\n"
if verbose:
print "%s (%s) = %s" % (header, short_file, result)
return result
import sys
+verbosity = 1
+
def msg(mymsg, verblevel=1):
if verbosity >= verblevel:
print mymsg
This module contains all the functions related to spawning external commands
"""
-import sys, os, types
+import sys, os, types, signal
import catalyst.util
from catalyst.error import *
try:
import resource
- max_fd_limit=resource.getrlimit(RLIMIT_NOFILE)
+ max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)
except SystemExit, e:
raise
except:
valid_config_file_values.append("contents")
valid_config_file_values.append("SEEDCACHE")
-verbosity=1
-
"""
Spec file format:
"""
import os
-import imp
import catalyst.util
from catalyst.output import warn
self.valid_values.append("embedded/fs-ops")
generic_stage_target.__init__(self,spec,addlargs)
- self.set_build_kernel_vars(addlargs)
+ self.set_build_kernel_vars()
def set_action_sequence(self):
self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
the driver class for pretty much everything that Catalyst does.
"""
-import os,string,imp,types,shutil
+import os, string, types, shutil
from catalyst.support import *
from catalyst.target.generic import *
from stat import *
for f in [file, file+'.CONTENTS']:
if os.path.exists(f):
if "all" in array:
- for k in hash_map.keys():
- hash=catalyst.hash.generate_hash(f,hash_function=k,verbose=\
+ for k in catalyst.hash.hash_map.keys():
+ tmphash=catalyst.hash.generate_hash(f,hash_function=k,verbose=\
("VERBOSE" in self.settings))
- myf.write(hash)
+ myf.write(tmphash)
else:
for j in array:
- hash=catalyst.hash.generate_hash(f,hash_function=j,verbose=\
+ tmphash=catalyst.hash.generate_hash(f,hash_function=j,verbose=\
("VERBOSE" in self.settings))
- myf.write(hash)
+ myf.write(tmphash)
myf.close()
def purge(self):
"config_profile_link","setup_confdir","portage_overlay",\
"bind","chroot_setup","setup_environment","build_packages",\
"unbind", "clean","clear_autoresume"]
+
def set_target_path(self):
self.settings["target_path"]=catalyst.util.normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
if "AUTORESUME" in self.settings \
def set_target_path(self):
pass
+
def set_spec_prefix(self):
- self.settings["spec_prefix"]="livecd"
+ self.settings["spec_prefix"]="livecd"
def set_use(self):
generic_stage_target.set_use(self)
Builder class for a LiveCD stage2 build.
"""
-import os,string,types,stat,shutil
+import os
from catalyst.support import *
from generic_stage import *
import catalyst.util
generic_stage_target.__init__(self,spec,addlargs)
- self.set_build_kernel_vars(addlargs)
+ self.set_build_kernel_vars()
if "netboot/busybox_config" in addlargs:
catalyst.util.file_locate(self.settings, ["netboot/busybox_config"])
Collection of utility functions for catalyst
"""
-import sys, traceback, os, os.path, re
+import sys, traceback, os, os.path, re, time
from catalyst.error import *
def capture_traceback():