diff 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
line wrap: on
line diff
--- a/bin/treepkgbuilder.py	Fri Jan 16 20:42:06 2009 +0000
+++ b/bin/treepkgbuilder.py	Tue Jan 20 11:06:35 2009 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/python2.4
-# Copyright (C) 2007, 2008 by Intevation GmbH
+# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh@intevation.de>
 #
@@ -157,6 +157,27 @@
                                  logfile=self.opts.logfile)
 
 
+class ExecuteCommand(Command):
+
+    names = ("execute",)
+
+    def create_parser(self):
+        parser = super(ExecuteCommand, self).create_parser()
+        parser.add_option("--logfile", help=("Log file."))
+        parser.add_option("--bind-mount", action="append",
+                          help=("Directories to bind-mount in the chroot"
+                                " environment."))
+        return parser
+
+    def run(self):
+        if not self.rest:
+            print >>sys.stderr, "At least the script file must be specified"
+            sys.exit(1)
+        script = self.rest
+        self.get_builder().run_script(script, bindmounts=self.opts.bind_mount,
+                                      logfile=self.opts.logfile)
+
+
 class HelpCommand(Command):
 
     names = ("help", "--help", "-h")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)