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 stage1_target(generic_stage_target):
11 Builder class for a stage1 installation tarball build.
13 def __init__(self,spec,addlargs):
14 self.required_values=[]
15 self.valid_values=["chost"]
16 generic_stage_target.__init__(self,spec,addlargs)
18 def set_stage_path(self):
19 self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
20 print "stage1 stage path is "+self.settings["stage_path"]
22 def set_root_path(self):
23 # sets the root path, relative to 'chroot_path', of the stage1 root
24 self.settings["root_path"]=normpath("/tmp/stage1root")
25 print "stage1 root path is "+self.settings["root_path"]
27 def set_cleanables(self):
28 generic_stage_target.set_cleanables(self)
29 self.settings["cleanables"].extend(["/usr/share/gettext",\
30 "/usr/lib/python2.2/test", "/usr/lib/python2.2/email",\
31 "/usr/lib/python2.2/lib-tk", "/usr/lib/python2.3/test",\
32 "/usr/lib/python2.3/email", "/usr/lib/python2.3/lib-tk",\
33 "/usr/lib/python2.4/test", "/usr/lib/python2.4/email",\
34 "/usr/lib/python2.4/lib-tk", "/usr/share/zoneinfo",\
37 # XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target?
39 def override_chost(self):
40 if self.settings.has_key("chost"):
41 self.settings["CHOST"]=list_to_string(self.settings["chost"])
43 def override_cflags(self):
44 if self.settings.has_key("cflags"):
45 self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
47 def override_cxxflags(self):
48 if self.settings.has_key("cxxflags"):
49 self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
51 def override_ldflags(self):
52 if self.settings.has_key("ldflags"):
53 self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
55 def set_portage_overlay(self):
56 generic_stage_target.set_portage_overlay(self)
57 if self.settings.has_key("portage_overlay"):
58 print "\nWARNING !!!!!"
59 print "\tUsing an portage overlay for earlier stages could cause build issues."
60 print "\tIf you break it, you buy it. Don't complain to us about it."
61 print "\tDont say we did not warn you\n"
64 if os.uname()[0] == "FreeBSD":
65 # baselayout no longer creates the .keep files in proc and dev for FreeBSD as it
66 # would create them too late...we need them earlier before bind mounting filesystems
67 # since proc and dev are not writeable, so...create them here
68 if not os.path.exists(self.settings["stage_path"]+"/proc"):
69 os.makedirs(self.settings["stage_path"]+"/proc")
70 if not os.path.exists(self.settings["stage_path"]+"/dev"):
71 os.makedirs(self.settings["stage_path"]+"/dev")
72 if not os.path.isfile(self.settings["stage_path"]+"/proc/.keep"):
74 proc_keepfile = open(self.settings["stage_path"]+"/proc/.keep","w")
75 proc_keepfile.write('')
78 print "!!! Failed to create %s" % (self.settings["stage_path"]+"/dev/.keep")
79 if not os.path.isfile(self.settings["stage_path"]+"/dev/.keep"):
81 dev_keepfile = open(self.settings["stage_path"]+"/dev/.keep","w")
82 dev_keepfile.write('')
85 print "!!! Failed to create %s" % (self.settings["stage_path"]+"/dev/.keep")
90 # stage_path/proc probably doesn't exist yet, so create it
91 if not os.path.exists(self.settings["stage_path"]+"/proc"):
92 os.makedirs(self.settings["stage_path"]+"/proc")
94 # alter the mount mappings to bind mount proc onto it
95 self.mounts.append("/tmp/stage1root/proc")
96 self.mountmap["/tmp/stage1root/proc"]="/proc"
100 foo.update({"stage1":stage1_target})