[Treepkg-commits] r317 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu May 20 15:37:37 CEST 2010


Author: bricks
Date: 2010-05-20 15:37:36 +0200 (Thu, 20 May 2010)
New Revision: 317

Modified:
   trunk/treepkg/sbuilder.py
Log:
sbdmock is now able to run scripts


Modified: trunk/treepkg/sbuilder.py
===================================================================
--- trunk/treepkg/sbuilder.py	2010-05-19 10:04:02 UTC (rev 316)
+++ trunk/treepkg/sbuilder.py	2010-05-20 13:37:36 UTC (rev 317)
@@ -159,8 +159,34 @@
                               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"""
         args = []



More information about the Treepkg-commits mailing list