This patch adds in support for automatically detecting and decompressing
[catalyst.git] / modules / tinderbox_target.py
1 """
2 Tinderbox target
3 """
4 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
5
6 from catalyst_support import *
7 from generic_stage_target import *
8
9 class tinderbox_target(generic_stage_target):
10         """
11         Builder class for the tinderbox target
12         """
13         def __init__(self,spec,addlargs):
14                 self.required_values=["tinderbox/packages"]
15                 self.valid_values=self.required_values[:]
16                 self.valid_values.extend(["tinderbox/use"])
17                 generic_stage_target.__init__(self,spec,addlargs)
18
19         def run_local(self):
20                 # tinderbox
21                 # example call: "grp.sh run xmms vim sys-apps/gleep"
22                 try:
23                         if os.path.exists(self.settings["controller_file"]):
24                             cmd("/bin/bash "+self.settings["controller_file"]+" run "+\
25                                 list_bashify(self.settings["tinderbox/packages"]),"run script failed.",env=self.env)
26                 
27                 except CatalystError:
28                         self.unbind()
29                         raise CatalystError,"Tinderbox aborting due to error."
30
31         def set_cleanables(self):
32             self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
33                                         "/usr/portage"]
34         def set_action_sequence(self):
35                 #Default action sequence for run method
36                 self.settings["action_sequence"]=["unpack","unpack_snapshot",\
37                               "config_profile_link","setup_confdir","bind","chroot_setup",\
38                               "setup_environment","run_local","preclean","unbind","clean",\
39                               "clear_autoresume"]
40         
41 def register(foo):
42         foo.update({"tinderbox":tinderbox_target})
43         return foo