[Treepkg-commits] r225 - in trunk: test treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 20 22:06:10 CET 2009


Author: bh
Date: 2009-11-20 22:06:10 +0100 (Fri, 20 Nov 2009)
New Revision: 225

Modified:
   trunk/test/test_packager.py
   trunk/test/test_readconfig.py
   trunk/treepkg/packager.py
   trunk/treepkg/readconfig.py
Log:
Turn the SourcePackager class attribute pkg_basename into a per-track
configuratin option.  The default value is the track name, as in most
cases they're identical anyway.  For now, the change is compatible with
old SourcePackager subclasses that override pkg_basename.


Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py	2009-11-20 20:22:34 UTC (rev 224)
+++ trunk/test/test_packager.py	2009-11-20 21:06:10 UTC (rev 225)
@@ -42,8 +42,6 @@
 
 class SourcePackager(treepkg.packager.SourcePackager):
 
-    pkg_basename = "testpkg"
-
     def do_package(self):
         pkgbaseversion, pkgbasedir = self.export_sources()
 

Modified: trunk/test/test_readconfig.py
===================================================================
--- trunk/test/test_readconfig.py	2009-11-20 20:22:34 UTC (rev 224)
+++ trunk/test/test_readconfig.py	2009-11-20 21:06:10 UTC (rev 225)
@@ -36,6 +36,7 @@
 check_interval: 3600
 
 [pkg_simple]
+pkg_basename: simple1
 svn_url: svn://example.com/%(name)s/trunk
 base_dir: %(tracks_dir)s/%(name)s
 packager_class: readconfig_test.%(name)s
@@ -89,6 +90,10 @@
                  handle_dependencies=False,
                  packager_class="readconfig_test.extraargs",
                  pbuilderrc="/home/builder/mill/pbuilder/pbuilderrc",
+                 # pkg_basename is passed as an empty string by default.
+                 # The PackageTrack an empty pkg_basename it with the
+                 # value of name
+                 pkg_basename="",
                  root_cmd=['sudo'],
                  signing_key_id="",
                  svn_url="svn://example.com/extraargs/trunk",
@@ -105,6 +110,7 @@
                  handle_dependencies=True,
                  packager_class="readconfig_test.simple",
                  pbuilderrc="/home/builder/mill/pbuilder/pbuilderrc",
+                 pkg_basename="simple1",
                  root_cmd=['sudo'],
                  signing_key_id="abcd1234",
                  svn_url="svn://example.com/simple/trunk")])

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2009-11-20 20:22:34 UTC (rev 224)
+++ trunk/treepkg/packager.py	2009-11-20 21:06:10 UTC (rev 225)
@@ -32,13 +32,10 @@
 
 class SourcePackager(object):
 
-    # Derived classes must supply the package basename
-    pkg_basename = None
-
     # Derived classes may want to override this message
     changemsg_template = "Update to revision %(revision)d"
 
-
+    pkg_basename = property(lambda self: self.track.pkg_basename)
     track = _fromparent("track")
     revision = _fromparent("revision")
     pkg_revision = _fromparent("pkg_revision")
@@ -49,7 +46,6 @@
 
     def __init__(self, parent):
         self.parent = parent
-        assert(self.pkg_basename)
 
     def determine_package_version(self, directory):
         """Returns the version number of the new package as a string
@@ -349,8 +345,11 @@
                  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, deb_build_options=""):
+                 rules_svn_url=None, deb_build_options="", pkg_basename=""):
         self.name = name
+        if not pkg_basename:
+            pkg_basename = name
+        self.pkg_basename = pkg_basename
         self.base_dir = base_dir
         self.builder = PBuilder(pbuilderrc, root_cmd,
                                 release_signing_keyid=signing_key_id)

Modified: trunk/treepkg/readconfig.py
===================================================================
--- trunk/treepkg/readconfig.py	2009-11-20 20:22:34 UTC (rev 224)
+++ trunk/treepkg/readconfig.py	2009-11-20 21:06:10 UTC (rev 225)
@@ -27,7 +27,7 @@
     "name", "base_dir", "svn_url", ("rules_svn_url", str, ""), "packager_class",
     ("root_cmd", shlex.split, "sudo"), "pbuilderrc",
     "deb_email", "deb_fullname", ("deb_build_options", str, ""),
-    "pkg_revision_template",
+    "pkg_revision_template", ("pkg_basename", str, ""),
     ("handle_dependencies", convert_bool),
     ("signing_key_id", str, ""),
     ]



More information about the Treepkg-commits mailing list