changeset 305:3781e9958eba

Add per-track configuration option version_template used by the SourcePackager to construct the version number. Also add some tests.
author Bernhard Herzog <bh@intevation.de>
date Tue, 01 Dec 2009 11:26:47 +0000
parents 6cffb43a28ca
children 163f0d8b64eb
files test/test_readconfig.py treepkg/packager.py treepkg/readconfig.py
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_readconfig.py	Thu Nov 26 20:20:57 2009 +0000
+++ b/test/test_readconfig.py	Tue Dec 01 11:26:47 2009 +0000
@@ -43,6 +43,7 @@
 handle_dependencies: True
 signing_key_id: abcd1234
 changelog_msg_template: Update to feature branch r%%(revision)d
+version_template: 1.0.svn%%(revision)s
 
 [pkg_extraargs]
 svn_url: svn://example.com/%(name)s/trunk
@@ -103,6 +104,7 @@
                  svn_subset=[(".", False), ("subdir", True)],
                  svn_url="svn://example.com/extraargs/trunk",
                  rules_svn_url="file:///tmp/my-debian-repository",
+                 version_template="%(revision)s",
                  orig_tarball=("/home/builder/mill/"
                                "tracks/extraargs/mytarball.tgz")),
             dict(name="simple",
@@ -121,4 +123,5 @@
                  root_cmd=['sudo'],
                  signing_key_id="abcd1234",
                  svn_subset=[],
-                 svn_url="svn://example.com/simple/trunk")])
+                 svn_url="svn://example.com/simple/trunk",
+                 version_template="1.0.svn%(revision)s")])
--- a/treepkg/packager.py	Thu Nov 26 20:20:57 2009 +0000
+++ b/treepkg/packager.py	Tue Dec 01 11:26:47 2009 +0000
@@ -56,7 +56,7 @@
         The default implementation simply returns the revision converted
         to a string.
         """
-        return str(self.revision)
+        return self.track.version_template % dict(revision=self.revision)
 
     def export_sources(self):
         """Export the sources from the subversion working directory
@@ -342,6 +342,7 @@
 
     def __init__(self, name, base_dir, svn_url, root_cmd, pbuilderrc, deb_email,
                  deb_fullname, packager_class="treepkg.packager",
+                 version_template="%(revision)s",
                  pkg_revision_template="treepkg%(pkg_revision)d",
                  handle_dependencies=False, signing_key_id="", do_build=True,
                  rules_svn_url=None, deb_build_options="", pkg_basename="",
@@ -358,6 +359,7 @@
         self.deb_email = deb_email
         self.deb_fullname = deb_fullname
         self.deb_build_options = deb_build_options
+        self.version_template = version_template
         self.pkg_revision_template = pkg_revision_template
         self.signing_key_id = signing_key_id
         self.do_build = do_build
--- a/treepkg/readconfig.py	Thu Nov 26 20:20:57 2009 +0000
+++ b/treepkg/readconfig.py	Tue Dec 01 11:26:47 2009 +0000
@@ -69,6 +69,7 @@
     ("rules_svn_url", str, ""), "packager_class",
     ("root_cmd", shlex.split, "sudo"), "pbuilderrc",
     "deb_email", "deb_fullname", ("deb_build_options", str, ""),
+    ("version_template", str, "%(revision)s"),
     "pkg_revision_template", ("pkg_basename", str, ""),
     ("handle_dependencies", convert_bool),
     ("signing_key_id", str, ""),
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)