msg("Can't find/load "+x+".py plugin in "+\
self.settings["sharedir"]+"/arch/")
- if self.settings.has_key("chost"):
+ if "chost" in self.settings:
hostmachine = self.settings["chost"].split("-")[0]
- if not machinemap.has_key(hostmachine):
+ if hostmachine not in machinemap:
raise CatalystError, "Unknown host machine type "+hostmachine
self.settings["hostarch"]=machinemap[hostmachine]
else:
hostmachine = self.settings["subarch"]
- if machinemap.has_key(hostmachine):
+ if hostmachine in machinemap:
hostmachine = machinemap[hostmachine]
self.settings["hostarch"]=hostmachine
- if self.settings.has_key("cbuild"):
+ if "cbuild" in self.settings:
buildmachine = self.settings["cbuild"].split("-")[0]
else:
buildmachine = os.uname()[4]
- if not machinemap.has_key(buildmachine):
+ if buildmachine not in machinemap:
raise CatalystError, "Unknown build machine type "+buildmachine
self.settings["buildarch"]=machinemap[buildmachine]
self.settings["crosscompile"]=(self.settings["hostarch"]!=\
file_locate(self.settings,["source_path","snapshot_path","distdir"],\
expand=0)
""" If we are using portage_confdir, check that as well. """
- if self.settings.has_key("portage_confdir"):
+ if "portage_confdir" in self.settings:
file_locate(self.settings,["portage_confdir"],expand=0)
""" Setup our mount points """
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
self.mounts=["/proc","/dev","/usr/portage","/usr/portage/distfiles","/var/tmp/portage"]
self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
"/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
Configure any user specified options (either in catalyst.conf or on
the command line).
"""
- if self.settings.has_key("PKGCACHE"):
+ if "PKGCACHE" in self.settings:
self.set_pkgcache_path()
print "Location of the package cache is "+\
self.settings["pkgcache_path"]
self.mountmap["/usr/portage/packages"]=\
self.settings["pkgcache_path"]
- if self.settings.has_key("KERNCACHE"):
+ if "KERNCACHE" in self.settings:
self.set_kerncache_path()
print "Location of the kerncache is "+\
self.settings["kerncache_path"]
self.mounts.append("/tmp/kerncache")
self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"]
- if self.settings.has_key("CCACHE"):
- if os.environ.has_key("CCACHE_DIR"):
+ if "CCACHE" in self.settings:
+ if "CCACHE_DIR" in os.environ:
ccdir=os.environ["CCACHE_DIR"]
del os.environ["CCACHE_DIR"]
else:
""" for the chroot: """
self.env["CCACHE_DIR"]="/var/tmp/ccache"
- if self.settings.has_key("ICECREAM"):
+ if "ICECREAM" in self.settings:
self.mounts.append("/var/cache/icecream")
self.mountmap["/var/cache/icecream"]="/var/cache/icecream"
self.env["PATH"]="/usr/lib/icecc/bin:"+self.env["PATH"]
- if self.settings.has_key("port_logdir"):
+ if "port_logdir" in self.settings:
self.mounts.append("/var/log/portage")
self.mountmap["/var/log/portage"]=self.settings["port_logdir"]
self.env["PORT_LOGDIR"]="/var/log/portage"
self.env["PORT_LOGDIR_CLEAN"]='find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete'
def override_cbuild(self):
- if self.makeconf.has_key("CBUILD"):
+ if "CBUILD" in self.makeconf:
self.settings["CBUILD"]=self.makeconf["CBUILD"]
def override_chost(self):
- if self.makeconf.has_key("CHOST"):
+ if "CHOST" in self.makeconf:
self.settings["CHOST"]=self.makeconf["CHOST"]
def override_cflags(self):
- if self.makeconf.has_key("CFLAGS"):
+ if "CFLAGS" in self.makeconf:
self.settings["CFLAGS"]=self.makeconf["CFLAGS"]
def override_cxxflags(self):
- if self.makeconf.has_key("CXXFLAGS"):
+ if "CXXFLAGS" in self.makeconf:
self.settings["CXXFLAGS"]=self.makeconf["CXXFLAGS"]
def override_ldflags(self):
- if self.makeconf.has_key("LDFLAGS"):
+ if "LDFLAGS" in self.makeconf:
self.settings["LDFLAGS"]=self.makeconf["LDFLAGS"]
def set_install_mask(self):
- if self.settings.has_key("install_mask"):
+ if "install_mask" in self.settings:
if type(self.settings["install_mask"])!=types.StringType:
self.settings["install_mask"]=\
string.join(self.settings["install_mask"])
"source_subpath should have been a string. Perhaps you have something wrong in your spec file?"
def set_pkgcache_path(self):
- if self.settings.has_key("pkgcache_path"):
+ if "pkgcache_path" in self.settings:
if type(self.settings["pkgcache_path"])!=types.StringType:
self.settings["pkgcache_path"]=\
normpath(string.join(self.settings["pkgcache_path"]))
self.settings["target_subpath"]+"/")
def set_kerncache_path(self):
- if self.settings.has_key("kerncache_path"):
+ if "kerncache_path" in self.settings:
if type(self.settings["kerncache_path"])!=types.StringType:
self.settings["kerncache_path"]=\
normpath(string.join(self.settings["kerncache_path"]))
def set_target_path(self):
self.settings["target_path"]=normpath(self.settings["storedir"]+\
"/builds/"+self.settings["target_subpath"]+".tar.bz2")
- if self.settings.has_key("AUTORESUME")\
+ if "AUTORESUME" in self.settings\
and os.path.exists(self.settings["autoresume_path"]+\
"setup_target_path"):
print \
os.makedirs(self.settings["storedir"]+"/builds/")
def set_fsscript(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/fsscript"):
+ if self.settings["spec_prefix"]+"/fsscript" in self.settings:
self.settings["fsscript"]=\
self.settings[self.settings["spec_prefix"]+"/fsscript"]
del self.settings[self.settings["spec_prefix"]+"/fsscript"]
def set_rcadd(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/rcadd"):
+ if self.settings["spec_prefix"]+"/rcadd" in self.settings:
self.settings["rcadd"]=\
self.settings[self.settings["spec_prefix"]+"/rcadd"]
del self.settings[self.settings["spec_prefix"]+"/rcadd"]
def set_rcdel(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/rcdel"):
+ if self.settings["spec_prefix"]+"/rcdel" in self.settings:
self.settings["rcdel"]=\
self.settings[self.settings["spec_prefix"]+"/rcdel"]
del self.settings[self.settings["spec_prefix"]+"/rcdel"]
def set_cdtar(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/cdtar"):
+ if self.settings["spec_prefix"]+"/cdtar" in self.settings:
self.settings["cdtar"]=\
normpath(self.settings[self.settings["spec_prefix"]+"/cdtar"])
del self.settings[self.settings["spec_prefix"]+"/cdtar"]
def set_iso(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/iso"):
+ if self.settings["spec_prefix"]+"/iso" in self.settings:
if self.settings[self.settings["spec_prefix"]+"/iso"].startswith('/'):
self.settings["iso"]=\
normpath(self.settings[self.settings["spec_prefix"]+"/iso"])
del self.settings[self.settings["spec_prefix"]+"/iso"]
def set_fstype(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/fstype"):
+ if self.settings["spec_prefix"]+"/fstype" in self.settings:
self.settings["fstype"]=\
self.settings[self.settings["spec_prefix"]+"/fstype"]
del self.settings[self.settings["spec_prefix"]+"/fstype"]
- if not self.settings.has_key("fstype"):
+ if "fstype" not in self.settings:
self.settings["fstype"]="normal"
for x in self.valid_values:
if x == self.settings["spec_prefix"]+"/fstype":
"/fstype is being set to the default of \"normal\"\n"
def set_fsops(self):
- if self.settings.has_key("fstype"):
+ if "fstype" in self.settings:
self.valid_values.append("fsops")
- if self.settings.has_key(self.settings["spec_prefix"]+"/fsops"):
+ if self.settings["spec_prefix"]+"/fsops" in self.settings:
self.settings["fsops"]=\
self.settings[self.settings["spec_prefix"]+"/fsops"]
del self.settings[self.settings["spec_prefix"]+"/fsops"]
def set_source_path(self):
- if self.settings.has_key("SEEDCACHE")\
+ if "SEEDCACHE" in self.settings\
and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+\
self.settings["source_subpath"]+"/")):
self.settings["source_path"]=normpath(self.settings["storedir"]+\
self.settings["source_subpath"]+".tar.bz2\n")
def set_dest_path(self):
- if self.settings.has_key("root_path"):
+ if "root_path" in self.settings:
self.settings["destpath"]=normpath(self.settings["chroot_path"]+\
self.settings["root_path"])
else:
hash_function=self.settings["hash_function"],verbose=False)
def set_snapcache_path(self):
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
self.settings["snapshot_cache_path"]=\
normpath(self.settings["snapshot_cache"]+"/"+\
self.settings["snapshot"]+"/")
"/tmp/"+self.settings["rel_type"]+"/"+".autoresume-"+\
self.settings["target"]+"-"+self.settings["subarch"]+"-"+\
self.settings["version_stamp"]+"/")
- if self.settings.has_key("AUTORESUME"):
+ if "AUTORESUME" in self.settings:
print "The autoresume path is " + self.settings["autoresume_path"]
if not os.path.exists(self.settings["autoresume_path"]):
os.makedirs(self.settings["autoresume_path"],0755)
"-controller.sh")
def set_iso_volume_id(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/volid"):
+ if self.settings["spec_prefix"]+"/volid" in self.settings:
self.settings["iso_volume_id"]=\
self.settings[self.settings["spec_prefix"]+"/volid"]
if len(self.settings["iso_volume_id"])>32:
"setup_confdir","portage_overlay",\
"base_dirs","bind","chroot_setup","setup_environment",\
"run_local","preclean","unbind","clean"]
-# if self.settings.has_key("TARBALL") or \
-# not self.settings.has_key("FETCH"):
- if not self.settings.has_key("FETCH"):
+# if "TARBALL" in self.settings or \
+# "FETCH" not in self.settings:
+ if "FETCH" not in self.settings:
self.settings["action_sequence"].append("capture")
self.settings["action_sequence"].append("clear_autoresume")
def set_use(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/use"):
+ if self.settings["spec_prefix"]+"/use" in self.settings:
self.settings["use"]=\
self.settings[self.settings["spec_prefix"]+"/use"]
del self.settings[self.settings["spec_prefix"]+"/use"]
- if not self.settings.has_key("use"):
+ if "use" not in self.settings:
self.settings["use"]=""
if type(self.settings["use"])==types.StringType:
self.settings["use"]=self.settings["use"].split()
pass
def set_rm(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
+ if self.settings["spec_prefix"]+"/rm" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/rm"])==types.StringType:
self.settings[self.settings["spec_prefix"]+"/rm"]=\
self.settings[self.settings["spec_prefix"]+"/rm"].split()
def set_linuxrc(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/linuxrc"):
+ if self.settings["spec_prefix"]+"/linuxrc" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/linuxrc"])==types.StringType:
self.settings["linuxrc"]=\
del self.settings[self.settings["spec_prefix"]+"/linuxrc"]
def set_busybox_config(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/busybox_config"):
+ if self.settings["spec_prefix"]+"/busybox_config" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/busybox_config"])==types.StringType:
self.settings["busybox_config"]=\
del self.settings[self.settings["spec_prefix"]+"/busybox_config"]
def set_portage_overlay(self):
- if self.settings.has_key("portage_overlay"):
+ if "portage_overlay" in self.settings:
if type(self.settings["portage_overlay"])==types.StringType:
self.settings["portage_overlay"]=\
self.settings["portage_overlay"].split()
string.join(self.settings["portage_overlay"])+"\""
def set_overlay(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/overlay"):
+ if self.settings["spec_prefix"]+"/overlay" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/overlay"])==types.StringType:
self.settings[self.settings["spec_prefix"]+"/overlay"]=\
"/overlay"].split()
def set_root_overlay(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/root_overlay"):
+ if self.settings["spec_prefix"]+"/root_overlay" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/root_overlay"])==types.StringType:
self.settings[self.settings["spec_prefix"]+"/root_overlay"]=\
self.settings["root_path"]="/"
def set_valid_build_kernel_vars(self,addlargs):
- if addlargs.has_key("boot/kernel"):
+ if "boot/kernel" in addlargs:
if type(addlargs["boot/kernel"])==types.StringType:
loopy=[addlargs["boot/kernel"]]
else:
self.valid_values.append("boot/kernel/"+x+"/softlevel")
self.valid_values.append("boot/kernel/"+x+"/use")
self.valid_values.append("boot/kernel/"+x+"/packages")
- if addlargs.has_key("boot/kernel/"+x+"/packages"):
+ if "boot/kernel/"+x+"/packages" in addlargs:
if type(addlargs["boot/kernel/"+x+\
"/packages"])==types.StringType:
addlargs["boot/kernel/"+x+"/packages"]=\
[addlargs["boot/kernel/"+x+"/packages"]]
def set_build_kernel_vars(self):
- if self.settings.has_key(self.settings["spec_prefix"]+"/gk_mainargs"):
+ if self.settings["spec_prefix"]+"/gk_mainargs" in self.settings:
self.settings["gk_mainargs"]=\
self.settings[self.settings["spec_prefix"]+"/gk_mainargs"]
del self.settings[self.settings["spec_prefix"]+"/gk_mainargs"]
clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+\
"unpack")
- if self.settings.has_key("SEEDCACHE"):
+ if "SEEDCACHE" in self.settings:
if os.path.isdir(self.settings["source_path"]):
""" SEEDCACHE Is a directory, use rsync """
unpack_cmd="rsync -a --delete "+self.settings["source_path"]+\
error_msg="Tarball extraction of "+self.settings["source_path"]+\
" to "+self.settings["chroot_path"]+" failed."
- if self.settings.has_key("AUTORESUME"):
+ if "AUTORESUME" in self.settings:
if os.path.isdir(self.settings["source_path"]) \
and os.path.exists(self.settings["autoresume_path"]+"unpack"):
""" Autoresume is valid, SEEDCACHE is valid """
invalid_snapshot=True
else:
""" No autoresume, SEEDCACHE """
- if self.settings.has_key("SEEDCACHE"):
+ if "SEEDCACHE" in self.settings:
""" SEEDCACHE so let's run rsync and let it clean up """
if os.path.isdir(self.settings["source_path"]):
unpack=True
self.mount_safety_check()
if invalid_snapshot:
- if self.settings.has_key("AUTORESUME"):
+ if "AUTORESUME" in self.settings:
print "No Valid Resume point detected, cleaning up..."
self.clear_autoresume()
if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
- if self.settings.has_key("PKGCACHE"):
+ if "PKGCACHE" in self.settings:
if not os.path.exists(self.settings["pkgcache_path"]):
os.makedirs(self.settings["pkgcache_path"],0755)
- if self.settings.has_key("KERNCACHE"):
+ if "KERNCACHE" in self.settings:
if not os.path.exists(self.settings["kerncache_path"]):
os.makedirs(self.settings["kerncache_path"],0755)
print display_msg
cmd(unpack_cmd,error_msg,env=self.env)
- if self.settings.has_key("source_path_hash"):
+ if "source_path_hash" in self.settings:
myf=open(self.settings["autoresume_path"]+"unpack","w")
myf.write(self.settings["source_path_hash"])
myf.close()
snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
"unpack_portage")
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
snapshot_cache_hash=\
read_from_clst(self.settings["snapshot_cache_path"]+\
"catalyst-hash")
self.settings["chroot_path"]+"/usr"
unpack_errmsg="Error unpacking snapshot"
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
"/usr/portage/") \
and os.path.exists(self.settings["autoresume_path"]\
unpack=False
if unpack:
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
self.snapshot_lock_object.write_lock()
if os.path.exists(destdir):
print cleanup_msg
print "Unpacking portage tree (This can take a long time) ..."
cmd(unpack_cmd,unpack_errmsg,env=self.env)
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
myf=open(self.settings["snapshot_cache_path"]+"catalyst-hash","w")
myf.write(self.settings["snapshot_path_hash"])
myf.close()
myf.write(self.settings["snapshot_path_hash"])
myf.close()
- if self.settings.has_key("SNAPCACHE"):
+ if "SNAPCACHE" in self.settings:
self.snapshot_lock_object.unlock()
def config_profile_link(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+\
"config_profile_link"):
print \
touch(self.settings["autoresume_path"]+"config_profile_link")
def setup_confdir(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+\
"setup_confdir"):
print "Resume point detected, skipping setup_confdir operation..."
else:
- if self.settings.has_key("portage_confdir"):
+ if "portage_confdir" in self.settings:
print "Configuring /etc/portage..."
cmd("rsync -a "+self.settings["portage_confdir"]+"/ "+\
self.settings["chroot_path"]+"/etc/portage/",\
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
- if self.settings.has_key("portage_overlay"):
+ if "portage_overlay" in self.settings:
for x in self.settings["portage_overlay"]:
if os.path.exists(x):
print "Copying overlay dir " +x
def root_overlay(self):
""" Copy over the root_overlay """
- if self.settings.has_key(self.settings["spec_prefix"]+"/root_overlay"):
+ if self.settings["spec_prefix"]+"/root_overlay" in self.settings:
for x in self.settings[self.settings["spec_prefix"]+\
"/root_overlay"]:
if os.path.exists(x):
os.makedirs(self.mountmap[x],0755)
src=self.mountmap[x]
- if self.settings.has_key("SNAPCACHE") and x == "/usr/portage":
+ if "SNAPCACHE" in self.settings and x == "/usr/portage":
self.snapshot_lock_object.read_lock()
if os.uname()[0] == "FreeBSD":
if src == "/dev":
self.settings["chroot_path"]+x)
else:
if src == "tmpfs":
- if self.settings.has_key("var_tmpfs_portage"):
+ if "var_tmpfs_portage" in self.settings:
retval=os.system("mount -t tmpfs -o size="+\
self.settings["var_tmpfs_portage"]+"G "+src+" "+\
self.settings["chroot_path"]+x)
ouch=1
warn("Couldn't umount bind mount: "+mypath+x)
- if self.settings.has_key("SNAPCACHE") and x == "/usr/portage":
+ if "SNAPCACHE" in self.settings and x == "/usr/portage":
try:
"""
It's possible the snapshot lock object isn't created yet.
self.override_cflags()
self.override_cxxflags()
self.override_ldflags()
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"chroot_setup"):
print "Resume point detected, skipping chroot_setup operation..."
else:
"Could not copy resolv.conf into place.",env=self.env)
""" Copy over the envscript, if applicable """
- if self.settings.has_key("ENVSCRIPT"):
+ if "ENVSCRIPT" in self.settings:
if not os.path.exists(self.settings["ENVSCRIPT"]):
raise CatalystError,\
"Can't find envscript "+self.settings["ENVSCRIPT"]
myf=open(self.settings["chroot_path"]+"/etc/portage/make.conf","w")
myf.write("# These settings were set by the catalyst build script that automatically\n# built this stage.\n")
myf.write("# Please consult /usr/share/portage/config/make.conf.example for a more\n# detailed example.\n")
- if self.settings.has_key("CFLAGS"):
+ if "CFLAGS" in self.settings:
myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
- if self.settings.has_key("CXXFLAGS"):
+ if "CXXFLAGS" in self.settings:
if self.settings["CXXFLAGS"]!=self.settings["CFLAGS"]:
myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
else:
else:
myf.write('CXXFLAGS="${CFLAGS}"\n')
- if self.settings.has_key("LDFLAGS"):
+ if "LDFLAGS" in self.settings:
myf.write("# LDFLAGS is unsupported. USE AT YOUR OWN RISK!\n")
myf.write('LDFLAGS="'+self.settings["LDFLAGS"]+'"\n')
- if self.settings.has_key("CBUILD"):
+ if "CBUILD" in self.settings:
myf.write("# This should not be changed unless you know exactly what you are doing. You\n# should probably be using a different stage, instead.\n")
myf.write('CBUILD="'+self.settings["CBUILD"]+'"\n')
""" Figure out what our USE vars are for building """
myusevars=[]
- if self.settings.has_key("HOSTUSE"):
+ if "HOSTUSE" in self.settings:
myusevars.extend(self.settings["HOSTUSE"])
- if self.settings.has_key("use"):
+ if "use" in self.settings:
myusevars.extend(self.settings["use"])
if myusevars:
print "\tpackage.use in the profile and portage_confdir. You've been warned!"
""" Setup the portage overlay """
- if self.settings.has_key("portage_overlay"):
+ if "portage_overlay" in self.settings:
myf.write('PORTDIR_OVERLAY="/usr/local/portage"\n')
myf.close()
touch(self.settings["autoresume_path"]+"chroot_setup")
def fsscript(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"fsscript"):
print "Resume point detected, skipping fsscript operation..."
else:
- if self.settings.has_key("fsscript"):
+ if "fsscript" in self.settings:
if os.path.exists(self.settings["controller_file"]):
cmd("/bin/bash "+self.settings["controller_file"]+\
" fsscript","fsscript script failed.",env=self.env)
touch(self.settings["autoresume_path"]+"fsscript")
def rcupdate(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"rcupdate"):
print "Resume point detected, skipping rcupdate operation..."
else:
touch(self.settings["autoresume_path"]+"rcupdate")
def clean(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"clean"):
print "Resume point detected, skipping clean operation..."
else:
touch(self.settings["autoresume_path"]+"clean")
def empty(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"empty"):
print "Resume point detected, skipping empty operation..."
else:
- if self.settings.has_key(self.settings["spec_prefix"]+"/empty"):
+ if self.settings["spec_prefix"]+"/empty" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/empty"])==types.StringType:
self.settings[self.settings["spec_prefix"]+"/empty"]=\
touch(self.settings["autoresume_path"]+"empty")
def remove(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"remove"):
print "Resume point detected, skipping remove operation..."
else:
- if self.settings.has_key(self.settings["spec_prefix"]+"/rm"):
+ if self.settings["spec_prefix"]+"/rm" in self.settings:
for x in self.settings[self.settings["spec_prefix"]+"/rm"]:
"""
We're going to shell out for all these cleaning
raise
def preclean(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"preclean"):
print "Resume point detected, skipping preclean operation..."
else:
raise CatalystError, "Build failed, could not execute preclean"
def capture(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"capture"):
print "Resume point detected, skipping capture operation..."
else:
touch(self.settings["autoresume_path"]+"capture")
def run_local(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"run_local"):
print "Resume point detected, skipping run_local operation..."
else:
self.env[varname]="true"
else:
self.env[varname]="false"
- if self.settings.has_key("makeopts"):
+ if "makeopts" in self.settings:
self.env["MAKEOPTS"]=self.settings["makeopts"]
def run(self):
""" Check for mounts right away and abort if we cannot unmount them """
self.mount_safety_check()
- if self.settings.has_key("CLEAR_AUTORESUME"):
+ if "CLEAR_AUTORESUME" in self.settings:
self.clear_autoresume()
- if self.settings.has_key("PURGETMPONLY"):
+ if "PURGETMPONLY" in self.settings:
self.purge()
return
- if self.settings.has_key("PURGEONLY"):
+ if "PURGEONLY" in self.settings:
self.purge()
return
- if self.settings.has_key("PURGE"):
+ if "PURGE" in self.settings:
self.purge()
for x in self.settings["action_sequence"]:
self.chroot_lock.unlock()
def unmerge(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"unmerge"):
print "Resume point detected, skipping unmerge operation..."
else:
- if self.settings.has_key(self.settings["spec_prefix"]+"/unmerge"):
+ if self.settings["spec_prefix"]+"/unmerge" in self.settings:
if type(self.settings[self.settings["spec_prefix"]+\
"/unmerge"])==types.StringType:
self.settings[self.settings["spec_prefix"]+"/unmerge"]=\
touch(self.settings["autoresume_path"]+"unmerge")
def target_setup(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"target_setup"):
print "Resume point detected, skipping target_setup operation..."
else:
touch(self.settings["autoresume_path"]+"target_setup")
def setup_overlay(self):
- if self.settings.has_key("AUTORESUME") \
+ 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 self.settings.has_key(self.settings["spec_prefix"]+"/overlay"):
+ if self.settings["spec_prefix"]+"/overlay" in self.settings:
for x in self.settings[self.settings["spec_prefix"]+"/overlay"]:
if os.path.exists(x):
cmd("rsync -a "+x+"/ "+\
touch(self.settings["autoresume_path"]+"setup_overlay")
def create_iso(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"create_iso"):
print "Resume point detected, skipping create_iso operation..."
else:
""" Create the ISO """
- if self.settings.has_key("iso"):
+ if "iso" in self.settings:
cmd("/bin/bash "+self.settings["controller_file"]+" iso "+\
self.settings["iso"],"ISO creation script failed.",\
env=self.env)
print "An ISO Image will not be created."
def build_packages(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+\
"build_packages"):
print "Resume point detected, skipping build_packages operation..."
else:
- if self.settings.has_key(self.settings["spec_prefix"]+"/packages"):
- if self.settings.has_key("AUTORESUME") \
+ if self.settings["spec_prefix"]+"/packages" in self.settings:
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+\
"build_packages"):
print "Resume point detected, skipping build_packages operation..."
"build aborting due to error."
def build_kernel(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"build_kernel"):
print "Resume point detected, skipping build_kernel operation..."
else:
- if self.settings.has_key("boot/kernel"):
+ if "boot/kernel" in self.settings:
try:
mynames=self.settings["boot/kernel"]
if type(mynames)==types.StringType:
env=self.env)
for kname in mynames:
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]\
+"build_kernel_"+kname):
print "Resume point detected, skipping build_kernel for "+kname+" operation..."
If we need to pass special options to the bootloader
for this kernel put them into the environment
"""
- if self.settings.has_key("boot/kernel/"+kname+\
- "/kernelopts"):
+ if "boot/kernel/"+kname+"/kernelopts" in self.settings:
myopts=self.settings["boot/kernel/"+kname+\
"/kernelopts"]
else:
self.env[kname+"_kernelopts"]=""
- if not self.settings.has_key("boot/kernel/"+kname+\
- "/extraversion"):
+ if "boot/kernel/"+kname+"/extraversion" not in self.settings:
self.settings["boot/kernel/"+kname+\
"/extraversion"]=""
self.settings["boot/kernel/"+kname+\
"/extraversion"]
- if self.settings.has_key("boot/kernel/"+kname+\
- "/initramfs_overlay"):
+ if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
if os.path.exists(self.settings["boot/kernel/"+\
kname+"/initramfs_overlay"]):
print "Copying initramfs_overlay dir "+\
" kernel "+kname,\
"Runscript kernel build failed",env=self.env)
- if self.settings.has_key("boot/kernel/"+kname+\
- "/initramfs_overlay"):
+ if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
if os.path.exists(self.settings["chroot_path"]+\
"/tmp/initramfs_overlay/"):
print "Cleaning up temporary overlay dir"
"build aborting due to kernel build error."
def bootloader(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+"bootloader"):
print "Resume point detected, skipping bootloader operation..."
else:
raise CatalystError,"Script aborting due to error."
def livecd_update(self):
- if self.settings.has_key("AUTORESUME") \
+ if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["autoresume_path"]+\
"livecd_update"):
print "Resume point detected, skipping build_packages operation..."
os.chmod(myemp,mystat[ST_MODE])
def clear_packages(self):
- if self.settings.has_key("PKGCACHE"):
+ if "PKGCACHE" in self.settings:
print "purging the pkgcache ..."
myemp=self.settings["pkgcache_path"]
os.chmod(myemp,mystat[ST_MODE])
def clear_kerncache(self):
- if self.settings.has_key("KERNCACHE"):
+ if "KERNCACHE" in self.settings:
print "purging the kerncache ..."
myemp=self.settings["kerncache_path"]
def clear_autoresume(self):
""" Clean resume points since they are no longer needed """
- if self.settings.has_key("AUTORESUME"):
+ if "AUTORESUME" in self.settings:
print "Removing AutoResume Points: ..."
myemp=self.settings["autoresume_path"]
if os.path.isdir(myemp):
- if self.settings.has_key("AUTORESUME"):
+ if "AUTORESUME" in self.settings:
print "Emptying directory",myemp
"""
stat the dir, delete the dir, recreate the dir and set
def gen_contents_file(self,file):
if os.path.exists(file+".CONTENTS"):
os.remove(file+".CONTENTS")
- if self.settings.has_key("contents"):
+ if "contents" in self.settings:
if os.path.exists(file):
myf=open(file+".CONTENTS","w")
keys={}
array.sort()
for j in array:
contents=generate_contents(file,contents_function=j,\
- verbose=self.settings.has_key("VERBOSE"))
+ verbose="VERBOSE" in self.settings)
if contents:
myf.write(contents)
myf.close()
def gen_digest_file(self,file):
if os.path.exists(file+".DIGESTS"):
os.remove(file+".DIGESTS")
- if self.settings.has_key("digests"):
+ if "digests" in self.settings:
if os.path.exists(file):
myf=open(file+".DIGESTS","w")
keys={}
if "all" in array:
for k in hash_map.keys():
hash=generate_hash(f,hash_function=k,verbose=\
- self.settings.has_key("VERBOSE"))
+ "VERBOSE" in self.settings)
myf.write(hash)
else:
for j in array:
hash=generate_hash(f,hash_function=j,verbose=\
- self.settings.has_key("VERBOSE"))
+ "VERBOSE" in self.settings)
myf.write(hash)
myf.close()
def purge(self):
countdown(10,"Purging Caches ...")
- if self.settings.has_key("PURGE") or self.settings.has_key("PURGEONLY") or self.settings.has_key("PURGETMPONLY"):
+ if any(k in self.settings for k in ("PURGE","PURGEONLY","PURGETMPONLY")):
print "clearing autoresume ..."
self.clear_autoresume()
print "clearing chroot ..."
self.clear_chroot()
- if not self.settings.has_key("PURGETMPONLY"):
+ if "PURGETMPONLY" not in self.settings:
print "clearing package cache ..."
self.clear_packages()