[Treepkg-commits] r323 - in trunk: test treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon May 31 12:20:27 CEST 2010
Author: bricks
Date: 2010-05-31 12:20:25 +0200 (Mon, 31 May 2010)
New Revision: 323
Modified:
trunk/test/test_packager.py
trunk/treepkg/packager.py
Log:
treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py 2010-05-31 09:54:31 UTC (rev 322)
+++ trunk/test/test_packager.py 2010-05-31 10:20:25 UTC (rev 323)
@@ -263,6 +263,114 @@
[("702432", "2"), ("704195", "0")])
+class TestSourcePackager(unittest.TestCase, FileTestMixin):
+
+ def test_debian_source_format_3_0_1(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("source",
+ [("format", ("3.0 (quilt)"))]
+ )]
+ ),
+ ("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
+ format = srcpkg.get_debian_source_format(pkgbasedir)
+ self.assertEqual("3.0 (quilt)", format)
+
+ def test_debian_source_format_3_0_2(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("source",
+ [("format", ("3.0 (quilt)\nabc"))]
+ )]
+ ),
+ ("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
+ format = srcpkg.get_debian_source_format(pkgbasedir)
+ self.assertEqual("3.0 (quilt)", format)
+
+ def test_debian_source_format_1_0_1(self):
+ trackdir = self.create_files("track",
+ [("debian",
+ [("source","")]
+ ),
+ ("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
+ format = srcpkg.get_debian_source_format(pkgbasedir)
+ self.assertEqual("1.0", format)
+
+ def test_debian_source_format_1_0_2(self):
+ trackdir = self.create_files("track",
+ [("debian", ""),
+ ("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
+ format = srcpkg.get_debian_source_format(pkgbasedir)
+ self.assertEqual("1.0", format)
+
class TestRevisionPackager(unittest.TestCase, FileTestMixin):
def test_list_source_files(self):
Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py 2010-05-31 09:54:31 UTC (rev 322)
+++ trunk/treepkg/packager.py 2010-05-31 10:20:25 UTC (rev 323)
@@ -153,13 +153,34 @@
dpkg_source_log = os.path.join(self.log_dir, "dpkg_source.txt")
logging.info("Creating new source package; logging to %s",
dpkg_source_log)
- run.call(cmdexpand("dpkg-source -b $directory $tarball",
+
+ format = self.get_debian_source_format(pkgbasedir)
+ if format == "1.0":
+ run.call(cmdexpand("dpkg-source -b $directory $tarball",
directory=os.path.basename(pkgbasedir),
tarball=os.path.basename(origtargz)),
cwd=os.path.dirname(pkgbasedir),
logfile=dpkg_source_log,
env=self.track.debian_environment())
+ elif format == "3.0 (quilt)":
+ run.call(cmdexpand("dpkg-source -b $directory",
+ directory=os.path.basename(pkgbasedir)),
+ cwd=os.path.dirname(pkgbasedir),
+ logfile=dpkg_source_log,
+ env=self.track.debian_environment())
+ else:
+ raise RuntimeError("debian source format %s is not supported by treepkg" % format)
+ def get_debian_source_format(self, pkgbasedir):
+ formatfile = os.path.join(pkgbasedir, "debian", "source", "format")
+ if not os.path.exists(formatfile):
+ return "1.0"
+ else:
+ file = open(formatfile, "r")
+ line = file.readline()
+ file.close()
+ return line.strip()
+
def move_source_package(self, pkgbasename):
"""Moves the new source package from the work_dir to the src_dir"""
logging.info("Moving source package to %r", self.src_dir)
More information about the Treepkg-commits
mailing list