changeset 174:2d7415b84e32

treepkg.builder.PBuilder: refactor the actual apt-ftparchive call into a separate method
author Bernhard Herzog <bh@intevation.de>
date Mon, 23 Jun 2008 19:36:45 +0000
parents 97435e92411a
children e4512f045999
files treepkg/builder.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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",
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)