Mercurial > treepkg
annotate test/test_packager.py @ 94:0c13a84a67dd
refactor the packager test cases to prepare for more tests
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Mon, 26 Nov 2007 14:15:52 +0000 |
parents | 73c67372c7f7 |
children | 8f1c72135ea6 |
rev | line source |
---|---|
84
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2007 by Intevation GmbH |
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> |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
4 # |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # 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
|
6 # 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
|
7 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 """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
|
9 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 import sys |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 import os |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 import unittest |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 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
|
15 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
|
16 from treepkg.util import writefile |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
17 from treepkg.packager import PackagerGroup |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 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
|
19 import treepkg |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
21 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
|
22 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
23 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
24 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
|
25 baseurl = "file://" + directory |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
26 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
|
27 **locals())) |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
28 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
|
29 " $baseurl/trunk", |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
30 **locals())) |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
31 return baseurl |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
32 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 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
|
34 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
|
35 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
|
36 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
|
37 cwd=workingcopy) |
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 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
|
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 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
41 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
42 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
|
43 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
44 pkg_basename = "testpkg" |
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 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
55 changemsg = ("Update to SVN rev. %d" % (self.revision,)) |
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 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
87 Description: Test package for treepkg testsGerman (de) internationalized (i18n) files for KDE |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
88 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
|
89 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
|
90 """), |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
91 ("changelog", """\ |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
92 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
|
93 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
94 * Initial version |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
95 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
96 -- 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
|
97 """), |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
98 ("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
|
99 |
94
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
100 |
84
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
101 def setUp(self): |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
102 self.svndir = self.create_temp_dir(self.id() + "-svn") |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
103 self.svnworkdir = self.create_temp_dir(self.id() + "-svnwork") |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
104 self.trackdir = self.create_temp_dir(self.id() + "-track") |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
105 self.create_files(self.trackdir, 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) |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
108 add_svn_files(self.svnworkdir, self.revisions[0], |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
109 "Initial version") |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
110 |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
111 |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
112 class TestPackager(PackagerTest): |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
113 |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
114 revisions = [ |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
115 [("README", "and miles to go before I sleep")], |
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
116 ] |
84
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
117 |
93
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
118 def runtest(self, debrevision, **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
|
119 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
|
120 "mocksudopbuilder.py") |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
121 track = PackageTrack(name="testpkg", base_dir=self.trackdir, |
94
0c13a84a67dd
refactor the packager test cases to prepare for more tests
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
122 svn_url=self.svn_url, pbuilderrc="", |
84
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
123 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
|
124 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
|
125 deb_fullname="treepkg tester", |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
126 **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
|
127 group = PackagerGroup([track], 1) |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
128 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
|
129 |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
130 # Now check the source and binary package files |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
131 pkgdir = os.path.join(self.trackdir, "pkg", "2-1") |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
132 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "src"))), |
93
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
133 ["testpkg_2-%s.diff.gz" % debrevision, |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
134 "testpkg_2-%s.dsc" % debrevision, |
84
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
135 "testpkg_2.orig.tar.gz"]) |
98a7d70746a9
Make BinaryPackager remove all files that do not belong to the binary
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
136 self.assertEquals(sorted(os.listdir(os.path.join(pkgdir, "binary"))), |
93
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
137 ["testpkg_2-%s_all.deb" % debrevision, |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
138 "testpkg_2-%s_i386.changes" % debrevision]) |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
139 |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
140 def test_default_debrevision_prefix(self): |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
141 self.runtest("treepkg1") |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
142 |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
143 def test_custom_debrevision_prefix(self): |
73c67372c7f7
Make the prefix used in the debian revision number configurable.
Bernhard Herzog <bh@intevation.de>
parents:
91
diff
changeset
|
144 self.runtest("kk1", debrevision_prefix="kk") |
85
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
145 |
91
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
146 class StoppingPackager(treepkg.packager.RevisionPackager): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
147 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
148 def package(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
149 pass |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
150 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
151 class StoppingTrack(treepkg.packager.PackageTrack): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
152 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
153 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
|
154 super(StoppingTrack, self).__init__(name, trackdir, "", "", "", |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
155 "", "") |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
156 self.do_package = do_package |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
157 self.do_stop = do_stop |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
158 self.instructions_file = instructions_file |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
159 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
160 def package_if_updated(self, revision): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
161 if self.do_stop: |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
162 writefile(self.instructions_file, "stop") |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
163 if self.do_package: |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
164 return StoppingPackager(self, 1) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
165 else: |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
166 return None |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
167 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
168 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
169 class TestPackageGroupStop(unittest.TestCase, FileTestMixin): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
170 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
171 def setUp(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
172 self.trackdir = self.create_temp_dir(self.id() + "-track") |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
173 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
|
174 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
175 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
|
176 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
|
177 self.instructions_file, |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
178 "test", self.trackdir)], |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
179 1, instructions_file=self.instructions_file) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
180 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
181 def test_stop(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
182 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
|
183 self.failUnless(group.check_package_tracks()) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
184 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
185 def test_no_stop(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
186 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
|
187 self.failIf(group.check_package_tracks()) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
188 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
189 def test_instruction_removal(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
190 # run once with stopping |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
191 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
|
192 self.failUnless(group.check_package_tracks()) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
193 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
194 # 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
|
195 # instructions file should be removed automatically |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
196 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
|
197 self.failIf(group.check_package_tracks()) |
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 def test_stopping_without_packaging(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
200 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
|
201 self.failUnless(group.check_package_tracks()) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
202 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
203 def test_stopping_between_checks(self): |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
204 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
|
205 # run check_package_tracks once |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
206 self.failIf(group.check_package_tracks()) |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
207 |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
208 # tell treepkg to stop |
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
88
diff
changeset
|
209 writefile(self.instructions_file, "stop") |
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 # 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
|
212 # 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
|
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 |
85
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
215 |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
216 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
|
217 |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
218 def setUp(self): |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
219 self.trackdir = self.create_temp_dir(self.id() + "-track") |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
220 |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
221 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
|
222 # 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
|
223 # 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
|
224 # of revisions |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
225 self.create_files(self.trackdir, |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
226 [("pkg", |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
227 [("704195-1", |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
228 [("status", ""), |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
229 ("src", []), |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
230 ("binary", [])]), |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
231 ("702432-1", |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
232 [("status", ""), |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
233 ("src", []), |
9bd92a3290e0
In TestPackageTrack, create the test files in the test_-methods so that
Bernhard Herzog <bh@intevation.de>
parents:
85
diff
changeset
|
234 ("binary", [])])])]) |
85
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
235 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") |
31b0567df051
Make PackageTrack.get_revision_numbers return the revisions as a sorted
Bernhard Herzog <bh@intevation.de>
parents:
84
diff
changeset
|
236 self.assertEquals(track.get_revision_numbers(), [702432, 704195]) |
87
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
237 |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
238 def test_last_packaged_revision_with_no_revisions(self): |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
239 self.create_files(self.trackdir, [("pkg", [])]) |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
240 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
241 self.assertEquals(track.last_packaged_revision(), -1) |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
242 |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
243 def test_last_packaged_revision_several_revisions(self): |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
244 self.create_files(self.trackdir, |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
245 [("pkg", |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
246 [("704195-1", |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
247 [("status", ""), |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
248 ("src", []), |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
249 ("binary", [])]), |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
250 ("702432-1", |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
251 [("status", ""), |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
252 ("src", []), |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
253 ("binary", [])])])]) |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
254 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") |
08d8ffd40f27
add some tests for the PackageTrack.last_packaged_revision() method
Bernhard Herzog <bh@intevation.de>
parents:
86
diff
changeset
|
255 self.assertEquals(track.last_packaged_revision(), 704195) |
88
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
256 |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
257 |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
258 class TestRevisionPackager(unittest.TestCase, FileTestMixin): |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
259 |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
260 def setUp(self): |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
261 self.trackdir = self.create_temp_dir(self.id() + "-track") |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
262 |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
263 def test_list_source_files(self): |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
264 # Note: The revisions in the pkg dir are not ordered so that we |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
265 # can check whether get_revision_numbers returns a sorted list |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
266 # of revisions |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
267 self.create_files(self.trackdir, |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
268 [("pkg", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
269 [("704195-1", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
270 [("status", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
271 ("TreePackagerStatus 0.0\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
272 "status: binary_package_created\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
273 "start: 2007-09-10 17:16:48\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
274 "stop: 2007-09-11 00:07:36\n")), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
275 ("src", [("test_1.0.orig.tar.gz", ""), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
276 ("test_1.0-1.diff.gz", ""), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
277 ("test_1.0-1.dsc", "")]), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
278 ("binary", [])]), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
279 ("702432-1", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
280 [("status", ""), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
281 ("src", []), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
282 ("binary", [])])])]) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
283 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
284 revpkg = RevisionPackager(track, 704195) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
285 srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "src") |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
286 self.assertEquals(revpkg.list_source_files(), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
287 [os.path.join(srcdir, filename) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
288 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
|
289 "test_1.0-1.dsc", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
290 "test_1.0.orig.tar.gz"]]) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
291 |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
292 def test_list_binary_files(self): |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
293 # Note: The revisions in the pkg dir are not ordered so that we |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
294 # can check whether get_revision_numbers returns a sorted list |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
295 # of revisions |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
296 self.create_files(self.trackdir, |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
297 [("pkg", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
298 [("704195-1", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
299 [("status", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
300 ("TreePackagerStatus 0.0\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
301 "status: binary_package_created\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
302 "start: 2007-09-10 17:16:48\n" |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
303 "stop: 2007-09-11 00:07:36\n")), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
304 ("src", []), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
305 ("binary", [("test_1.0-1_i386.deb", ""), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
306 ("test_1.0-1_i386.changes", "")])]), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
307 ("702432-1", |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
308 [("status", ""), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
309 ("src", []), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
310 ("binary", [])])])]) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
311 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
312 revpkg = RevisionPackager(track, 704195) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
313 srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "binary") |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
314 self.assertEquals(revpkg.list_binary_files(), |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
315 [os.path.join(srcdir, filename) |
3ae54f99db26
Add methods RevisionPackager.list_source_files and
Bernhard Herzog <bh@intevation.de>
parents:
87
diff
changeset
|
316 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
|
317 "test_1.0-1_i386.deb"]]) |