# HG changeset patch # User Bernhard Herzog # Date 1214406546 0 # Node ID 88c8f255b5a04fec43ddd975c88cb53cbd0671e4 # Parent 81585486281b0bfd5b6bd914ba24b96b5f182ee2 Add the save_after_exec argument to the PBuilder.run_script method. If true, --save-after-exec is passed to pbuilder diff -r 81585486281b -r 88c8f255b5a0 treepkg/builder.py --- 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)