Change catalyst program to load target modules with catalyst.target.targets class
Remove required_build_targets and valid_build_targets from catalyst_support.py, since we can scan the dir now
# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst,
+ modules/catalyst/target/embedded_target.py,
+ modules/catalyst/target/grp_target.py,
+ modules/catalyst/target/livecd_stage1_target.py,
+ modules/catalyst/target/livecd_stage2_target.py,
+ modules/catalyst/target/netboot2_target.py,
+ modules/catalyst/target/netboot_target.py,
+ modules/catalyst/target/snapshot_target.py,
+ modules/catalyst/target/stage1_target.py,
+ modules/catalyst/target/stage2_target.py,
+ modules/catalyst/target/stage3_target.py,
+ modules/catalyst/target/stage4_target.py,
+ modules/catalyst/target/tinderbox_target.py, modules/catalyst_support.py:
+ Add target map in each target module and remove register() function
+ Change catalyst program to load target modules with catalyst.target.targets
+ class
+ Remove required_build_targets and valid_build_targets from catalyst_support.py,
+ since we can scan the dir now
+
11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+modules/catalyst/target/__init__.py,
+modules/catalyst/target/embedded_target.py,
# import catalyst's own modules (i.e. catalyst_support and the arch modules)
targetmap={}
- try:
- for x in required_build_targets:
- try:
- fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
- fh.close()
-
- except IOError:
- raise CatalystError,"Can't find "+x+".py plugin in "+\
- conf_values.settings["sharedir"]+"/modules/"
-
- for x in valid_build_targets:
- try:
- fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
- module.register(targetmap)
- fh.close()
-
- except IOError:
- raise CatalystError,"Can't find "+x+".py plugin in "+\
- conf_values.settings["sharedir"]+"/modules/"
-
- except ImportError:
- print "!!! catalyst: Python modules not found in "+\
- conf_values["sharedir"]+"/modules; exiting."
- sys.exit(1)
+ targets = catalyst.target.targets()
+ for x in targets.get_targets():
+ targetmap.update(x.__target_map)
return targetmap
self.settings["root_path"]=normpath("/tmp/mergeroot")
print "embedded root path is "+self.settings["root_path"]
-def register(foo):
- foo.update({"embedded":embedded_target})
- return foo
+__target_map = {"embedded":embedded_target}
"setup_environment","run_local","unbind",\
"generate_digests","clear_autoresume"]
-def register(foo):
- foo.update({"grp":grp_target})
- return foo
+__target_map = {"grp":grp_target}
else:
generic_stage_target.set_pkgcache_path(self)
-def register(foo):
- foo.update({"livecd-stage1":livecd_stage1_target})
- return foo
+__target_map = {"livecd-stage1":livecd_stage1_target}
"setup_overlay","create_iso"]
self.settings["action_sequence"].append("clear_autoresume")
-def register(foo):
- foo.update({"livecd-stage2":livecd_stage2_target})
- return foo
+__target_map = {"livecd-stage2":livecd_stage2_target}
"copy_files_to_image","setup_overlay","build_kernel","move_kernels",\
"remove","empty","unbind","clean","clear_autoresume"]
-def register(foo):
- foo.update({"netboot2":netboot2_target})
- return foo
+__target_map = {"netboot2":netboot2_target}
"build_kernel","copy_files_to_image",\
"clean","create_netboot_files","unbind","clear_autoresume"]
-def register(foo):
- foo.update({"netboot":netboot_target})
- return foo
+__target_map = {"netboot":netboot_target}
os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
os.chmod(myemp,mystat[ST_MODE])
-def register(foo):
- foo.update({"snapshot":snapshot_target})
- return foo
+__target_map = {"snapshot":snapshot_target}
self.mountmap["/tmp/stage1root/proc"]="/proc"
-def register(foo):
- foo.update({"stage1":stage1_target})
- return foo
+__target_map = {"stage1":stage1_target}
print "\tIf you break it, you buy it. Don't complain to us about it."
print "\tDont say we did not warn you\n"
-def register(foo):
- foo.update({"stage2":stage2_target})
- return foo
+__target_map = {"stage2":stage2_target}
generic_stage_target.set_cleanables(self)
self.settings["cleanables"].extend(["/etc/portage"])
-def register(foo):
- foo.update({"stage3":stage3_target})
- return foo
+__target_map = {"stage3":stage3_target}
self.settings["action_sequence"].append("capture")
self.settings["action_sequence"].append("clear_autoresume")
-def register(foo):
- foo.update({"stage4":stage4_target})
- return foo
+__target_map = {"stage4":stage4_target}
"setup_environment","run_local","preclean","unbind","clean",\
"clear_autoresume"]
-def register(foo):
- foo.update({"tinderbox":tinderbox_target})
- return foo
+__target_map = {"tinderbox":tinderbox_target}
return myline
# read_from_clst
-# these should never be touched
-required_build_targets=["generic_target","generic_stage_target"]
-
-# new build types should be added here
-valid_build_targets=["stage1_target","stage2_target","stage3_target","stage4_target","grp_target",
- "livecd_stage1_target","livecd_stage2_target","embedded_target",
- "tinderbox_target","snapshot_target","netboot_target","netboot2_target"]
-
required_config_file_values=["storedir","sharedir","distdir","portdir"]
valid_config_file_values=required_config_file_values[:]
valid_config_file_values.append("PKGCACHE")