[Treepkg-commits] r99 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jun 23 21:36:45 CEST 2008


Author: bh
Date: 2008-06-23 21:36:45 +0200 (Mon, 23 Jun 2008)
New Revision: 99

Modified:
   trunk/treepkg/builder.py
Log:
treepkg.builder.PBuilder: refactor the actual apt-ftparchive call into a
separate method


Modified: trunk/treepkg/builder.py
===================================================================
--- trunk/treepkg/builder.py	2008-06-23 19:29:39 UTC (rev 98)
+++ trunk/treepkg/builder.py	2008-06-23 19:36:45 UTC (rev 99)
@@ -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",



More information about the Treepkg-commits mailing list