4 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
6 from catalyst_support import *
7 from generic_stage_target import *
9 class livecd_stage1_target(generic_stage_target):
11 Builder class for LiveCD stage1.
13 def __init__(self,spec,addlargs):
14 self.required_values=["livecd/packages"]
15 self.valid_values=self.required_values[:]
17 self.valid_values.extend(["livecd/use"])
18 generic_stage_target.__init__(self,spec,addlargs)
20 def set_action_sequence(self):
21 self.settings["action_sequence"]=["unpack","unpack_snapshot",\
22 "config_profile_link","setup_confdir","portage_overlay",\
23 "bind","chroot_setup","setup_environment","build_packages",\
24 "unbind", "clean","clear_autoresume"]
25 def set_target_path(self):
26 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
27 if self.settings.has_key("AUTORESUME") \
28 and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
29 print "Resume point detected, skipping target path setup operation..."
31 # first clean up any existing target stuff
32 if os.path.exists(self.settings["target_path"]):
33 cmd("rm -rf "+self.settings["target_path"],\
34 "Could not remove existing directory: "+self.settings["target_path"],env=self.env)
35 touch(self.settings["autoresume_path"]+"setup_target_path")
37 if not os.path.exists(self.settings["target_path"]):
38 os.makedirs(self.settings["target_path"])
41 def set_target_path(self):
43 def set_spec_prefix(self):
44 self.settings["spec_prefix"]="livecd"
47 generic_stage_target.set_use(self)
48 if self.settings.has_key("use"):
49 self.settings["use"].append("livecd")
50 self.settings["use"].append("bindist")
52 self.settings["use"]=["livecd"]
53 self.settings["use"].append("bindist")
55 def set_packages(self):
56 generic_stage_target.set_packages(self)
57 if self.settings.has_key(self.settings["spec_prefix"]+"/packages"):
58 if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
59 self.settings[self.settings["spec_prefix"]+"/packages"] = \
60 self.settings[self.settings["spec_prefix"]+"/packages"].split()
61 self.settings[self.settings["spec_prefix"]+"/packages"].append("app-misc/livecd-tools")
63 def set_pkgcache_path(self):
64 if self.settings.has_key("pkgcache_path"):
65 if type(self.settings["pkgcache_path"]) != types.StringType:
66 self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
68 generic_stage_target.set_pkgcache_path(self)
71 foo.update({"livecd-stage1":livecd_stage1_target})