changeset 293:faeeac2c4c71

Replace debrevision_prefix with pkg_revision_template. Their meaning is similar, but the template is not just a prefix, it's a template for Python's %-based string formatting. This allows more complex configuration to be done with command line settings so that it's easy to do a one-off build with a package revision like "kk5.2".
author Bernhard Herzog <bh@intevation.de>
date Tue, 06 Oct 2009 13:13:04 +0000
parents 0542181b8452
children aed96809160c
files recipes/kde_enterprise_3_5/base.py test/test_listpackages.py test/test_notifications.py test/test_packager.py test/test_readconfig.py treepkg/packager.py treepkg/readconfig.py
diffstat 7 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/recipes/kde_enterprise_3_5/base.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/recipes/kde_enterprise_3_5/base.py	Tue Oct 06 13:13:04 2009 +0000
@@ -78,7 +78,8 @@
                 self.tag_url = tag_url
                 self.tag_revision = tag_revision
                 tag_date, tag_change_count = self.tag_pkg_parameters(tag_url)
-                pkg_revision = self.debrevision_prefix + str(tag_change_count)
+                pkg_revision = (self.pkg_revision_template
+                                % dict(pkg_revision=tag_change_count))
                 return self.revision_packager_cls(self, tag=tag_url,
                                                   pkg_revision=pkg_revision,
                                                   pkg_date=tag_date,
--- a/test/test_listpackages.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/test/test_listpackages.py	Tue Oct 06 13:13:04 2009 +0000
@@ -67,7 +67,7 @@
 pbuilderrc:
 deb_email: packager@example.com
 deb_fullname: Sample Packager
-debrevision_prefix: treepkg
+pkg_revision_template: treepkg%%%%(pkg_revision)d
 handle_dependencies: False
 
 [treepkg]
--- a/test/test_notifications.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/test/test_notifications.py	Tue Oct 06 13:13:04 2009 +0000
@@ -24,7 +24,7 @@
 pbuilderrc:
 deb_email: packager@example.com
 deb_fullname: Sample Packager
-debrevision_prefix: treepkg
+pkg_revision_template: treepkg%%%%(pkg_revision)d
 handle_dependencies: False
 
 [treepkg]
--- a/test/test_packager.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/test/test_packager.py	Tue Oct 06 13:13:04 2009 +0000
@@ -149,11 +149,11 @@
          [("README", "and miles to go before I sleep")]),
         ]
 
-    def test_default_debrevision_prefix(self):
+    def test_default_pkg_revision_template(self):
         self.runtest("treepkg1")
 
-    def test_custom_debrevision_prefix(self):
-        self.runtest("kk1", debrevision_prefix="kk")
+    def test_custom_pkg_revision_template(self):
+        self.runtest("kk1.2", pkg_revision_template="kk%(pkg_revision)d.2")
 
 
 class TestPackagerWithMultipleRevisions(PackagerTest):
--- a/test/test_readconfig.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/test/test_readconfig.py	Tue Oct 06 13:13:04 2009 +0000
@@ -28,7 +28,7 @@
 pbuilderrc: %(pbuilder_dir)s/pbuilderrc
 deb_email: treepkg@example.com
 deb_fullname: TreePKG
-debrevision_prefix: treepkg
+pkg_revision_template: treepkg%%(pkg_revision)d
 handle_dependencies: False
 
 [treepkg]
@@ -83,7 +83,7 @@
                  base_dir="/home/builder/mill/tracks/extraargs",
                  deb_email="treepkg@example.com",
                  deb_fullname="TreePKG",
-                 debrevision_prefix="treepkg",
+                 pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=False,
                  packager_class="readconfig_test.extraargs",
                  pbuilderrc="/home/builder/mill/pbuilder/pbuilderrc",
@@ -98,7 +98,7 @@
                  deb_email="treepkg@example.com",
                  deb_fullname="TreePKG",
                  rules_svn_url="",
-                 debrevision_prefix="treepkg",
+                 pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=True,
                  packager_class="readconfig_test.simple",
                  pbuilderrc="/home/builder/mill/pbuilder/pbuilderrc",
--- a/treepkg/packager.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/treepkg/packager.py	Tue Oct 06 13:13:04 2009 +0000
@@ -253,7 +253,8 @@
         self.rules_revision = rules_revision
 
         if pkg_revision is None:
-            pkg_revision = self.track.debrevision_prefix + "1"
+            pkg_revision = (self.track.pkg_revision_template
+                            % dict(pkg_revision=1))
         self.pkg_revision = pkg_revision
 
         self.base_dir = self.track.pkg_dir_for_revision(self.revision,
@@ -345,15 +346,16 @@
 
     def __init__(self, name, base_dir, svn_url, root_cmd, pbuilderrc, deb_email,
                  deb_fullname, packager_class="treepkg.packager",
-                 debrevision_prefix="treepkg", handle_dependencies=False,
-                 signing_key_id="", do_build=True, rules_svn_url=None):
+                 pkg_revision_template="treepkg%(pkg_revision)d",
+                 handle_dependencies=False, signing_key_id="", do_build=True,
+                 rules_svn_url=None):
         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.debrevision_prefix = debrevision_prefix
+        self.pkg_revision_template = pkg_revision_template
         self.signing_key_id = signing_key_id
         self.do_build = do_build
         self.handle_dependencies = handle_dependencies
--- a/treepkg/readconfig.py	Tue Oct 06 12:55:11 2009 +0000
+++ b/treepkg/readconfig.py	Tue Oct 06 13:13:04 2009 +0000
@@ -26,7 +26,7 @@
 packager_desc = [
     "name", "base_dir", "svn_url", ("rules_svn_url", str, ""), "packager_class",
     ("root_cmd", shlex.split, "sudo"), "pbuilderrc",
-    "deb_email", "deb_fullname", "debrevision_prefix",
+    "deb_email", "deb_fullname", "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)