annotate test/test_builder.py @ 121:890bb70920d6

Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic installation of extra packages that should be available in the pbuilder chroot. Also add corresponding tests.
author Bernhard Herzog <bh@intevation.de>
date Wed, 21 May 2008 16:47:34 +0000
parents 92116333ef77
children 6e34fc4ebe39
rev   line source
118
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007, 2008 by Intevation GmbH
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 #
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 # This program is free software under the GPL (>=v2)
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # Read the file COPYING coming with the software for details.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8 """Tests for treepkg.builder"""
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10 import sys
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import os
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import unittest
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14 from treepkg.builder import PBuilder
121
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
15 from treepkg.run import call
118
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17 from filesupport import FileTestMixin
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 # helper program to dump the command line arguments into a file so that
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20 # test cases can check them.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 dump_command_line_py = """
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22 import sys
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 open(sys.argv[1], 'w').write(repr(sys.argv[2:]))
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 """
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25
121
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
26 class PBuilderTests(unittest.TestCase, FileTestMixin):
118
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 def setUp(self):
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 self.dump_command_line = self.create_temp_file("dump_command_line.py",
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 dump_command_line_py)
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 self.command_line_file = self.temp_file_name("command_line")
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32 self.root_command = [sys.executable, self.dump_command_line,
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 self.command_line_file]
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35 def check_command_line(self, args):
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
36 self.checkFileContents(self.command_line_file, repr(args))
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
37
121
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
38
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
39 class TestPBuilder(PBuilderTests):
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
40
118
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41 def test_build(self):
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42 """Tests the PBuilder.build method.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43 The test checks whether the build method creates the binary_dir
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
44 and then checks the arguments with which the root command is
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
45 called. The test is a little too strict because it expects a
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
46 specific order of the arguments even though the order of some of
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
47 the arguments doesn't matter.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
48
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
49 A more thorough test of the build method is implicity done by
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
50 the packager tests.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
51 """
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
52 binary_dir_name = self.temp_file_name("binary")
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
53 if os.path.exists(binary_dir_name):
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
54 os.rmdir(binary_dir_name)
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
55 # sanity check: the binary directory must not exist yet.
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
56 self.failIf(os.path.exists(binary_dir_name))
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
57
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
58 builder = PBuilder("my_pbuilderrc", self.root_command)
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
59 builder.build("my_dsc_file", binary_dir_name, "the_logfile")
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
60 self.check_command_line(['/usr/sbin/pbuilder', 'build',
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
61 '--configfile', 'my_pbuilderrc',
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
62 '--logfile', 'the_logfile',
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63 '--buildresult', binary_dir_name,
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64 'my_dsc_file'])
9d59ed0e3116 Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 self.failUnless(os.path.isdir(binary_dir_name))
119
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
66
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
67 def test_run_script(self):
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
68 builder = PBuilder("my_pbuilderrc", self.root_command)
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
69 builder.run_script("my_script", logfile="the_logfile")
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
70 self.check_command_line(['/usr/sbin/pbuilder', 'execute',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
71 '--configfile', 'my_pbuilderrc',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
72 '--logfile', 'the_logfile',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
73 'my_script'])
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
74
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
75 def test_run_script_with_bindmounts(self):
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
76 builder = PBuilder("my_pbuilderrc", self.root_command)
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
77 builder.run_script("my_script", logfile="the_logfile",
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
78 bindmounts=("/home/builder/foo",
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
79 "/home/builder/treepkg"))
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
80 self.check_command_line(['/usr/sbin/pbuilder', 'execute',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
81 '--configfile', 'my_pbuilderrc',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
82 '--logfile', 'the_logfile',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
83 '--bindmounts', '/home/builder/foo',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
84 '--bindmounts', '/home/builder/treepkg',
92116333ef77 Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents: 118
diff changeset
85 'my_script'])
121
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
86
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
87
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
88 class TestPBuilderWithBinaryPackage(PBuilderTests):
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
89
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
90 minimal_package = [
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
91 ("debian",
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
92 [("control", """\
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
93 Source: minimal
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
94 Section: utils
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
95 Priority: optional
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
96 Maintainer: Bernhard Herzog <bh@intevation.de>
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
97 Standards-Version: 3.7.2.2
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
98 Build-Depends: debhelper
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
99
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
100 Package: minimal
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
101 Architecture: any
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
102 Depends: ${shlibs:Depends}
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
103 Description: Minimal package for test purposes
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
104 """),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
105 ("rules", 0755, """\
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
106 #!/usr/bin/make -f
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
107
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
108 build: build-stamp
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
109 build-stamp:
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
110 dh_testdir
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
111 touch build-stamp
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
112
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
113 clean:
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
114 dh_testdir
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
115 dh_testroot
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
116 rm -f build-stamp
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
117 dh_clean
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
118
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
119 # Build architecture-dependent files here.
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
120 binary-arch:
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
121 dh_testdir
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
122 dh_testroot
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
123 dh_installdocs README
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
124 dh_installchangelogs
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
125 dh_fixperms
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
126 dh_installdeb
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
127 dh_gencontrol
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
128 dh_md5sums
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
129 dh_builddeb
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
130
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
131 binary: binary-arch
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
132 .PHONY: build build-stamp clean binary-arch binary
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
133 """),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
134 ("changelog", """\
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
135 minimal (1.0-1) unstable; urgency=low
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
136
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
137 * Newly packaged
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
138
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
139 -- Bernhard Herzog <bh@intevation.de> Wed, 21 May 2008 16:10:29 +0200
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
140 """)]),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
141 ("README", """\
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
142 This is a minimal debian package for test purposes
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
143 """),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
144 ]
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
145
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
146 pbuilder_files = [("pbuilderrc", ""),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
147 ("extra-pkg", [])]
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
148
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
149 def setUp(self):
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
150 PBuilderTests.setUp(self)
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
151 self.temp_base_dir = self.create_temp_dir(self.id())
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
152 self.minimal_packge_dir = os.path.join(self.temp_base_dir,
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
153 "minimal-1.0")
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
154 self.create_files(self.minimal_packge_dir, self.minimal_package)
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
155 call(["dpkg-buildpackage", "-rfakeroot", "-b", "-uc"],
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
156 cwd=self.minimal_packge_dir, suppress_output=True)
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
157 self.minimal_package_deb = os.path.join(self.temp_base_dir,
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
158 "minimal_1.0-1_i386.deb")
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
159 self.pbuilder_basedir = os.path.join(self.temp_base_dir, "pbuilder")
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
160 self.create_files(self.pbuilder_basedir, self.pbuilder_files)
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
161 self.extra_pkg_dir = os.path.join(self.pbuilder_basedir, "extra-pkg")
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
162 self.pbuilderrc = os.path.join(self.pbuilder_basedir, "pbuilderrc")
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
163
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
164 def test_add_binaries_to_extra_pkg(self):
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
165 """Tests the PBuilder.add_binaries_to_extra_pkg method"""
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
166 builder = PBuilder(self.pbuilderrc, self.root_command)
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
167 # sanity check: the extra-pkg directory should be empty now
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
168 self.assertEquals(os.listdir(self.extra_pkg_dir), [])
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
169
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
170 builder.add_binaries_to_extra_pkg([self.minimal_package_deb])
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
171
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
172 self.assertEquals(sorted(os.listdir(self.extra_pkg_dir)),
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
173 ["Packages", "minimal_1.0-1_i386.deb"])
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
174 self.check_command_line(['/usr/sbin/pbuilder', 'update',
890bb70920d6 Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents: 119
diff changeset
175 '--configfile', self.pbuilderrc])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)