[Treepkg-commits] r334 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Jun 21 15:05:26 CEST 2010


Author: aheinecke
Date: 2010-06-21 15:05:26 +0200 (Mon, 21 Jun 2010)
New Revision: 334

Modified:
   trunk/treepkg/packager.py
   trunk/treepkg/readconfig.py
Log:
Added an option to configure the used builder class from the treepkg.cfg. This
should reduce the need for platform specific recipes. 


Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2010-06-21 10:58:09 UTC (rev 333)
+++ trunk/treepkg/packager.py	2010-06-21 13:05:26 UTC (rev 334)
@@ -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

Modified: trunk/treepkg/readconfig.py
===================================================================
--- trunk/treepkg/readconfig.py	2010-06-21 10:58:09 UTC (rev 333)
+++ trunk/treepkg/readconfig.py	2010-06-21 13:05:26 UTC (rev 334)
@@ -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 = [



More information about the Treepkg-commits mailing list