It helps if I update the ChangeLog properly.
[catalyst.git] / modules / livecd_stage1_target.py
1
2 """
3 Builder class for LiveCD stage1.
4 """
5
6 from catalyst_support import *
7 from generic_stage_target import *
8
9 class livecd_stage1_target(generic_stage_target):
10         def __init__(self,spec,addlargs):
11                 self.required_values=["livecd/packages"]
12                 self.valid_values=self.required_values[:]
13
14                 self.valid_values.extend(["livecd/use"])
15                 generic_stage_target.__init__(self,spec,addlargs)
16
17         def set_action_sequence(self):
18                 self.settings["action_sequence"]=["unpack","unpack_snapshot",\
19                                         "config_profile_link","setup_confdir","portage_overlay",\
20                                         "bind","chroot_setup","setup_environment","build_packages",\
21                                         "unbind", "clean","clear_autoresume"]
22         def set_target_path(self):
23                 self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
24                 if self.settings.has_key("AUTORESUME") \
25                         and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
26                                 print "Resume point detected, skipping target path setup operation..."
27                 else:
28                         # first clean up any existing target stuff
29                         if os.path.exists(self.settings["target_path"]):
30                                 cmd("rm -rf "+self.settings["target_path"],\
31                                         "Could not remove existing directory: "+self.settings["target_path"],env=self.env)
32                                 touch(self.settings["autoresume_path"]+"setup_target_path")
33                         
34                         if not os.path.exists(self.settings["target_path"]):
35                                 os.makedirs(self.settings["target_path"])
36         
37         
38         def set_target_path(self):
39                 pass
40         def set_spec_prefix(self):
41                         self.settings["spec_prefix"]="livecd"
42         
43         def set_use(self):
44                 generic_stage_target.set_use(self)
45                 if self.settings.has_key("use"):
46                         self.settings["use"].append("livecd")
47                         self.settings["use"].append("bindist")
48                 else:
49                         self.settings["use"]=["livecd"]
50                         self.settings["use"].append("bindist")
51
52         def set_packages(self):
53                 generic_stage_target.set_packages(self)
54                 if self.settings.has_key(self.settings["spec_prefix"]+"/packages"):
55                         if type(self.settings[self.settings["spec_prefix"]+"/packages"]) == types.StringType:
56                                 self.settings[self.settings["spec_prefix"]+"/packages"] = \
57                                         self.settings[self.settings["spec_prefix"]+"/packages"].split()
58                 self.settings[self.settings["spec_prefix"]+"/packages"].append("app-misc/livecd-tools")
59
60         def set_pkgcache_path(self):
61                 if self.settings.has_key("pkgcache_path"):
62                         if type(self.settings["pkgcache_path"]) != types.StringType:
63                                 self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
64                 else:
65                         generic_stage_target.set_pkgcache_path(self)
66
67 def register(foo):
68         foo.update({"livecd-stage1":livecd_stage1_target})
69         return foo