From: Andrew Gaffney Date: Sun, 11 Jan 2009 06:32:09 +0000 (-0600) Subject: Kill lots and lots of trailing whitespace in .py files X-Git-Tag: CATALYST-2.0.10~3^2~216 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5429cbe31f85f97ff7579771c2c4382f439d0f1b;p=catalyst.git Kill lots and lots of trailing whitespace in .py files --- diff --git a/ChangeLog b/ChangeLog index f5e7dbc8..58d0be7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,19 @@ # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 11 Jan 2009; Andrew Gaffney + modules/catalyst/arch/arm.py, modules/catalyst/arch/mips.py, + modules/catalyst/arch/x86.py, modules/catalyst/config.py, + modules/catalyst/lock.py, modules/catalyst/support.py, + modules/catalyst/target/generic_stage.py, modules/catalyst/target/grp.py, + modules/catalyst/target/livecd_stage1.py, + modules/catalyst/target/livecd_stage2.py, + modules/catalyst/target/netboot.py, modules/catalyst/target/netboot2.py, + modules/catalyst/target/snapshot.py, modules/catalyst/target/stage1.py, + modules/catalyst/target/stage2.py, modules/catalyst/target/tinderbox.py, + targets/stage1/build.py: + Kill lots and lots of trailing whitespace in .py files + 11 Jan 2009; Andrew Gaffney modules/catalyst/target/generic_stage.py: Fix up a few bad replacements from previous commit diff --git a/modules/catalyst/arch/arm.py b/modules/catalyst/arch/arm.py index 470868a8..e4bc2c52 100644 --- a/modules/catalyst/arch/arm.py +++ b/modules/catalyst/arch/arm.py @@ -9,7 +9,7 @@ class generic_arm(catalyst.arch.generic_arch): self.settings["CHROOT"]="chroot" self.settings["CFLAGS"]="-O2 -pipe" self.settings["CXXFLAGS"]="-O1 -pipe" - + class generic_armeb(catalyst.arch.generic_arch): "Abstract base class for all arm (big endian) builders" def __init__(self,myspec): diff --git a/modules/catalyst/arch/mips.py b/modules/catalyst/arch/mips.py index ff770d53..de0ab3e1 100644 --- a/modules/catalyst/arch/mips.py +++ b/modules/catalyst/arch/mips.py @@ -163,7 +163,7 @@ class arch_ip30_n32(generic_mipsel): arch_mips4_n32.__init__(self,myspec) self.settings["HOSTUSE"]=["ip30","n32"] -__subarch_map = { +__subarch_map = { "cobalt" : arch_cobalt, "cobalt_n32" : arch_cobalt_n32, "ip27" : arch_ip27, diff --git a/modules/catalyst/arch/x86.py b/modules/catalyst/arch/x86.py index dac91f8e..960c6e1d 100644 --- a/modules/catalyst/arch/x86.py +++ b/modules/catalyst/arch/x86.py @@ -55,7 +55,7 @@ class arch_pentium_mmx(generic_x86): generic_x86.__init__(self,myspec) self.settings["CFLAGS"]="-O2 -march=pentium-mmx -pipe" self.settings["HOSTUSE"]=["mmx"] - + class arch_pentium2(generic_x86): "Intel Pentium 2 CPU with MMX support" def __init__(self,myspec): diff --git a/modules/catalyst/config.py b/modules/catalyst/config.py index f4c351d7..6f53bdd2 100644 --- a/modules/catalyst/config.py +++ b/modules/catalyst/config.py @@ -45,7 +45,7 @@ class ParserBase: for x, myline in enumerate(self.lines): myline = myline.strip() - # Force the line to be clean + # Force the line to be clean # Remove Comments ( anything following # ) myline = trailing_comment.sub("", myline) @@ -54,7 +54,7 @@ class ParserBase: # Look for separator msearch = myline.find(self.key_value_separator) - + # If separator found assume its a new key if msearch != -1: # Split on the first occurence of the separator creating two strings in the array mobjs @@ -84,13 +84,13 @@ class ParserBase: cur_array += myline.split() else: raise CatalystError, "Syntax error: " + x - + # XXX: Do we really still need this "single value is a string" behavior? if len(cur_array) == 2: values[cur_array[0]] = cur_array[1] else: values[cur_array[0]] = cur_array[1:] - + if not self.empty_values: for x in values.keys(): # Delete empty key pairs diff --git a/modules/catalyst/lock.py b/modules/catalyst/lock.py index 14bf378f..1c538c4a 100644 --- a/modules/catalyst/lock.py +++ b/modules/catalyst/lock.py @@ -28,14 +28,14 @@ class LockDir: self.set_lockdir(lockdir) self.set_lockfilename(".catalyst_lock") self.set_lockfile() - + if LockDir.lock_dirs_in_use.count(lockdir)>0: raise "This directory already associated with a lock object" else: LockDir.lock_dirs_in_use.append(lockdir) - + self.hardlock_paths={} - + def delete_lock_from_path_list(self): @@ -59,7 +59,7 @@ class LockDir: def set_gid(self,gid): if not self.islocked(): # if "DEBUG" in self.settings: -# print "setting gid to", gid +# print "setting gid to", gid self.gid=gid def set_lockdir(self,lockdir): @@ -94,7 +94,7 @@ class LockDir: print "HARDLOCKING doesnt support shared-read locks" print "using exclusive write locks" self.hard_lock() - + def write_lock(self): if not self.locking_method == "HARDLOCK": self.fcntl_lock("write") @@ -128,7 +128,7 @@ class LockDir: os.umask(old_mask) else: self.myfd = os.open(self.lockfile, os.O_CREAT|os.O_RDWR,0660) - + try: if locktype == "read": self.locking_method(self.myfd,fcntl.LOCK_SH|fcntl.LOCK_NB) @@ -161,8 +161,8 @@ class LockDir: else: self.locked=True #writemsg("Lockfile obtained\n") - - + + def fcntl_unlock(self): import fcntl unlinkfile = 1 @@ -225,7 +225,7 @@ class LockDir: # open fd closed automatically on them. #if type(lockfilename) == types.StringType: # os.close(myfd) - + if (self.myfd != None): os.close(self.myfd) self.myfd=None @@ -297,7 +297,7 @@ class LockDir: #mypath = self.normpath(path) if os.path.isdir(self.lockdir) and os.path.isfile(self.myhardlock): self.hardlock_paths[self.lockdir]=self.myhardlock - + def remove_hardlock_file_from_cleanup(self): if self.lockdir in self.hardlock_paths: del self.hardlock_paths[self.lockdir] @@ -361,7 +361,7 @@ class LockDir: pid = hostpid[-1] if not filename in mylist: mylist[filename] = {} - + if not host in mylist[filename]: mylist[filename][host] = [] mylist[filename][host].append(pid) @@ -414,7 +414,7 @@ class LockDir: if __name__ == "__main__": def lock_work(): - print + print for i in range(1,6): print i,time.time() time.sleep(1) @@ -429,38 +429,38 @@ if __name__ == "__main__": print "Lock 5 starting" import time Lock1=LockDir("/tmp/lock_path") - Lock1.write_lock() + Lock1.write_lock() print "Lock1 write lock" - + lock_work() - - Lock1.unlock() + + Lock1.unlock() print "Lock1 unlock" - + Lock1.read_lock() print "Lock1 read lock" - + lock_work() - - Lock1.unlock() + + Lock1.unlock() print "Lock1 unlock" Lock1.read_lock() print "Lock1 read lock" - + Lock1.write_lock() print "Lock1 write lock" - + lock_work() - + Lock1.unlock() print "Lock1 unlock" - + Lock1.read_lock() print "Lock1 read lock" - + lock_work() - + Lock1.unlock() print "Lock1 unlock" #Lock1.write_lock() diff --git a/modules/catalyst/support.py b/modules/catalyst/support.py index 564c67b8..6aecfbf2 100644 --- a/modules/catalyst/support.py +++ b/modules/catalyst/support.py @@ -246,12 +246,12 @@ class CatalystError(Exception): if message: (type,value)=sys.exc_info()[:2] if value!=None: - print + print print traceback.print_exc(file=sys.stdout) print print "!!! catalyst: "+message print - + class LockInUse(Exception): def __init__(self, message): if message: @@ -354,19 +354,19 @@ def spawn(mycommand,env={},raw_exit_code=False,opt_name=None,fd_pipes=None,retur Can either have a tuple, or a string passed in. If uid/gid/groups/umask specified, it changes the forked process to said value. If path_lookup is on, a non-absolute command will be converted to an absolute command, otherwise it returns None. - + selinux_context is the desired context, dependant on selinux being available. opt_name controls the name the processor goes by. fd_pipes controls which file descriptor numbers are left open in the forked process- it's a dict of current fd's raw fd #, desired #. - + func_call is a boolean for specifying to execute a python function- use spawn_func instead. raise_signals is questionable. Basically throw an exception if signal'd. No exception is thrown if raw_input is on. - + logfile overloads the specified fd's to write to a tee process which logs to logfile returnpid returns the relevant pids (a list, including the logging process if logfile is on). - + non-returnpid calls to spawn will block till the process has exited, returning the exitcode/signal raw_exit_code controls whether the actual waitpid result is returned, or intrepretted.""" @@ -392,7 +392,7 @@ def spawn(mycommand,env={},raw_exit_code=False,opt_name=None,fd_pipes=None,retur if raw_exit_code: return retval return process_exit_code(retval) - + if fd_pipes == None: fd_pipes={} fd_pipes[0] = 0 @@ -425,7 +425,7 @@ def spawn(mycommand,env={},raw_exit_code=False,opt_name=None,fd_pipes=None,retur for x in k: trg_fd.append(x) src_fd.append(fd_pipes[x]) - + # run through said list dup'ing descriptors so that they won't be waxed # by other dup calls. for x in range(0,len(trg_fd)): @@ -448,7 +448,7 @@ def spawn(mycommand,env={},raw_exit_code=False,opt_name=None,fd_pipes=None,retur os.dup2(src_fd[x], trg_fd[x]) else: trg_fd=[0,1,2] - + # wax all open descriptors that weren't requested be left open. for x in range(0,max_fd_limit): if x not in trg_fd: @@ -579,7 +579,7 @@ item3: meep bark gleep moop - + This file would be interpreted as defining three items: item1, item2 and item3. item1 would contain the string value "value1". Item2 would contain an ordered list [ "foo", "bar", "oni" ]. item3 would contain an ordered list as well: [ "meep", "bark", "gleep", "moop" ]. It's important to note @@ -630,7 +630,7 @@ def read_makeconf(mymakeconffile): else: makeconf={} return makeconf - + def msg(mymsg,verblevel=1): if verbosity>=verblevel: print mymsg @@ -642,7 +642,7 @@ def pathcompare(path1,path2): # Removing ending slash path1 = re.sub("/$","",path1) path2 = re.sub("/$","",path2) - + if path1 == path2: return 1 return 0 @@ -663,17 +663,17 @@ def ismount(path): def addl_arg_parse(myspec,addlargs,requiredspec,validspec): "helper function to help targets parse additional arguments" global valid_config_file_values - + for x in addlargs.keys(): if x not in validspec and x not in valid_config_file_values and x not in requiredspec: raise CatalystError, "Argument \""+x+"\" not recognized." else: myspec[x]=addlargs[x] - + for x in requiredspec: if not x in myspec: raise CatalystError, "Required argument \""+x+"\" not specified." - + def touch(myfile): try: myf=open(myfile,"w") diff --git a/modules/catalyst/target/generic_stage.py b/modules/catalyst/target/generic_stage.py index c8b7b8df..e6744a29 100644 --- a/modules/catalyst/target/generic_stage.py +++ b/modules/catalyst/target/generic_stage.py @@ -281,7 +281,7 @@ class generic_stage_target(generic_target): else: """ First clean up any existing target stuff """ # XXX WTF are we removing the old tarball before we start building the - # XXX new one? If the build fails, you don't want to be left with + # XXX new one? If the build fails, you don't want to be left with # XXX nothing at all # if os.path.isfile(self.settings["target_path"]): # cmd("rm -f "+self.settings["target_path"],\ @@ -435,7 +435,7 @@ class generic_stage_target(generic_target): raise CatalystError,\ "ISO volume ID must not exceed 32 characters." else: - self.settings["iso_volume_id"]="catalyst "+self.settings["snapshot"] + self.settings["iso_volume_id"]="catalyst "+self.settings["snapshot"] def set_action_sequence(self): """ Default action sequence for run method """ @@ -570,7 +570,7 @@ class generic_stage_target(generic_target): """ Check and verify that none of our paths in mypath are mounted. We don't - want to clean up with things still mounted, and this allows us to check. + want to clean up with things still mounted, and this allows us to check. Returns 1 on ok, 0 on "something is still mounted" case. """ @@ -601,7 +601,7 @@ class generic_stage_target(generic_target): "unpack") if "SEEDCACHE" in self.settings: - if os.path.isdir(self.settings["source_path"]): + if os.path.isdir(self.settings["source_path"]): """ SEEDCACHE Is a directory, use rsync """ unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\ " "+self.settings["chroot_path"] @@ -646,7 +646,7 @@ class generic_stage_target(generic_target): """ Autoresume is valid, tarball is valid """ unpack=False invalid_snapshot=True - + elif os.path.isdir(self.settings["source_path"]) \ and not os.path.exists(self.settings["autoresume_path"]+\ "unpack"): @@ -722,7 +722,7 @@ class generic_stage_target(generic_target): snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\ "unpack_portage") - if "SNAPCACHE" in self.settings: + if "SNAPCACHE" in self.settings: snapshot_cache_hash=\ read_from_clst(self.settings["snapshot_cache_path"]+\ "catalyst-hash") @@ -758,7 +758,7 @@ class generic_stage_target(generic_target): unpack=False if unpack: - if "SNAPCACHE" in self.settings: + if "SNAPCACHE" in self.settings: self.snapshot_lock_object.write_lock() if os.path.exists(destdir): print cleanup_msg @@ -770,7 +770,7 @@ class generic_stage_target(generic_target): print "Unpacking portage tree (This can take a long time) ..." cmd(unpack_cmd,unpack_errmsg,env=self.env) - if "SNAPCACHE" in self.settings: + if "SNAPCACHE" in self.settings: myf=open(self.settings["snapshot_cache_path"]+"catalyst-hash","w") myf.write(self.settings["snapshot_path_hash"]) myf.close() @@ -780,7 +780,7 @@ class generic_stage_target(generic_target): myf.write(self.settings["snapshot_path_hash"]) myf.close() - if "SNAPCACHE" in self.settings: + if "SNAPCACHE" in self.settings: self.snapshot_lock_object.unlock() def config_profile_link(self): @@ -819,7 +819,7 @@ class generic_stage_target(generic_target): def portage_overlay(self): """ We copy the contents of our overlays to /usr/local/portage """ if "portage_overlay" in self.settings: - for x in self.settings["portage_overlay"]: + for x in self.settings["portage_overlay"]: if os.path.exists(x): print "Copying overlay dir " +x cmd("mkdir -p "+self.settings["chroot_path"]+\ @@ -833,7 +833,7 @@ class generic_stage_target(generic_target): """ Copy over the root_overlay """ if self.settings["spec_prefix"]+"/root_overlay" in self.settings: for x in self.settings[self.settings["spec_prefix"]+\ - "/root_overlay"]: + "/root_overlay"]: if os.path.exists(x): print "Copying root_overlay: "+x cmd("rsync -a "+x+"/ "+\ @@ -845,7 +845,7 @@ class generic_stage_target(generic_target): pass def bind(self): - for x in self.mounts: + for x in self.mounts: if not os.path.exists(self.settings["chroot_path"]+x): os.makedirs(self.settings["chroot_path"]+x,0755) @@ -921,19 +921,19 @@ class generic_stage_target(generic_target): self.override_cbuild() self.override_chost() self.override_cflags() - self.override_cxxflags() - self.override_ldflags() + self.override_cxxflags() + self.override_ldflags() if "AUTORESUME" in self.settings \ and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"): print "Resume point detected, skipping chroot_setup operation..." else: print "Setting up chroot..." - + #self.makeconf=read_makeconf(self.settings["chroot_path"]+"/etc/make.conf") - + cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc",\ "Could not copy resolv.conf into place.",env=self.env) - + """ Copy over the envscript, if applicable """ if "ENVSCRIPT" in self.settings: if not os.path.exists(self.settings["ENVSCRIPT"]): @@ -1053,7 +1053,7 @@ class generic_stage_target(generic_target): and os.path.exists(self.settings["autoresume_path"]+"clean"): print "Resume point detected, skipping clean operation..." else: - for x in self.settings["cleanables"]: + for x in self.settings["cleanables"]: print "Cleaning chroot: "+x+"... " cmd("rm -rf "+self.settings["destpath"]+x,"Couldn't clean "+\ x,env=self.env) @@ -1100,7 +1100,7 @@ class generic_stage_target(generic_target): print x,"not a directory or does not exist, skipping 'empty' operation." continue print "Emptying directory",x - """ + """ stat the dir, delete the dir, recreate the dir and set the proper perms and ownership """ @@ -1143,7 +1143,7 @@ class generic_stage_target(generic_target): cmd("/bin/bash "+self.settings["controller_file"]+\ " preclean","preclean script failed.",env=self.env) touch(self.settings["autoresume_path"]+"preclean") - + except: self.unbind() raise CatalystError, "Build failed, could not execute preclean" @@ -1241,7 +1241,7 @@ class generic_stage_target(generic_target): except: self.mount_safety_check() raise - + self.chroot_lock.unlock() def unmerge(self): @@ -1293,7 +1293,7 @@ class generic_stage_target(generic_target): print "Resume point detected, skipping setup_overlay operation..." else: if self.settings["spec_prefix"]+"/overlay" in self.settings: - for x in self.settings[self.settings["spec_prefix"]+"/overlay"]: + for x in self.settings[self.settings["spec_prefix"]+"/overlay"]: if os.path.exists(x): cmd("rsync -a "+x+"/ "+\ self.settings["target_path"],\ @@ -1631,4 +1631,4 @@ class generic_stage_target(generic_target): print "clearing kerncache ..." self.clear_kerncache() -# vim: ts=4 sw=4 sta et sts=4 ai +# vim: ts=4 sw=4 sta et sts=4 ai diff --git a/modules/catalyst/target/grp.py b/modules/catalyst/target/grp.py index e2f7ff08..b4832160 100644 --- a/modules/catalyst/target/grp.py +++ b/modules/catalyst/target/grp.py @@ -11,24 +11,24 @@ class grp_target(generic_stage_target): def __init__(self,spec,addlargs): self.required_values=["version_stamp","target","subarch",\ "rel_type","profile","snapshot","source_subpath"] - + self.valid_values=self.required_values[:] self.valid_values.extend(["grp/use"]) if not "grp" in addlargs: raise CatalystError,"Required value \"grp\" not specified in spec." - + self.required_values.extend(["grp"]) if type(addlargs["grp"])==types.StringType: addlargs["grp"]=[addlargs["grp"]] - + if "grp/use" in addlargs: if type(addlargs["grp/use"])==types.StringType: addlargs["grp/use"]=[addlargs["grp/use"]] - + for x in addlargs["grp"]: self.required_values.append("grp/"+x+"/packages") self.required_values.append("grp/"+x+"/type") - + generic_stage_target.__init__(self,spec,addlargs) def set_target_path(self): @@ -53,7 +53,7 @@ class grp_target(generic_stage_target): try: cmd("/bin/bash "+self.settings["controller_file"]+" run "+self.settings["grp/"+pkgset+"/type"]\ +" "+pkgset+" "+mypackages,env=self.env) - + except CatalystError: self.unbind() raise CatalystError,"GRP build aborting due to error." @@ -68,12 +68,12 @@ class grp_target(generic_stage_target): def set_mounts(self): self.mounts.append("/tmp/grp") self.mountmap["/tmp/grp"]=self.settings["target_path"] - + def generate_digests(self): for pkgset in self.settings["grp"]: if self.settings["grp/"+pkgset+"/type"] == "pkgset": destdir=normpath(self.settings["target_path"]+"/"+pkgset+"/All") - print "Digesting files in the pkgset....." + print "Digesting files in the pkgset....." digests=glob.glob(destdir+'/*.DIGESTS') for i in digests: if os.path.exists(i): @@ -88,8 +88,8 @@ class grp_target(generic_stage_target): self.gen_digest_file(normpath(destdir+"/"+i)) else: destdir=normpath(self.settings["target_path"]+"/"+pkgset) - print "Digesting files in the srcset....." - + print "Digesting files in the srcset....." + digests=glob.glob(destdir+'/*.DIGESTS') for i in digests: if os.path.exists(i): diff --git a/modules/catalyst/target/livecd_stage1.py b/modules/catalyst/target/livecd_stage1.py index 27432108..b41dbee5 100644 --- a/modules/catalyst/target/livecd_stage1.py +++ b/modules/catalyst/target/livecd_stage1.py @@ -30,16 +30,16 @@ class livecd_stage1_target(generic_stage_target): cmd("rm -rf "+self.settings["target_path"],\ "Could not remove existing directory: "+self.settings["target_path"],env=self.env) touch(self.settings["autoresume_path"]+"setup_target_path") - + 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" - + def set_use(self): generic_stage_target.set_use(self) if "use" in self.settings: diff --git a/modules/catalyst/target/livecd_stage2.py b/modules/catalyst/target/livecd_stage2.py index cef47106..d9228dc8 100644 --- a/modules/catalyst/target/livecd_stage2.py +++ b/modules/catalyst/target/livecd_stage2.py @@ -10,9 +10,9 @@ from generic_stage import * class livecd_stage2_target(generic_stage_target): def __init__(self,spec,addlargs): self.required_values=["boot/kernel"] - + self.valid_values=[] - + self.valid_values.extend(self.required_values) self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\ "livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\ @@ -22,13 +22,13 @@ class livecd_stage2_target(generic_stage_target): "livecd/root_overlay","livecd/users","portage_overlay",\ "livecd/fstype","livecd/fsops","livecd/linuxrc","livecd/bootargs",\ "gamecd/conf","livecd/xdm","livecd/xsession","livecd/volid"]) - + generic_stage_target.__init__(self,spec,addlargs) if not "livecd/type" in self.settings: self.settings["livecd/type"] = "generic-livecd" file_locate(self.settings, ["cdtar","controller_file"]) - + 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"]): @@ -37,7 +37,7 @@ class livecd_stage2_target(generic_stage_target): 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." - + def set_spec_prefix(self): self.settings["spec_prefix"]="livecd" @@ -63,12 +63,12 @@ class livecd_stage2_target(generic_stage_target): except: self.unbind() raise CatalystError,"Couldn't open "+self.settings["chroot_path"]+"/etc/hotplug/blacklist." - + myf.write("\n#Added by Catalyst:") for x in self.settings["livecd/modblacklist"]: myf.write("\n"+x) myf.close() - + def unpack(self): unpack=True display_msg=None diff --git a/modules/catalyst/target/netboot.py b/modules/catalyst/target/netboot.py index 6b576b47..f00627af 100644 --- a/modules/catalyst/target/netboot.py +++ b/modules/catalyst/target/netboot.py @@ -20,21 +20,21 @@ class netboot_target(generic_stage_target): "netboot/packages" ] self.required_values=[] - + try: if "netboot/packages" in addlargs: if type(addlargs["netboot/packages"]) == types.StringType: loopy=[addlargs["netboot/packages"]] else: loopy=addlargs["netboot/packages"] - + # for x in loopy: # self.required_values.append("netboot/packages/"+x+"/files") except: raise CatalystError,"configuration error in netboot/packages." - - - + + + generic_stage_target.__init__(self,spec,addlargs) self.set_build_kernel_vars(addlargs) @@ -44,11 +44,11 @@ class netboot_target(generic_stage_target): # Custom Kernel Tarball --- use that instead ... # unless the user wants specific CFLAGS/CXXFLAGS, let's use -Os - + for envvar in "CFLAGS", "CXXFLAGS": if not envvar in os.environ and not envvar in addlargs: self.settings[envvar] = "-Os -pipe" - + def set_root_path(self): # ROOT= variable for emerges @@ -64,7 +64,7 @@ class netboot_target(generic_stage_target): # except CatalystError: # self.unbind() # raise CatalystError,"netboot build aborting due to error." - + def build_busybox(self): # build busybox if "netboot/busybox_config" in self.settings: @@ -76,7 +76,7 @@ class netboot_target(generic_stage_target): except CatalystError: self.unbind() raise CatalystError,"netboot build aborting due to error." - + def copy_files_to_image(self): # create image @@ -86,7 +86,7 @@ class netboot_target(generic_stage_target): loopy=[self.settings["netboot/packages"]] else: loopy=self.settings["netboot/packages"] - + for x in loopy: if "netboot/packages/"+x+"/files" in self.settings: if type(self.settings["netboot/packages/"+x+"/files"]) == types.ListType: diff --git a/modules/catalyst/target/netboot2.py b/modules/catalyst/target/netboot2.py index 08ef6802..c6965d47 100644 --- a/modules/catalyst/target/netboot2.py +++ b/modules/catalyst/target/netboot2.py @@ -34,7 +34,7 @@ class netboot2_target(generic_stage_target): self.valid_values.append("netboot2/packages/"+x+"/files") except: raise CatalystError,"configuration error in netboot2/packages." - + generic_stage_target.__init__(self,spec,addlargs) self.set_build_kernel_vars() self.settings["merge_path"]=normpath("/tmp/image/") @@ -69,7 +69,7 @@ class netboot2_target(generic_stage_target): loopy=[self.settings["netboot2/packages"]] else: loopy=self.settings["netboot2/packages"] - + for x in loopy: if "netboot2/packages/"+x+"/files" in self.settings: if type(self.settings["netboot2/packages/"+x+"/files"]) == types.ListType: @@ -92,13 +92,13 @@ class netboot2_target(generic_stage_target): touch(self.settings["autoresume_path"]+"copy_files_to_image") - def setup_overlay(self): + def setup_overlay(self): if "AUTORESUME" in self.settings \ and os.path.exists(self.settings["autoresume_path"]+"setup_overlay"): print "Resume point detected, skipping setup_overlay operation..." else: if "netboot2/overlay" in self.settings: - for x in self.settings["netboot2/overlay"]: + for x in self.settings["netboot2/overlay"]: if os.path.exists(x): cmd("rsync -a "+x+"/ "+\ self.settings["chroot_path"] + self.settings["merge_path"], "netboot2/overlay: "+x+" copy failed.",env=self.env) @@ -128,7 +128,7 @@ class netboot2_target(generic_stage_target): print "netboot2: removing " + x os.system("rm -rf " + self.settings["chroot_path"] + self.settings["merge_path"] + x) - def empty(self): + def empty(self): if "AUTORESUME" in self.settings \ and os.path.exists(self.settings["autoresume_path"]+"empty"): print "Resume point detected, skipping empty operation..." diff --git a/modules/catalyst/target/snapshot.py b/modules/catalyst/target/snapshot.py index 71ddd08c..5cc47165 100644 --- a/modules/catalyst/target/snapshot.py +++ b/modules/catalyst/target/snapshot.py @@ -11,7 +11,7 @@ class snapshot_target(generic_stage_target): def __init__(self,myspec,addlargs): self.required_values=["version_stamp","target"] self.valid_values=["version_stamp","target"] - + generic_target.__init__(self,myspec,addlargs) self.settings=myspec self.settings["target_subpath"]="portage" @@ -24,10 +24,10 @@ class snapshot_target(generic_stage_target): x=normpath(self.settings["storedir"]+"/snapshots") if not os.path.exists(x): os.makedirs(x) - + def mount_safety_check(self): pass - + def run(self): if "PURGEONLY" in self.settings: self.purge() @@ -39,24 +39,24 @@ class snapshot_target(generic_stage_target): self.setup() print "Creating Portage tree snapshot "+self.settings["version_stamp"]+\ " from "+self.settings["portdir"]+"..." - + mytmp=self.settings["tmp_path"] if not os.path.exists(mytmp): os.makedirs(mytmp) - + cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\ self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env) - + print "Compressing Portage snapshot tarball..." cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\ "Snapshot creation failure",env=self.env) - + self.gen_contents_file(self.settings["snapshot_path"]) self.gen_digest_file(self.settings["snapshot_path"]) self.cleanup() print "snapshot: complete!" - + def kill_chroot_pids(self): pass @@ -79,5 +79,5 @@ class snapshot_target(generic_stage_target): os.makedirs(myemp,0755) os.chown(myemp,mystat[ST_UID],mystat[ST_GID]) os.chmod(myemp,mystat[ST_MODE]) - + __target_map = {"snapshot":snapshot_target} diff --git a/modules/catalyst/target/stage1.py b/modules/catalyst/target/stage1.py index f076745d..2557bdd2 100644 --- a/modules/catalyst/target/stage1.py +++ b/modules/catalyst/target/stage1.py @@ -11,16 +11,16 @@ class stage1_target(generic_stage_target): self.required_values=[] self.valid_values=["chost"] generic_stage_target.__init__(self,spec,addlargs) - + def set_stage_path(self): self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"]) print "stage1 stage path is "+self.settings["stage_path"] - + def set_root_path(self): # sets the root path, relative to 'chroot_path', of the stage1 root self.settings["root_path"]=normpath("/tmp/stage1root") print "stage1 root path is "+self.settings["root_path"] - + def set_cleanables(self): generic_stage_target.set_cleanables(self) self.settings["cleanables"].extend(["/usr/share/gettext",\ @@ -68,7 +68,7 @@ class stage1_target(generic_stage_target): os.makedirs(self.settings["stage_path"]+"/dev") if not os.path.isfile(self.settings["stage_path"]+"/proc/.keep"): try: - proc_keepfile = open(self.settings["stage_path"]+"/proc/.keep","w") + proc_keepfile = open(self.settings["stage_path"]+"/proc/.keep","w") proc_keepfile.write('') proc_keepfile.close() except IOError: @@ -77,7 +77,7 @@ class stage1_target(generic_stage_target): try: dev_keepfile = open(self.settings["stage_path"]+"/dev/.keep","w") dev_keepfile.write('') - dev_keepfile.close() + dev_keepfile.close() except IOError: print "!!! Failed to create %s" % (self.settings["stage_path"]+"/dev/.keep") else: diff --git a/modules/catalyst/target/stage2.py b/modules/catalyst/target/stage2.py index b5ab3794..a9f24b07 100644 --- a/modules/catalyst/target/stage2.py +++ b/modules/catalyst/target/stage2.py @@ -11,7 +11,7 @@ class stage2_target(generic_stage_target): self.required_values=[] self.valid_values=["chost"] generic_stage_target.__init__(self,spec,addlargs) - + def set_source_path(self): if "SEEDCACHE" in self.settings and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")): self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/") @@ -33,7 +33,7 @@ class stage2_target(generic_stage_target): def set_cleanables(self): generic_stage_target.set_cleanables(self) self.settings["cleanables"].extend(["/etc/portage"]) - + def override_chost(self): if "chost" in self.settings: self.settings["CHOST"]=list_to_string(self.settings["chost"]) diff --git a/modules/catalyst/target/tinderbox.py b/modules/catalyst/target/tinderbox.py index 40cb3207..85ba6abb 100644 --- a/modules/catalyst/target/tinderbox.py +++ b/modules/catalyst/target/tinderbox.py @@ -20,7 +20,7 @@ class tinderbox_target(generic_stage_target): if os.path.exists(self.settings["controller_file"]): cmd("/bin/bash "+self.settings["controller_file"]+" run "+\ list_bashify(self.settings["tinderbox/packages"]),"run script failed.",env=self.env) - + except CatalystError: self.unbind() raise CatalystError,"Tinderbox aborting due to error." @@ -34,5 +34,5 @@ class tinderbox_target(generic_stage_target): "config_profile_link","setup_confdir","bind","chroot_setup",\ "setup_environment","run_local","preclean","unbind","clean",\ "clear_autoresume"] - + __target_map = {"tinderbox":tinderbox_target} diff --git a/targets/stage1/build.py b/targets/stage1/build.py index 539c4c7e..bf20bcf3 100644 --- a/targets/stage1/build.py +++ b/targets/stage1/build.py @@ -12,7 +12,7 @@ def scan_profile(file): else: if "grab_multiple" in dir(portage): return portage.stack_lists( portage.grab_multiple(file, portage.settings.profiles, portage.grabfile), incremental=1); - else: + else: return portage.stack_lists( [portage.grabfile_package(os.path.join(x, file)) for x in portage.settings.profiles], incremental=1); # loaded the stacked packages / packages.build files