annotate test/test_packager.py @ 547:70fa7debabed

checkout git branch on update this may be necessary if a treepkg config has changed and a branch is used instead of master
author Bjoern Ricks <bricks@intevation.de>
date Wed, 02 Feb 2011 10:26:02 +0000
parents 94ff51f691a2
children
rev   line source
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
1 # Copyright (C) 2007-2010 by Intevation GmbH
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
4 # Bjoern Ricks <bjoern.ricks@intevation.de>
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 #
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9 """Tests for treepkg.packager"""
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import sys
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import os
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13 import unittest
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15 from treepkg.run import call
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16 from treepkg.cmdexpand import cmdexpand
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17 from treepkg.util import writefile
128
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
18 from treepkg.packager import PackagerGroup, import_packager_module, \
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
19 CyclicDependencyError
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20 import treepkg.subversion as subversion
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 import treepkg
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 from filesupport import FileTestMixin
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 def create_svn_repository(directory):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27 baseurl = "file://" + directory
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 call(cmdexpand("svnadmin create --fs-type fsfs $directory",
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 **locals()))
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 call(cmdexpand("svn mkdir -q -m 'create directory structure'"
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 " $baseurl/trunk",
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32 **locals()))
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 return baseurl
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35 def add_svn_files(workingcopy, filedesc, commitmsg):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
36 for name, contents in filedesc:
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
37 writefile(os.path.join(workingcopy, name), contents)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
38 call(cmdexpand("svn add -q $name", **locals()),
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
39 cwd=workingcopy)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
40 call(cmdexpand("svn commit -q -m $commitmsg", **locals()),
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41 cwd=workingcopy)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
44 class SourcePackager(treepkg.packager.SourcePackager):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
45
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
46 def do_package(self):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
47 pkgbaseversion, pkgbasedir = self.export_sources()
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
48
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
49 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
50 origtargz = os.path.join(self.work_dir,
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
51 pkgbasename + ".orig.tar.gz")
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
52 self.create_tarball(origtargz, self.work_dir,
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
53 os.path.basename(pkgbasedir))
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
54
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
55 changemsg = ("Update to SVN rev. %s" % (self.revision,))
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
56 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
57 changemsg)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
58
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
59 self.create_source_package(pkgbasedir, origtargz)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
60 self.move_source_package(pkgbasename)
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
61
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
62
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63 class RevisionPackager(treepkg.packager.RevisionPackager):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 source_packager_cls = SourcePackager
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
67
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
68 class PackageTrack(treepkg.packager.PackageTrack):
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
69
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
70 revision_packager_cls = RevisionPackager
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
71
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
72
94
0c13a84a67dd refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
73 class PackagerTest(unittest.TestCase, FileTestMixin):
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
74
94
0c13a84a67dd refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
75 revisions = []
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
76
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
77 debian_files = [
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
78 ("debian",
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
79 [("control", """\
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
80 Source: testpkg
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
81 Priority: optional
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
82 Maintainer: TreePKG <treepkg@example.com>
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
83 Standards-Version: 3.7.2
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
85 Package: testpkg
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
86 Architecture: all
116
093514306186 Cosemetic fix in test data
Bernhard Herzog <bh@intevation.de>
parents: 113
diff changeset
87 Description: Test package for treepkg tests
093514306186 Cosemetic fix in test data
Bernhard Herzog <bh@intevation.de>
parents: 113
diff changeset
88 German (de) internationalized (i18n) files for KDE
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
89 This package contains the German internationalized (i18n) files for
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
90 all KDE core applications.
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
91 """),
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
92 ("changelog", """\
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
93 testpkg (0-0) unstable; urgency=low
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
94
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
95 * Initial version
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
96
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
97 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
98 """),
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
99 ("rules", "binary: echo binary")])]
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
100
94
0c13a84a67dd refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
101
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
102 def setUp(self):
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
103 self.svndir = self.create_temp_dir("svn")
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
104 self.svnworkdir = self.create_temp_dir("svnwork")
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
105 self.trackdir = self.create_files("track", self.debian_files)
94
0c13a84a67dd refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
106 self.svn_url = create_svn_repository(self.svndir) + "/trunk"
0c13a84a67dd refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
107 subversion.checkout(self.svn_url, self.svnworkdir)
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
108 for message, files in self.revisions:
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
109 add_svn_files(self.svnworkdir, files, message)
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
110
98
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
111 def runtest(self, debrevision, group_args=None, **extra_track_args):
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
112 rootcmd = os.path.join(os.path.dirname(__file__), os.pardir, "test",
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
113 "mocksudopbuilder.py")
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
114 track = PackageTrack(name="testpkg", base_dir=self.trackdir,
511
e5b66539f893 new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents: 495
diff changeset
115 url=self.svn_url, builderconfig="",
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
116 root_cmd=[sys.executable, rootcmd],
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
117 deb_email="treepkg@example.com",
93
73c67372c7f7 Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents: 91
diff changeset
118 deb_fullname="treepkg tester",
73c67372c7f7 Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents: 91
diff changeset
119 **extra_track_args)
98
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
120
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
121 if group_args is None:
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
122 group_args = {}
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
123 group = PackagerGroup([track], 1, **group_args)
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
124 group.check_package_tracks()
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
125
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
126 # determine version that has been packaged. This assumes that
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
127 # check_package_tracks will leave the checkout in the revision
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
128 # that was actually packaged.
98
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
129 version = track.last_changed_revision()
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
130
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
131 # Now check the source and binary package files
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
132 pkgdir = os.path.join(self.trackdir, "pkg", "%s-0" % version)
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
133 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))),
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
134 [name % locals() for name in
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
135 ["testpkg_%(version)s-%(debrevision)s.diff.gz",
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
136 "testpkg_%(version)s-%(debrevision)s.dsc",
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
137 "testpkg_%(version)s.orig.tar.gz"]])
84
98a7d70746a9 Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
138 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))),
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
139 [name % locals() for name in
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
140 ["testpkg_%(version)s-%(debrevision)s_all.deb",
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
141 "testpkg_%(version)s-%(debrevision)s_i386.changes"]])
95
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
142
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
143
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
144 class TestPackager(PackagerTest):
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
145
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
146 revisions = [
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
147 ("Initial Revision",
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
148 [("README", "and miles to go before I sleep")]),
8f1c72135ea6 Make PackagerTest more flexible to make it easier to add tests
Bernhard Herzog <bh@intevation.de>
parents: 94
diff changeset
149 ]
93
73c67372c7f7 Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents: 91
diff changeset
150
293
faeeac2c4c71 Replace debrevision_prefix with pkg_revision_template. Their meaning is
Bernhard Herzog <bh@intevation.de>
parents: 232
diff changeset
151 def test_default_pkg_revision_template(self):
93
73c67372c7f7 Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents: 91
diff changeset
152 self.runtest("treepkg1")
73c67372c7f7 Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents: 91
diff changeset
153
293
faeeac2c4c71 Replace debrevision_prefix with pkg_revision_template. Their meaning is
Bernhard Herzog <bh@intevation.de>
parents: 232
diff changeset
154 def test_custom_pkg_revision_template(self):
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
155 self.runtest("kk1.2", pkg_revision_template="kk%(pkg_revision)s.2")
85
31b0567df051 Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents: 84
diff changeset
156
98
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
157
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
158 class TestPackagerWithMultipleRevisions(PackagerTest):
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
159
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
160 revisions = [
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
161 ("Initial Revision",
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
162 [("README", "and miles to go before I sleep")]),
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
163 ("Add some code",
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
164 [("program.c", "int main(void) { return 0; }")]),
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
165 ("Add some more code",
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
166 [("another.c", "int main(void) { return 1; }")]),
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
167 ]
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
168
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
169 def test_packaging_specific_revision(self):
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
170 # Package the newest revision and then package an older one.
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
171 self.runtest("treepkg1")
334
4c047e979ff4 Updated tests to reflect that Subversion revisions are now handled
Andre Heinecke <aheinecke@intevation.de>
parents: 330
diff changeset
172 self.runtest("treepkg1", group_args=dict(revision='3'))
98
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
173
f7b9c7113c46 Make packaging a specific revision work even if newer revisions have already
Bernhard Herzog <bh@intevation.de>
parents: 97
diff changeset
174
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
175 class StoppingPackager(treepkg.packager.RevisionPackager):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
176
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
177 def package(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
178 pass
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
179
223
230582ed7329 some cosmetic changes:
Bernhard Herzog <bh@intevation.de>
parents: 222
diff changeset
180
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
181 class StoppingTrack(treepkg.packager.PackageTrack):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
182
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
183 def __init__(self, do_package, do_stop, instructions_file, name, trackdir):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
184 super(StoppingTrack, self).__init__(name, trackdir, "", "", "",
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
185 "", "")
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
186 self.do_package = do_package
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
187 self.do_stop = do_stop
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
188 self.instructions_file = instructions_file
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
189
517
de78084fcbce rename do_svn_update in do_update because we provide svn and git support now
Bjoern Ricks <bricks@intevation.de>
parents: 511
diff changeset
190 def package_if_updated(self, revision, do_update=True):
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
191 if self.do_stop:
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
192 writefile(self.instructions_file, "stop")
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
193 if self.do_package:
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
194 return StoppingPackager(self, 1, 0)
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
195 else:
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
196 return None
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
197
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
198
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
199 class TestPackageGroupStop(unittest.TestCase, FileTestMixin):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
200
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
201 def setUp(self):
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
202 self.trackdir = self.create_temp_dir("track")
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
203 self.instructions_file = os.path.join(self.trackdir, "instructions")
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
204
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
205 def group(self, do_package=True, do_stop=True):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
206 return PackagerGroup([StoppingTrack(do_package, do_stop,
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
207 self.instructions_file,
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
208 "test", self.trackdir)],
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
209 1, instructions_file=self.instructions_file)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
210
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
211 def test_stop(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
212 group = self.group(do_package=True, do_stop=True)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
213 self.failUnless(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
214
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
215 def test_no_stop(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
216 group = self.group(do_package=True, do_stop=False)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
217 self.failIf(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
218
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
219 def test_instruction_removal(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
220 # run once with stopping
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
221 group = self.group(do_package=True, do_stop=True)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
222 self.failUnless(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
223
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
224 # run again without stopping but using the same files. The
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
225 # instructions file should be removed automatically
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
226 group = self.group(do_package=True, do_stop=False)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
227 self.failIf(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
228
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
229 def test_stopping_without_packaging(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
230 group = self.group(do_package=False, do_stop=True)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
231 self.failUnless(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
232
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
233 def test_stopping_between_checks(self):
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
234 group = self.group(do_package=False, do_stop=False)
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
235 # run check_package_tracks once
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
236 self.failIf(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
237
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
238 # tell treepkg to stop
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
239 writefile(self.instructions_file, "stop")
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
240
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
241 # check again. The check_package_tracks() may remove the
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
242 # instructions file but it must do so only the first time
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
243 self.failUnless(group.check_package_tracks())
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 88
diff changeset
244
85
31b0567df051 Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents: 84
diff changeset
245
31b0567df051 Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents: 84
diff changeset
246 class TestPackageTrack(unittest.TestCase, FileTestMixin):
31b0567df051 Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents: 84
diff changeset
247
31b0567df051 Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents: 84
diff changeset
248 def test_get_revision_numbers(self):
86
9bd92a3290e0 In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents: 85
diff changeset
249 # Note: The revisions in the pkg dir are not ordered so that we
9bd92a3290e0 In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents: 85
diff changeset
250 # can check whether get_revision_numbers returns a sorted list
9bd92a3290e0 In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents: 85
diff changeset
251 # of revisions
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
252 trackdir = self.create_files("track",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
253 [("pkg",
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
254 [("704195-0",
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
255 [("status", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
256 ("src", []),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
257 ("binary", [])]),
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
258 ("702432-2",
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
259 [("status", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
260 ("src", []),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
261 ("binary", [])])])])
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
262 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
263 self.assertEquals(track.get_revision_numbers(),
330
24db9223488b Test updated to reflect that rules_rev is now also handled as string
Andre Heinecke <aheinecke@intevation.de>
parents: 326
diff changeset
264 [("702432", "2"), ("704195", "0")])
87
08d8ffd40f27 add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents: 86
diff changeset
265
88
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
266
367
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
267 class TestSourcePackager(unittest.TestCase, FileTestMixin):
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
268
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
269 def test_debian_source_format_3_0_1(self):
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
270 trackdir = self.create_files("track",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
271 [("debian",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
272 [("source",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
273 [("format", ("3.0 (quilt)"))]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
274 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
275 ),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
276 ("pkg",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
277 [("704195-0",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
278 [("status",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
279 ("TreePackagerStatus 0.0\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
280 "status: binary_package_created\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
281 "start: 2007-09-10 17:16:48\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
282 "stop: 2007-09-11 00:07:36\n")),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
283 ("src", []),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
284 ("binary", [])
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
285 ]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
286 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
287 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
288 )
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
289 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
290 revpkg = RevisionPackager(track, "704195", 0)
367
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
291 srcpkg = SourcePackager(revpkg)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
292
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
293 pkgbasedir = trackdir
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
294 format = srcpkg.get_debian_source_format(pkgbasedir)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
295 self.assertEqual("3.0 (quilt)", format)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
296
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
297 def test_debian_source_format_3_0_2(self):
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
298 trackdir = self.create_files("track",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
299 [("debian",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
300 [("source",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
301 [("format", ("3.0 (quilt)\nabc"))]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
302 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
303 ),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
304 ("pkg",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
305 [("704195-0",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
306 [("status",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
307 ("TreePackagerStatus 0.0\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
308 "status: binary_package_created\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
309 "start: 2007-09-10 17:16:48\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
310 "stop: 2007-09-11 00:07:36\n")),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
311 ("src", []),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
312 ("binary", [])
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
313 ]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
314 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
315 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
316 )
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
317 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
318 revpkg = RevisionPackager(track, "704195", 0)
367
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
319 srcpkg = SourcePackager(revpkg)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
320
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
321 pkgbasedir = trackdir
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
322 format = srcpkg.get_debian_source_format(pkgbasedir)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
323 self.assertEqual("3.0 (quilt)", format)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
324
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
325 def test_debian_source_format_1_0_1(self):
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
326 trackdir = self.create_files("track",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
327 [("debian",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
328 [("source","")]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
329 ),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
330 ("pkg",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
331 [("704195-0",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
332 [("status",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
333 ("TreePackagerStatus 0.0\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
334 "status: binary_package_created\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
335 "start: 2007-09-10 17:16:48\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
336 "stop: 2007-09-11 00:07:36\n")),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
337 ("src", []),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
338 ("binary", [])
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
339 ]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
340 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
341 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
342 )
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
343 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
344 revpkg = RevisionPackager(track, "704195", 0)
367
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
345 srcpkg = SourcePackager(revpkg)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
346
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
347 pkgbasedir = trackdir
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
348 format = srcpkg.get_debian_source_format(pkgbasedir)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
349 self.assertEqual("1.0", format)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
350
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
351 def test_debian_source_format_1_0_2(self):
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
352 trackdir = self.create_files("track",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
353 [("debian", ""),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
354 ("pkg",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
355 [("704195-0",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
356 [("status",
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
357 ("TreePackagerStatus 0.0\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
358 "status: binary_package_created\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
359 "start: 2007-09-10 17:16:48\n"
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
360 "stop: 2007-09-11 00:07:36\n")),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
361 ("src", []),
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
362 ("binary", [])
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
363 ]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
364 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
365 )]
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
366 )
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
367 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
368 revpkg = RevisionPackager(track, "704195", 0)
367
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
369 srcpkg = SourcePackager(revpkg)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
370
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
371 pkgbasedir = trackdir
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
372 format = srcpkg.get_debian_source_format(pkgbasedir)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
373 self.assertEqual("1.0", format)
fb92f3c1b238 treepkg is now able to handle debian source format 1.0 and source format 3.0 (quilt)
Bjoern Ricks <bricks@intevation.de>
parents: 344
diff changeset
374
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
375 class TestDetermineUpstreamVersion(unittest.TestCase, FileTestMixin):
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
376
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
377 def test_debian_upstream_version(self):
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
378 trackdir = self.create_files("track",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
379 [("debian",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
380 [("changelog", """\
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
381 testpkg (1.0.1~-1abc.173) unstable; urgency=low
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
382
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
383 * Initial version
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
384
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
385 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
386 """
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
387 )]),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
388 ("pkg",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
389 [("704195-0",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
390 [("status",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
391 ("TreePackagerStatus 0.0\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
392 "status: binary_package_created\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
393 "start: 2007-09-10 17:16:48\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
394 "stop: 2007-09-11 00:07:36\n")),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
395 ("src", []),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
396 ("binary", [])
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
397 ]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
398 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
399 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
400 )
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
401 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
402 revpkg = RevisionPackager(track, "704195", 0)
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
403 srcpkg = SourcePackager(revpkg)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
404
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
405 pkgbasedir = trackdir
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
406 version = srcpkg.determine_upstream_version()
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
407 self.assertEqual("1.0.1~", version)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
408
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
409 def test_debian_native_upstream_version(self):
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
410 trackdir = self.create_files("track",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
411 [("debian",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
412 [("changelog", """\
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
413 testpkg (1.0.1) unstable; urgency=low
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
414
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
415 * Initial version
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
416
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
417 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
418 """
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
419 )]),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
420 ("pkg",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
421 [("704195-0",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
422 [("status",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
423 ("TreePackagerStatus 0.0\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
424 "status: binary_package_created\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
425 "start: 2007-09-10 17:16:48\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
426 "stop: 2007-09-11 00:07:36\n")),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
427 ("src", []),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
428 ("binary", [])
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
429 ]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
430 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
431 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
432 )
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
433 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
434 revpkg = RevisionPackager(track, "704195", 0)
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
435 srcpkg = SourcePackager(revpkg)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
436
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
437 pkgbasedir = trackdir
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
438 version = srcpkg.determine_upstream_version()
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
439 self.assertEqual("1.0.1", version)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
440
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
441 def test_debian_epoch_upstream_version(self):
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
442 trackdir = self.create_files("track",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
443 [("debian",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
444 [("changelog", """\
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
445 testpkg (4:1.0.1-1abc3) unstable; urgency=low
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
446
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
447 * Initial version
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
448
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
449 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
450 """
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
451 )]),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
452 ("pkg",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
453 [("704195-0",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
454 [("status",
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
455 ("TreePackagerStatus 0.0\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
456 "status: binary_package_created\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
457 "start: 2007-09-10 17:16:48\n"
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
458 "stop: 2007-09-11 00:07:36\n")),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
459 ("src", []),
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
460 ("binary", [])
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
461 ]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
462 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
463 )]
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
464 )
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
465 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
466 revpkg = RevisionPackager(track, "704195", 0)
495
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
467 srcpkg = SourcePackager(revpkg)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
468
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
469 pkgbasedir = trackdir
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
470 version = srcpkg.determine_upstream_version()
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
471 self.assertEqual("1.0.1", version)
ca95be9d033a add tests for determine debian upstream version
Bjoern Ricks <bricks@intevation.de>
parents: 367
diff changeset
472
88
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
473 class TestRevisionPackager(unittest.TestCase, FileTestMixin):
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
474
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
475 def test_list_source_files(self):
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
476 trackdir = self.create_files("track",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
477 [("pkg",
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
478 [("704195-31",
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
479 [("status",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
480 ("TreePackagerStatus 0.0\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
481 "status: binary_package_created\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
482 "start: 2007-09-10 17:16:48\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
483 "stop: 2007-09-11 00:07:36\n")),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
484 ("src", [("test_1.0.orig.tar.gz", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
485 ("test_1.0-1.diff.gz", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
486 ("test_1.0-1.dsc", "")]),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
487 ("binary", [])]),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
488 ("702432-1",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
489 [("status", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
490 ("src", []),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
491 ("binary", [])])])])
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
492 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
493 revpkg = RevisionPackager(track, "704195", 31)
229
653a45adda50 Prepare for svn managed debian rules directories. So far, the directory
Bernhard Herzog <bh@intevation.de>
parents: 223
diff changeset
494 srcdir = os.path.join(trackdir, "pkg", "704195-31", "src")
88
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
495 self.assertEquals(revpkg.list_source_files(),
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
496 [os.path.join(srcdir, filename)
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
497 for filename in ["test_1.0-1.diff.gz",
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
498 "test_1.0-1.dsc",
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
499 "test_1.0.orig.tar.gz"]])
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
500
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
501 def test_list_binary_files(self):
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
502 trackdir = self.create_files("track",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
503 [("pkg",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
504 [("704195-1",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
505 [("status",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
506 ("TreePackagerStatus 0.0\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
507 "status: binary_package_created\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
508 "start: 2007-09-10 17:16:48\n"
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
509 "stop: 2007-09-11 00:07:36\n")),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
510 ("src", []),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
511 ("binary",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
512 [("test_1.0-1_i386.deb", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
513 ("test_1.0-1_i386.changes", "")])]),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
514 ("702432-1",
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
515 [("status", ""),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
516 ("src", []),
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
517 ("binary", [])])])])
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
518 track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
539
94ff51f691a2 bugfix: revsions are strings now due to git short revision
Bjoern Ricks <bricks@intevation.de>
parents: 517
diff changeset
519 revpkg = RevisionPackager(track, "704195", 1)
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
520 bindir = os.path.join(trackdir, "pkg", "704195-1", "binary")
88
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
521 self.assertEquals(revpkg.list_binary_files(),
117
4bb029560721 Fix variable name in testcase
Bernhard Herzog <bh@intevation.de>
parents: 116
diff changeset
522 [os.path.join(bindir, filename)
88
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
523 for filename in ["test_1.0-1_i386.changes",
3ae54f99db26 Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents: 87
diff changeset
524 "test_1.0-1_i386.deb"]])
113
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
525
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
526
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
527 class TestImportPackagerModule(unittest.TestCase, FileTestMixin):
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
528
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
529 files = [("treepkg_importtest",
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
530 [("__init__.py", ""),
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
531 ("withtrack.py", "\n".join(["class PackageTrack:",
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
532 " pass",
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
533 ""])),
125
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
534 ("srconly.py", "\n".join(["class SourcePackager:",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
535 " pass",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
536 ""])),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
537 ("srcandbin.py", "\n".join(["class SourcePackager:",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
538 " pass",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
539 "class BinaryPackager:",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
540 " pass",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
541 ""])),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
542 ("revonly.py", "\n".join(["class RevisionPackager:",
113
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
543 " pass",
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
544 ""]))])]
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
545
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
546 def setUp(self):
185
e1c7cd896310 Rework test/filesupport.py so that test cases always use their own
Bernhard Herzog <bh@intevation.de>
parents: 128
diff changeset
547 self.directory = self.create_files("a_module", self.files)
113
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
548 self.old_path = sys.path
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
549 sys.path = [self.directory] + sys.path
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
550
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
551 def tearDown(self):
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
552 sys.path = self.old_path
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
553
125
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
554 def check_class_modules(self, module, classmodules):
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
555 self.assertEquals(classmodules,
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
556 [(item[0],
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
557 sys.modules[getattr(module, item[0]).__module__])
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
558 for item in classmodules])
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
559
113
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
560 def test_import_with_track(self):
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
561 module = import_packager_module("treepkg_importtest.withtrack")
125
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
562 self.check_class_modules(module, [("PackageTrack", module)])
113
312949e7628d Add a smarter way to load the packager modules: Add the function
Bernhard Herzog <bh@intevation.de>
parents: 98
diff changeset
563
125
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
564 def test_import_with_source_packager(self):
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
565 module = import_packager_module("treepkg_importtest.srconly")
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
566 self.check_class_modules(module, [("PackageTrack", treepkg.packager),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
567 ("SourcePackager", module),])
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
568
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
569 def test_import_with_source_and_binary_packager(self):
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
570 module = import_packager_module("treepkg_importtest.srcandbin")
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
571 self.check_class_modules(module, [("PackageTrack", treepkg.packager),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
572 ("RevisionPackager",
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
573 treepkg.packager),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
574 ("SourcePackager", module),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
575 ("BinaryPackager", module),])
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
576 self.assertEquals(module.PackageTrack.revision_packager_cls,
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
577 module.RevisionPackager)
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
578 self.assertEquals(module.RevisionPackager.source_packager_cls,
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
579 module.SourcePackager)
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
580 self.assertEquals(module.RevisionPackager.binary_packager_cls,
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
581 module.BinaryPackager)
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
582
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
583 def test_import_with_revision_packager(self):
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
584 module = import_packager_module("treepkg_importtest.revonly")
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
585 self.check_class_modules(module, [("PackageTrack", treepkg.packager),
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
586 ("RevisionPackager", module)])
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
587
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
588 self.assertEquals(module.PackageTrack.revision_packager_cls,
34e08d52956e Make the import_packager_module function more flexible. The modules may
Bernhard Herzog <bh@intevation.de>
parents: 117
diff changeset
589 module.RevisionPackager)
128
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
590
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
591
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
592 class PackageTrackWithDependencies(treepkg.packager.PackageTrack):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
593
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
594 def __init__(self, name, handle_dependencies, requires, provides):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
595 defaults = dict(base_dir="/home/builder/tracks/" + name,
511
e5b66539f893 new variable to set choose the scm for sources and debian dirs
Bjoern Ricks <bricks@intevation.de>
parents: 495
diff changeset
596 url="svn://example.com",
128
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
597 root_cmd=["false"],
344
f06f707d9fda merged branches/scratchbox into trunk
Bjoern Ricks <bricks@intevation.de>
parents: 334
diff changeset
598 builderconfig="/home/builder/pbuilderrc",
128
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
599 deb_email="treepkg@example.com", deb_fullname="treepkg",
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
600 handle_dependencies=handle_dependencies)
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
601 super(PackageTrackWithDependencies,
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
602 self).__init__(name, **defaults)
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
603 self.dependencies = (set(requires.split()), set(provides.split()))
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
604
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
605 def determine_dependencies(self):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
606 pass
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
607
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
608
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
609 class TestPackageDependencies(unittest.TestCase):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
610
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
611 def test_track_order(self):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
612 P = PackageTrackWithDependencies
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
613 tracks = [P("library", True, "base-dev", "library library-dev"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
614 P("other", False, "cdbs base-dev", "other"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
615 P("base", True, "", "base base-dev"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
616 P("program", True, "library-dev libc", "program program-doc"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
617 ]
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
618 group = PackagerGroup(tracks, 3600)
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
619 sorted_tracks = group.get_package_tracks()
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
620 track_indices = dict([(track.name, index) for index, track in
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
621 enumerate(sorted_tracks)])
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
622 def check_order(track1, track2):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
623 self.failUnless(track_indices[track1] < track_indices[track2])
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
624
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
625 check_order("base", "library")
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
626 check_order("library", "program")
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
627 check_order("base", "program")
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
628
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
629 # sanity check whether other is still there. It doesn't matter
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
630 # where
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
631 self.failUnless("other" in track_indices)
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
632
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
633 def test_track_order_cycle(self):
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
634 P = PackageTrackWithDependencies
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
635 tracks = [P("library", True, "base-dev", "library library-dev"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
636 P("cycle", True, "program", "cycle"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
637 P("other", False, "cdbs base-dev", "other"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
638 P("base", True, "cycle", "base base-dev"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
639 P("program", True, "library-dev libc", "program program-doc"),
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
640 ]
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
641 try:
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
642 group = PackagerGroup(tracks, 3600)
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
643 sorted_tracks = group.get_package_tracks()
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
644 except CyclicDependencyError, exc:
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
645 pass
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
646 else:
5155b4f9443d Add basic dependency handling to PackageTrack and PackagerGroup.
Bernhard Herzog <bh@intevation.de>
parents: 125
diff changeset
647 self.fail("PackagerGroup did not detect cyclic dependencies")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)