changeset 182:88c8f255b5a0

Add the save_after_exec argument to the PBuilder.run_script method. If true, --save-after-exec is passed to pbuilder
author Bernhard Herzog <bh@intevation.de>
date Wed, 25 Jun 2008 15:09:06 +0000
parents 81585486281b
children 72e41b27f224
files treepkg/builder.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/builder.py	Wed Jun 25 13:36:38 2008 +0000
+++ b/treepkg/builder.py	Wed Jun 25 15:09:06 2008 +0000
@@ -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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)