# HG changeset patch # User Andre Heinecke # Date 1271251050 0 # Node ID 524ad62ab207e6eef651936b4af2c50ca7e57b35 # Parent 28df50b267f6f977268f4bd0cd1b34841d83f1b5 Build logs are now also compressed when errors occur during building diff -r 28df50b267f6 -r 524ad62ab207 treepkg/builder.py --- a/treepkg/builder.py Tue Apr 13 09:53:19 2010 +0000 +++ b/treepkg/builder.py Wed Apr 14 13:17:30 2010 +0000 @@ -179,15 +179,22 @@ args.extend(["--bindmounts", mount]) for pkg in extra_packages: args.extend(["--extrapackages", pkg]) - run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder build" - " --configfile $pbuilderrc @args" - " --debbuildopts -b $dsc", - rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc, - dsc=dsc_file, args=args), - suppress_output=True, - extra_env=extra_env) - if logfile is not None and os.path.exists(logfile): - run.call(cmdexpand("gzip -9 $logfile", logfile=logfile)) + try: + run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder build" + " --configfile $pbuilderrc @args" + " --debbuildopts -b $dsc", + rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc, + dsc=dsc_file, args=args), + suppress_output=True, + extra_env=extra_env) + except: + if logfile is not None and os.path.exists(logfile): + run.call(cmdexpand("gzip -9 $logfile", logfile=logfile)) + raise + else: + if logfile is not None and os.path.exists(logfile): + run.call(cmdexpand("gzip -9 $logfile", logfile=logfile)) + # remove the source package files put into the binary directory # by pbuilder if binary_dir is not None: