changeset 361:72b39fcb6a24

sbdmock is now able to run scripts
author Bjoern Ricks <bricks@intevation.de>
date Thu, 20 May 2010 13:37:36 +0000
parents 399008ca131e
children 7a1385c1207c
files treepkg/sbuilder.py
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/sbuilder.py	Wed May 19 10:04:02 2010 +0000
+++ b/treepkg/sbuilder.py	Thu May 20 13:37:36 2010 +0000
@@ -159,7 +159,33 @@
                               modifications are available in subsequent
                               uses of the builder instance.
         """
-        logging.error("It isn't possible to run scripts withon sbdmock.")
+
+        if not script[0]:
+                raise RuntimeError("No script to execute was passed")
+
+        args = []
+        if logfile is not None:
+            logdir = os.path.dirname(logfile)
+            args.extend(["--rootlog=%s" % logfile])
+            args.extend(["--logdir=%s" % logdir])
+        if bindmounts:
+            self.mount(bindmounts)
+        
+        self.mount([self.extra_pkg_dir])
+
+        cmd = cmdexpand("/usr/bin/sbdmock exec $script --cleanbuilddir"
+                        " --config=$builderconfig"
+#                       " --dbo=" # aren't build options setable in treepkg.cfg?
+                        " -u @args",
+                        builderconfig=self.builderconfig,
+                        script=script[0],
+                        args=args)
+        logging.debug("sbdmock cmd: %s" % cmd)
+
+        try:
+            run.call(cmd, suppress_output=False)
+        finally:
+            self.umount_all()
 
     def login(self, bindmounts=(), save_after_login=False):
         """Start an interactive shell in the builder environment"""
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)