# HG changeset patch # User Bernhard Herzog # Date 1214249805 0 # Node ID 2d7415b84e3208da5f346ceb81cf6003cfffe5ec # Parent 97435e92411ae8de03b78610369a2de3bd7293a7 treepkg.builder.PBuilder: refactor the actual apt-ftparchive call into a separate method diff -r 97435e92411a -r 2d7415b84e32 treepkg/builder.py --- a/treepkg/builder.py Mon Jun 23 19:29:39 2008 +0000 +++ b/treepkg/builder.py Mon Jun 23 19:36:45 2008 +0000 @@ -95,15 +95,17 @@ # turn the extra-pkg directory into a proper deb archive print "turning the extra-pkg dir into a debian archive" - run.call(cmdexpand("apt-ftparchive packages ."), - stdout=open(os.path.join(self.extra_pkg_dir, "Packages"), "w"), - cwd=self.extra_pkg_dir) + self.update_extra_pkg_dir() # create the base.tgz chroot print "running pbuilder create" run.call(cmdexpand("@root_cmd pbuilder create --configfile $pbuilderrc", root_cmd=self.root_cmd, pbuilderrc=self.pbuilderrc)) + def update_extra_pkg_dir(self): + run.call(cmdexpand("apt-ftparchive packages ."), + stdout=open(os.path.join(self.extra_pkg_dir, "Packages"), "w"), + cwd=self.extra_pkg_dir) def build(self, dsc_file, binary_dir, logfile, bindmounts=(), extra_packages=(), extra_env=None): @@ -153,15 +155,13 @@ assumes that pbuilder was set up the way bin/initpbuilder.py does. """ - extrapkg_dir = os.path.join(os.path.dirname(self.pbuilderrc), - "extra-pkg") for filename in filenames: - logging.info("Copying %s into %s", filename, extrapkg_dir) - shutil.copy(filename, extrapkg_dir) - logging.info("Running apt-ftparchive in %s", extrapkg_dir) - run.call(cmdexpand("apt-ftparchive packages ."), - stdout=open(os.path.join(extrapkg_dir, "Packages"), "w"), - cwd=extrapkg_dir) + logging.info("Copying %s into %s", filename, self.extra_pkg_dir) + shutil.copy(filename, self.extra_pkg_dir) + + logging.info("Running apt-ftparchive in %s", self.extra_pkg_dir) + self.update_extra_pkg_dir() + logging.info("Running pbuilder update for %s", self.pbuilderrc) run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder update" " --configfile $pbuilderrc",