Mercurial > treepkg
comparison bin/treepkgbuilder.py @ 243:f4a636ed5d07
Add execute command to treepkgbuilder
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 20 Jan 2009 11:06:35 +0000 |
parents | 98c5aab790bb |
children | 21da92cea416 |
comparison
equal
deleted
inserted
replaced
242:351427b28b76 | 243:f4a636ed5d07 |
---|---|
1 #! /usr/bin/python2.4 | 1 #! /usr/bin/python2.4 |
2 # Copyright (C) 2007, 2008 by Intevation GmbH | 2 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
3 # Authors: | 3 # Authors: |
4 # Bernhard Herzog <bh@intevation.de> | 4 # Bernhard Herzog <bh@intevation.de> |
5 # | 5 # |
6 # This program is free software under the GPL (>=v2) | 6 # This program is free software under the GPL (>=v2) |
7 # Read the file COPYING coming with the software for details. | 7 # Read the file COPYING coming with the software for details. |
155 dsc_file = self.rest[0] | 155 dsc_file = self.rest[0] |
156 self.get_builder().build(dsc_file, binary_dir=self.opts.binary_dir, | 156 self.get_builder().build(dsc_file, binary_dir=self.opts.binary_dir, |
157 logfile=self.opts.logfile) | 157 logfile=self.opts.logfile) |
158 | 158 |
159 | 159 |
160 class ExecuteCommand(Command): | |
161 | |
162 names = ("execute",) | |
163 | |
164 def create_parser(self): | |
165 parser = super(ExecuteCommand, self).create_parser() | |
166 parser.add_option("--logfile", help=("Log file.")) | |
167 parser.add_option("--bind-mount", action="append", | |
168 help=("Directories to bind-mount in the chroot" | |
169 " environment.")) | |
170 return parser | |
171 | |
172 def run(self): | |
173 if not self.rest: | |
174 print >>sys.stderr, "At least the script file must be specified" | |
175 sys.exit(1) | |
176 script = self.rest | |
177 self.get_builder().run_script(script, bindmounts=self.opts.bind_mount, | |
178 logfile=self.opts.logfile) | |
179 | |
180 | |
160 class HelpCommand(Command): | 181 class HelpCommand(Command): |
161 | 182 |
162 names = ("help", "--help", "-h") | 183 names = ("help", "--help", "-h") |
163 | 184 |
164 def run(self): | 185 def run(self): |