changeset 93:73c67372c7f7

Make the prefix used in the debian revision number configurable. This involves a new config file setting documented in demo.cfg, the necessary changes to the packagers and updated and new test cases
author Bernhard Herzog <bh@intevation.de>
date Wed, 07 Nov 2007 10:13:24 +0000
parents 1c74e3b56a63
children 0c13a84a67dd
files demo.cfg test/test_packager.py treepkg/packager.py treepkg/readconfig.py
diffstat 4 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/demo.cfg	Tue Nov 06 17:30:11 2007 +0000
+++ b/demo.cfg	Wed Nov 07 10:13:24 2007 +0000
@@ -37,6 +37,11 @@
 deb_email: packager@example.com
 deb_fullname: Sample Packager
 
+# A prefix used in the package revision number of the generated debian
+# package.  E. g. with a prefix "treepkg", the default, a generated
+# package might be named foo_1.0-Q1_all.deb
+debrevision_prefix: treepkg
+
 
 [treepkg]
 # Section for general tree packager configuration
--- a/test/test_packager.py	Tue Nov 06 17:30:11 2007 +0000
+++ b/test/test_packager.py	Wed Nov 07 10:13:24 2007 +0000
@@ -105,7 +105,7 @@
         self.trackdir = self.create_temp_dir(self.id() + "-track")
         self.create_files(self.trackdir, self.debian_files)
 
-    def test(self):
+    def runtest(self, debrevision, **extra_track_args):
         baseurl = create_svn_repository(self.svndir)
         svn_url = baseurl + "/trunk"
         subversion.checkout(svn_url, self.svnworkdir)
@@ -117,19 +117,26 @@
                              svn_url=svn_url, pbuilderrc="",
                              root_cmd=[sys.executable, rootcmd],
                              deb_email="treepkg@example.com",
-                             deb_fullname="treepkg tester")
+                             deb_fullname="treepkg tester",
+                             **extra_track_args)
         group = PackagerGroup([track], 1)
         group.check_package_tracks()
 
         # Now check the source and binary package files
         pkgdir = os.path.join(self.trackdir, "pkg", "2-1")
         self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))),
-                          ["testpkg_2-kk1.diff.gz",
-                           "testpkg_2-kk1.dsc",
+                          ["testpkg_2-%s.diff.gz" % debrevision,
+                           "testpkg_2-%s.dsc" % debrevision,
                            "testpkg_2.orig.tar.gz"])
         self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))),
-                          ["testpkg_2-kk1_all.deb",
-                           "testpkg_2-kk1_i386.changes"])
+                          ["testpkg_2-%s_all.deb" % debrevision,
+                           "testpkg_2-%s_i386.changes" % debrevision])
+
+    def test_default_debrevision_prefix(self):
+        self.runtest("treepkg1")
+
+    def test_custom_debrevision_prefix(self):
+        self.runtest("kk1", debrevision_prefix="kk")
 
 class StoppingPackager(treepkg.packager.RevisionPackager):
 
--- a/treepkg/packager.py	Tue Nov 06 17:30:11 2007 +0000
+++ b/treepkg/packager.py	Wed Nov 07 10:13:24 2007 +0000
@@ -121,8 +121,9 @@
             oldversionprefix = oldversion.split(":")[0] + ":"
         else:
             oldversionprefix = ""
+        debrev = self.track.debrevision_prefix + "1"
         run.call(cmdexpand("debchange -c  $changelog"
-                           " -v ${oldversionprefix}${pkgbaseversion}-kk1"
+                           " -v ${oldversionprefix}${pkgbaseversion}-${debrev}"
                            " $changemsg", **locals()),
                  env=self.track.debian_environment())
 
@@ -279,7 +280,8 @@
     extra_config_desc = []
 
     def __init__(self, name, base_dir, svn_url, root_cmd, pbuilderrc, deb_email,
-                 deb_fullname, packager_class="treepkg.packager"):
+                 deb_fullname, packager_class="treepkg.packager",
+                 debrevision_prefix="treepkg"):
         self.name = name
         self.base_dir = base_dir
         self.svn_url = svn_url
@@ -287,6 +289,7 @@
         self.pbuilderrc = pbuilderrc
         self.deb_email = deb_email
         self.deb_fullname = deb_fullname
+        self.debrevision_prefix = debrevision_prefix
         self.pkg_dir_template = "%(revision)d-%(increment)d"
         self.pkg_dir_regex \
                    = re.compile(r"(?P<revision>[0-9]+)-(?P<increment>[0-9]+)$")
--- a/treepkg/readconfig.py	Tue Nov 06 17:30:11 2007 +0000
+++ b/treepkg/readconfig.py	Wed Nov 07 10:13:24 2007 +0000
@@ -18,7 +18,7 @@
 packager_desc = [
     "name", "base_dir", "svn_url", "packager_class",
     ("root_cmd", shlex.split), "pbuilderrc",
-    "deb_email", "deb_fullname",
+    "deb_email", "deb_fullname", "debrevision_prefix",
     ]
 
 treepkg_desc = [
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)