changeset 297:4dd6ec3a1151

Make it possible to use parallel builds for packages that support it: Add a new per-track configuration option deb_build_options whose value is passed as the DEB_BUILD_OPTIONS environment variable to the pbuilder process.
author Bernhard Herzog <bh@intevation.de>
date Fri, 20 Nov 2009 20:19:51 +0000
parents ce7be2fb93ee
children e9d5b44f8f52
files test/test_readconfig.py treepkg/packager.py treepkg/readconfig.py
diffstat 3 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_readconfig.py	Wed Nov 18 18:11:22 2009 +0000
+++ b/test/test_readconfig.py	Fri Nov 20 20:19:51 2009 +0000
@@ -48,6 +48,7 @@
 packager_class: readconfig_test.extraargs
 orig_tarball: %(base_dir)s/mytarball.tgz
 rules_svn_url: file:///tmp/my-debian-repository
+deb_build_options: parallel=2
 """
 
     files = [("treepkg.cfg", config_contents),
@@ -83,6 +84,7 @@
                  base_dir="/home/builder/mill/tracks/extraargs",
                  deb_email="treepkg@example.com",
                  deb_fullname="TreePKG",
+                 deb_build_options="parallel=2",
                  pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=False,
                  packager_class="readconfig_test.extraargs",
@@ -97,6 +99,7 @@
                  base_dir="/home/builder/mill/tracks/simple",
                  deb_email="treepkg@example.com",
                  deb_fullname="TreePKG",
+                 deb_build_options="",
                  rules_svn_url="",
                  pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=True,
--- a/treepkg/packager.py	Wed Nov 18 18:11:22 2009 +0000
+++ b/treepkg/packager.py	Fri Nov 20 20:19:51 2009 +0000
@@ -232,7 +232,8 @@
         util.ensure_directory(self.binary_dir)
         util.ensure_directory(self.log_dir)
         logging.info("Building binary package; logging to %r", self.logfile)
-        self.track.builder.build(self.dsc_file, self.binary_dir, self.logfile)
+        self.track.builder.build(self.dsc_file, self.binary_dir, self.logfile,
+                                 extra_env=self.track.debian_environment())
         self.sign_package()
         self.status.binary_package_created()
 
@@ -348,13 +349,14 @@
                  deb_fullname, packager_class="treepkg.packager",
                  pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=False, signing_key_id="", do_build=True,
-                 rules_svn_url=None):
+                 rules_svn_url=None, deb_build_options=""):
         self.name = name
         self.base_dir = base_dir
         self.builder = PBuilder(pbuilderrc, root_cmd,
                                 release_signing_keyid=signing_key_id)
         self.deb_email = deb_email
         self.deb_fullname = deb_fullname
+        self.deb_build_options = deb_build_options
         self.pkg_revision_template = pkg_revision_template
         self.signing_key_id = signing_key_id
         self.do_build = do_build
@@ -460,6 +462,11 @@
         env = os.environ.copy()
         env["DEBFULLNAME"] = self.deb_fullname
         env["DEBEMAIL"] = self.deb_email
+        env["DEB_BUILD_OPTIONS"] = self.deb_build_options
+        # cdbs requires DEB_BUILD_PARALLEL set to something non-empty,
+        # otherwise it will ignore any parallel=<n> setting in
+        # DEB_BUILD_OPTIONS.
+        env["DEB_BUILD_PARALLEL"] = "true"
         return env
 
     def packager_for_new_revision(self):
--- a/treepkg/readconfig.py	Wed Nov 18 18:11:22 2009 +0000
+++ b/treepkg/readconfig.py	Fri Nov 20 20:19:51 2009 +0000
@@ -26,7 +26,8 @@
 packager_desc = [
     "name", "base_dir", "svn_url", ("rules_svn_url", str, ""), "packager_class",
     ("root_cmd", shlex.split, "sudo"), "pbuilderrc",
-    "deb_email", "deb_fullname", "pkg_revision_template",
+    "deb_email", "deb_fullname", ("deb_build_options", str, ""),
+    "pkg_revision_template",
     ("handle_dependencies", convert_bool),
     ("signing_key_id", str, ""),
     ]
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)