[Treepkg-commits] r169 - trunk/bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 20 12:06:36 CET 2009


Author: bh
Date: 2009-01-20 12:06:35 +0100 (Tue, 20 Jan 2009)
New Revision: 169

Modified:
   trunk/bin/treepkgbuilder.py
Log:
Add execute command to treepkgbuilder


Modified: trunk/bin/treepkgbuilder.py
===================================================================
--- trunk/bin/treepkgbuilder.py	2009-01-16 20:42:06 UTC (rev 168)
+++ trunk/bin/treepkgbuilder.py	2009-01-20 11:06:35 UTC (rev 169)
@@ -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 at 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")



More information about the Treepkg-commits mailing list