[Treepkg-commits] r455 - in trunk: test treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Oct 14 09:49:50 CEST 2010
Author: bricks
Date: 2010-10-14 09:49:50 +0200 (Thu, 14 Oct 2010)
New Revision: 455
Modified:
trunk/test/test_packager.py
trunk/test/test_util.py
trunk/treepkg/packager.py
trunk/treepkg/util.py
Log:
add tests for determine debian upstream version
fix calling determine_upstream_version in determine_package_version
update authors
Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py 2010-10-13 16:26:53 UTC (rev 454)
+++ trunk/test/test_packager.py 2010-10-14 07:49:50 UTC (rev 455)
@@ -1,6 +1,7 @@
-# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
+# Copyright (C) 2007-2010 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
+# Bjoern Ricks <bjoern.ricks at intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with the software for details.
@@ -371,6 +372,104 @@
format = srcpkg.get_debian_source_format(pkgbasedir)
self.assertEqual("1.0", format)
+class TestDetermineUpstreamVersion(unittest.TestCase, FileTestMixin):
+
+ def test_debian_upstream_version(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("changelog", """\
+testpkg (1.0.1~-1abc.173) unstable; urgency=low
+
+ * Initial version
+
+ -- TreePKG <treepkg at example.com> Thu, 8 Mar 2007 18:34:39 +0100
+"""
+ )]),
+ ("pkg",
+ [("704195-0",
+ [("status",
+ ("TreePackagerStatus 0.0\n"
+ "status: binary_package_created\n"
+ "start: 2007-09-10 17:16:48\n"
+ "stop: 2007-09-11 00:07:36\n")),
+ ("src", []),
+ ("binary", [])
+ ]
+ )]
+ )]
+ )
+ track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+ revpkg = RevisionPackager(track, 704195, 0)
+ srcpkg = SourcePackager(revpkg)
+
+ pkgbasedir = trackdir
+ version = srcpkg.determine_upstream_version()
+ self.assertEqual("1.0.1~", version)
+
+ def test_debian_native_upstream_version(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("changelog", """\
+testpkg (1.0.1) unstable; urgency=low
+
+ * Initial version
+
+ -- TreePKG <treepkg at example.com> Thu, 8 Mar 2007 18:34:39 +0100
+"""
+ )]),
+ ("pkg",
+ [("704195-0",
+ [("status",
+ ("TreePackagerStatus 0.0\n"
+ "status: binary_package_created\n"
+ "start: 2007-09-10 17:16:48\n"
+ "stop: 2007-09-11 00:07:36\n")),
+ ("src", []),
+ ("binary", [])
+ ]
+ )]
+ )]
+ )
+ track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+ revpkg = RevisionPackager(track, 704195, 0)
+ srcpkg = SourcePackager(revpkg)
+
+ pkgbasedir = trackdir
+ version = srcpkg.determine_upstream_version()
+ self.assertEqual("1.0.1", version)
+
+ def test_debian_epoch_upstream_version(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("changelog", """\
+testpkg (4:1.0.1-1abc3) unstable; urgency=low
+
+ * Initial version
+
+ -- TreePKG <treepkg at example.com> Thu, 8 Mar 2007 18:34:39 +0100
+"""
+ )]),
+ ("pkg",
+ [("704195-0",
+ [("status",
+ ("TreePackagerStatus 0.0\n"
+ "status: binary_package_created\n"
+ "start: 2007-09-10 17:16:48\n"
+ "stop: 2007-09-11 00:07:36\n")),
+ ("src", []),
+ ("binary", [])
+ ]
+ )]
+ )]
+ )
+ track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+ revpkg = RevisionPackager(track, 704195, 0)
+ srcpkg = SourcePackager(revpkg)
+
+ pkgbasedir = trackdir
+ version = srcpkg.determine_upstream_version()
+ self.assertEqual("1.0.1", version)
+
class TestRevisionPackager(unittest.TestCase, FileTestMixin):
def test_list_source_files(self):
Modified: trunk/test/test_util.py
===================================================================
--- trunk/test/test_util.py 2010-10-13 16:26:53 UTC (rev 454)
+++ trunk/test/test_util.py 2010-10-14 07:49:50 UTC (rev 455)
@@ -1,6 +1,7 @@
# Copyright (C) 2007, 2008 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
+# Bjoern Ricks <bjoern.ricks at intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with the software for details.
Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py 2010-10-13 16:26:53 UTC (rev 454)
+++ trunk/treepkg/packager.py 2010-10-14 07:49:50 UTC (rev 455)
@@ -1,6 +1,8 @@
-# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
+# Copyright (C) 2007-2010 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
+# Bjoern Ricks <bjoern.ricks at intevation.de>
+# Andre Heinecke <andre.heinecke at intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with the software for details.
@@ -50,11 +52,14 @@
def __init__(self, parent):
self.parent = parent
- def determine_upstream_version(self, directory)
+ def determine_upstream_version(self, directory=None):
"""
Tries to parse the upstream version from a source directory
and returns it as a string.
"""
+
+ if not directory:
+ directory = self.track.checkout_dir
# TODO: it should be possible to select which files should be searched
# for upstream_version
@@ -104,7 +109,7 @@
rules_revision = self.parent.rules_revision
pkg_revision = self.parent.pkg_revision
pkg_date = time.strftime("%Y%m%d", time.localtime())
- upstream_version = determine_upstream_version(directory)
+ upstream_version = self.determine_upstream_version(directory)
version_dict = locals().copy()
if type(additionals).__name__=='dict':
version_dict.update(additionals)
Modified: trunk/treepkg/util.py
===================================================================
--- trunk/treepkg/util.py 2010-10-13 16:26:53 UTC (rev 454)
+++ trunk/treepkg/util.py 2010-10-14 07:49:50 UTC (rev 455)
@@ -1,6 +1,8 @@
-# Copyright (C) 2007, 2008 by Intevation GmbH
+# Copyright (C) 2007, 2008, 2010 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
+# Bjoern Ricks <bjoern.ricks at intevation.de>
+# Andre Heinecke <andre.heinecke at intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with the software for details.
More information about the Treepkg-commits
mailing list