the driver class for pretty much everything that Catalyst does.
"""
-import os, types
+import os
import catalyst
from catalyst.output import *
from catalyst.spawn import cmd
def set_install_mask(self):
if "install_mask" in self.settings:
- if type(self.settings["install_mask"])!=types.StringType:
+ if not isinstance(self.settings["install_mask"], str):
self.settings["install_mask"]=\
" ".join(self.settings["install_mask"])
self.settings["version_stamp"]
def set_source_subpath(self):
- if type(self.settings["source_subpath"])!=types.StringType:
+ if not isinstance(self.settings["source_subpath"], str):
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:
- if type(self.settings["pkgcache_path"])!=types.StringType:
+ if not isinstance(self.settings["pkgcache_path"], str):
self.settings["pkgcache_path"]=\
catalyst.util.normpath(" ".join(self.settings["pkgcache_path"]))
else:
def set_kerncache_path(self):
if "kerncache_path" in self.settings:
- if type(self.settings["kerncache_path"])!=types.StringType:
+ if not isinstance(self.settings["kerncache_path"], str):
self.settings["kerncache_path"]=\
catalyst.util.normpath(" ".join(self.settings["kerncache_path"]))
else:
def set_use(self):
if "use" in self.settings:
- if type(self.settings["use"])==types.StringType:
+ if isinstance(self.settings["use"], str):
self.settings["use"]=self.settings["use"].split()
self.settings["use"].append("bindist")
def set_rm(self):
if "rm" in self.settings:
- if type(self.settings["rm"])==types.StringType:
+ if isinstance(self.settings["rm"], str):
self.settings["rm"]=\
self.settings["rm"].split()
def set_portage_overlay(self):
if "portage_overlay" in self.settings:
- if type(self.settings["portage_overlay"])==types.StringType:
+ if isinstance(self.settings["portage_overlay"], str):
self.settings["portage_overlay"]=\
self.settings["portage_overlay"].split()
msg("portage_overlay directories are set to: '" + \
def set_overlay(self):
if "overlay" in self.settings:
- if type(self.settings["overlay"])==types.StringType:
+ if isinstance(self.settings["overlay"], str):
self.settings["overlay"]=\
self.settings["overlay"].split()
def set_root_overlay(self):
if "root_overlay" in self.settings:
- if type(self.settings["root_overlay"])==types.StringType:
+ if isinstance(self.settings["root_overlay"], str):
self.settings["root_overlay"]=\
self.settings["root_overlay"].split()
def set_valid_build_kernel_vars(self):
if "boot/kernel" in self.settings:
- if type(self.settings["boot/kernel"])==types.StringType:
+ if isinstance(self.settings["boot/kernel"], str):
loopy=[self.settings["boot/kernel"]]
else:
loopy=self.settings["boot/kernel"]
self.valid_values.append("boot/kernel/"+x+"/use")
self.valid_values.append("boot/kernel/"+x+"/packages")
if "boot/kernel/"+x+"/packages" in self.settings:
- if type(self.settings["boot/kernel/"+x+\
- "/packages"])==types.StringType:
+ if isinstance(self.settings["boot/kernel/" + x + "/packages"], str):
self.settings["boot/kernel/"+x+"/packages"]=\
[self.settings["boot/kernel/"+x+"/packages"]]
msg("Resume point detected, skipping empty operation...")
else:
if "empty" in self.settings:
- if type(self.settings["empty"])==types.StringType:
+ if isinstance(self.settings["empty"], str):
self.settings["empty"]=\
self.settings["empty"].split()
for x in self.settings["empty"]:
varname="clst_"+string.replace(x,"/","_")
varname=string.replace(varname,"-","_")
varname=string.replace(varname,".","_")
- if type(self.settings[x])==types.StringType:
+ if isinstance(self.settings[x], str):
""" Prefix to prevent namespace clashes """
#os.environ[varname]=self.settings[x]
self.env[varname]=self.settings[x]
- elif type(self.settings[x])==types.ListType:
+ elif isinstance(self.settings[x], list):
#os.environ[varname] = " ".join(self.settings[x])
self.env[varname] = " ".join(self.settings[x])
- elif type(self.settings[x])==types.BooleanType:
+ elif isinstance(self.settings[x], bool):
if self.settings[x]:
self.env[varname]="true"
else:
msg("Resume point detected, skipping unmerge operation...")
else:
if "unmerge" in self.settings:
- if type(self.settings["unmerge"])==types.StringType:
+ if isinstance(self.settings["unmerge"], str):
self.settings["unmerge"]=\
[self.settings["unmerge"]]
myunmerge=\
if "boot/kernel" in self.settings:
try:
mynames=self.settings["boot/kernel"]
- if type(mynames)==types.StringType:
+ if isinstance(mynames, str):
mynames=[mynames]
"""
Execute the script that sets up the kernel build environment
myopts=self.settings["boot/kernel/"+kname+\
"/kernelopts"]
- if type(myopts) != types.StringType:
+ if not isinstance(myopts, str):
myopts = " ".join(myopts)
self.env[kname+"_kernelopts"]=myopts
Builder class for a netboot build, version 2
"""
-import os,string,types
+import os, string
from generic_stage import *
import catalyst.util
from catalyst.error import *
try:
if "netboot/packages" in self.settings:
- if type(self.settings["netboot/packages"]) == types.StringType:
+ if isinstance(self.settings["netboot/packages"], str):
loopy=[self.settings["netboot/packages"]]
else:
loopy=self.settings["netboot/packages"]
msg("Resume point detected, skipping target path setup operation...")
else:
if "netboot/packages" in self.settings:
- if type(self.settings["netboot/packages"]) == types.StringType:
+ if isinstance(self.settings["netboot/packages"], str):
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:
+ if isinstance(self.settings["netboot/packages/"+x+"/files"], list):
myfiles.extend(self.settings["netboot/packages/"+x+"/files"])
else:
myfiles.append(self.settings["netboot/packages/"+x+"/files"])
if "netboot/extra_files" in self.settings:
- if type(self.settings["netboot/extra_files"]) == types.ListType:
+ if isinstance(self.settings["netboot/extra_files"], list):
myfiles.extend(self.settings["netboot/extra_files"])
else:
myfiles.append(self.settings["netboot/extra_files"])
msg("Resume point detected, skipping empty operation...")
else:
if "netboot/empty" in self.settings:
- if type(self.settings["netboot/empty"])==types.StringType:
+ if isinstance(self.settings["netboot/empty"], str):
self.settings["netboot/empty"]=self.settings["netboot/empty"].split()
for x in self.settings["netboot/empty"]:
myemp=self.settings["chroot_path"] + self.settings["merge_path"] + x