Mercurial > treepkg
changeset 209:cbcd8f549ff7
Make logfile and binary_dir parameters of PBuilder.build optional.
Adapt test cases to changed order of pbuild command line arguments.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Fri, 14 Nov 2008 19:41:03 +0000 |
parents | 1527c37bd7aa |
children | 63f73bb9c459 |
files | test/test_builder.py treepkg/builder.py |
diffstat | 2 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test_builder.py Thu Nov 06 15:59:50 2008 +0000 +++ b/test/test_builder.py Fri Nov 14 19:41:03 2008 +0000 @@ -190,10 +190,10 @@ "/home/builder/pbuilder"]) self.check_command_line(['/usr/sbin/pbuilder', 'build', '--configfile', 'my_pbuilderrc', + '--logfile', logfilename, + '--buildresult', binary_dir_name, '--bindmounts', "/home/builder/tracks", '--bindmounts', "/home/builder/pbuilder", - '--logfile', logfilename, - '--buildresult', binary_dir_name, '--debbuildopts', '-b', 'my_dsc_file']) self.failUnless(os.path.isdir(binary_dir_name)) @@ -213,10 +213,10 @@ extra_packages=["subversion", "texinfo"]) self.check_command_line(['/usr/sbin/pbuilder', 'build', '--configfile', 'my_pbuilderrc', + '--logfile', logfilename, + '--buildresult', binary_dir_name, '--extrapackages', "subversion", '--extrapackages', "texinfo", - '--logfile', logfilename, - '--buildresult', binary_dir_name, '--debbuildopts', '-b', 'my_dsc_file']) self.failUnless(os.path.isdir(binary_dir_name))
--- a/treepkg/builder.py Thu Nov 06 15:59:50 2008 +0000 +++ b/treepkg/builder.py Fri Nov 14 19:41:03 2008 +0000 @@ -152,7 +152,7 @@ finally: script.close() - def build(self, dsc_file, binary_dir, logfile, bindmounts=(), + def build(self, dsc_file, binary_dir=None, logfile=None, bindmounts=(), extra_packages=(), extra_env=None): """Build a binary packager from a source package Parameters: @@ -169,26 +169,29 @@ not remove these variables when it starts pbuilder """ - util.ensure_directory(binary_dir) args = [] + if logfile is not None: + args.extend(["--logfile", logfile]) + if binary_dir is not None: + args.extend(["--buildresult", binary_dir]) + util.ensure_directory(binary_dir) for mount in bindmounts: args.extend(["--bindmounts", mount]) for pkg in extra_packages: args.extend(["--extrapackages", pkg]) run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder build" " --configfile $pbuilderrc @args" - " --logfile $logfile --buildresult $bindir" " --debbuildopts -b $dsc", rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc, - logfile=logfile, bindir=binary_dir, dsc=dsc_file, - args=args), + dsc=dsc_file, args=args), suppress_output=True, extra_env=extra_env) # remove the source package files put into the binary directory # by pbuilder - for filename in os.listdir(binary_dir): - if os.path.splitext(filename)[1] not in (".deb", ".changes"): - os.remove(os.path.join(binary_dir, filename)) + if binary_dir is not None: + for filename in os.listdir(binary_dir): + if os.path.splitext(filename)[1] not in (".deb", ".changes"): + os.remove(os.path.join(binary_dir, filename)) def add_binaries_to_extra_pkg(self, filenames): """Adds binary packages to the extra-pkg directory.