changeset 378:41226e427823

Added an option to configure the used builder class from the treepkg.cfg. This should reduce the need for platform specific recipes.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 21 Jun 2010 13:05:26 +0000
parents 1af2aff54563
children 610b7e57f966
files treepkg/packager.py treepkg/readconfig.py
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/packager.py	Mon Jun 21 10:58:09 2010 +0000
+++ b/treepkg/packager.py	Mon Jun 21 13:05:26 2010 +0000
@@ -23,6 +23,7 @@
 import debian
 from cmdexpand import cmdexpand
 from builder import PBuilder
+from sbuilder import SbdmockBuilder
 
 def _fromparent(attr):
     """Creates a property that delegates its value to self.parent.<attr>"""
@@ -391,27 +392,38 @@
 
     revision_packager_cls = RevisionPackager
 
-    builder_cls = PBuilder
-
     svn_external_subdirs = []
 
     extra_config_desc = []
 
     def __init__(self, name, base_dir, root_cmd, builderconfig, deb_email,
                  deb_fullname, svn_url="", packager_class="treepkg.packager",
-                 version_template="%(revision)s",
+                 version_template="%(revision)s", builder_cls="PBuilder",
                  pkg_revision_template="treepkg%(pkg_revision)s",
                  handle_dependencies=False, signing_key_id="", do_build=True,
                  rules_svn_url=None, deb_build_options="", pkg_basename="",
                  changelog_msg_template="Update to r%(revision)s",
                  svn_subset=(), svn_externals=(), git_branch="", git_url=""):
         self.name = name
+
+        # Convert the builder_cls option to a class
+        if builder_cls.upper() == "SBDMOCKBUILDER" or \
+            builder_cls.upper() == "SBDMOCK":
+                builder_class = SbdmockBuilder
+        elif builder_cls.upper() == "PBUILDER":
+            builder_class = PBuilder
+        else:
+            # If the builder option is explicitly set with an unknown builder
+            # a warning is printed.
+            logging.warning("Track: %s Builder option %s could not be parsed \
+                             defaulting to pbuilder" % (name, builder_cls))
+            builder_class = PBuilder
         if not pkg_basename:
             pkg_basename = name
         self.pkg_basename = pkg_basename
         self.changelog_msg_template = changelog_msg_template
         self.base_dir = base_dir
-        self.builder = self.builder_cls(builderconfig, root_cmd,
+        self.builder = builder_class(builderconfig, root_cmd,
                                 release_signing_keyid=signing_key_id)
         self.deb_email = deb_email
         self.deb_fullname = deb_fullname
--- a/treepkg/readconfig.py	Mon Jun 21 10:58:09 2010 +0000
+++ b/treepkg/readconfig.py	Mon Jun 21 13:05:26 2010 +0000
@@ -77,7 +77,8 @@
     ("signing_key_id", str, ""),
     ("changelog_msg_template", str, "Update to revision %(revision)s"),
     ("git_branch", str,""),
-    ("git_url", str,"")
+    ("git_url", str,""),
+    ("builder_cls",str,"PBuilder")
     ]
 
 treepkg_desc = [
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)