[Treepkg-commits] r107 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 25 17:09:06 CEST 2008


Author: bh
Date: 2008-06-25 17:09:06 +0200 (Wed, 25 Jun 2008)
New Revision: 107

Modified:
   trunk/treepkg/builder.py
Log:
Add the save_after_exec argument to the PBuilder.run_script method.  If
true, --save-after-exec is passed to pbuilder


Modified: trunk/treepkg/builder.py
===================================================================
--- trunk/treepkg/builder.py	2008-06-25 13:36:38 UTC (rev 106)
+++ trunk/treepkg/builder.py	2008-06-25 15:09:06 UTC (rev 107)
@@ -183,7 +183,7 @@
 
         self.update(suppress_output=True, log_info=True)
 
-    def run_script(self, script, logfile, bindmounts=()):
+    def run_script(self, script, logfile, bindmounts=(), save_after_exec=False):
         """Execute a script in pbuilder's chroot environment
         Parameters:
            script -- A list of strings with the command line to invoke the
@@ -192,6 +192,10 @@
            bindmounts -- Sequence of directory names that should be
                          bind-mounted in the pbuilder chroot
                          environment (optional)
+           save_after_exec -- Boolean indicating whether the chroot
+                              environment should be copied back so that
+                              modifications are available in subsequent
+                              uses of the pbuilder instance.
         """
         logging.info("Running pbuilder execute on %s", script)
         args = []
@@ -204,9 +208,11 @@
             open(logfile, "w").close()
         for mount in bindmounts:
             args.extend(["--bindmounts", mount])
+        if save_after_exec:
+            args.append("--save-after-exec")
 
         run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder execute"
-                           " --configfile $pbuilderrc @args @script",
+                           " --configfile $pbuilderrc @args -- @script",
                            rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc,
                            args=args, script=script),
                  suppress_output=False)



More information about the Treepkg-commits mailing list