Mercurial > treepkg
annotate test/test_builder.py @ 183:72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
PBuilder.run_script tests to a change introduced in the last commit.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Wed, 25 Jun 2008 15:14:27 +0000 |
parents | 81585486281b |
children | e1c7cd896310 |
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 |
170
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
13 import StringIO |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 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
|
16 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
|
17 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 from filesupport import FileTestMixin |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 # helper program to dump the command line arguments into a file so that |
126
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
21 # test cases can check them. Also if the environment variable |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
22 # TREEPKG_TEST is set, create the file named by it. |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
23 dump_command_line_py = """ |
126
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
24 import sys, os |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
25 open(sys.argv[1], 'w').write(repr(sys.argv[2:])) |
126
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
26 value = os.environ.get('TREEPKG_TEST') |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
27 if value: |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
28 open(value, 'w').close() |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
29 """ |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
30 |
121
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
31 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
|
32 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 def setUp(self): |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
34 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
|
35 dump_command_line_py) |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 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
|
37 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
|
38 self.command_line_file] |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 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
|
41 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
|
42 |
121
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
43 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
44 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
|
45 |
170
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
46 def test_init_pbuilder(self): |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
47 """Tests the PBuilder.init_pbuilder method.""" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
48 basedir = self.create_temp_dir(self.id()) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
49 pbuilderrc = os.path.join(basedir, "pbuilderrc") |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
50 builder = PBuilder(pbuilderrc, self.root_command) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
51 old_stdout = sys.stdout |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
52 sys.stdout = captured_stdout = StringIO.StringIO() |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
53 try: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
54 builder.init_pbuilder(distribution="etch", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
55 mirrorsite="http://example.com/debian", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
56 extramirrors=None) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
57 finally: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
58 sys.stdout = old_stdout |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
59 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
60 # check whether the necessary directories were created |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
61 missing = [dirname for dirname in ["base", "build", "result", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
62 "aptcache", "extra-pkg"] |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
63 if not os.path.isdir(os.path.join(basedir, dirname))] |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
64 if missing: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
65 self.fail("init_pbuilder did not create these directories: %s" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
66 % " ".join(missing)) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
67 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
68 # check the pbuilderrc. This test is a little too strict |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
69 # because it checks the exact contents of the file. Instread it |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
70 # should normalize the contents in some way and check that. |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
71 pbuilderrc_contents = ( |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
72 "# This file was automatically generated by initpbuilder.py.\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
73 "# for the possible settings see \"man pbuilderrc\"\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
74 "\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
75 "BASETGZ=%(basedir)s/base/base.tgz\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
76 "BUILDPLACE=%(basedir)s/build\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
77 "USEPROC=yes\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
78 "USEDEVPTS=yes\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
79 "BUILDRESULT=%(basedir)s/result\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
80 "DISTRIBUTION=etch\n" |
173
97435e92411a
Introduce filenameproperties for the various directories in the PBuilder class
Bernhard Herzog <bh@intevation.de>
parents:
171
diff
changeset
|
81 "APTCACHE=%(basedir)s/aptcache\n" |
170
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
82 "APTCACHEHARDLINK=yes\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
83 "REMOVEPACKAGES=lilo\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
84 "MIRRORSITE=\"http://example.com/debian\"\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
85 "OTHERMIRROR=\"deb file://%(basedir)s/extra-pkg ./\"\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
86 "BINDMOUNTS=\"%(basedir)s/extra-pkg\"\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
87 "PKGNAME_LOGFILE=yes\n" % locals()) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
88 self.checkFileContents(pbuilderrc, pbuilderrc_contents) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
89 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
90 # The Packages file is empty for now. |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
91 self.checkFileContents(os.path.join(basedir, "extra-pkg", "Packages"), |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
92 "") |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
93 # check the text written to stdout. This test is a little too |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
94 # strict because it checks the exact output. |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
95 self.assertEquals(captured_stdout.getvalue(), |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
96 "creating directory: '%(basedir_repr)s/base'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
97 "creating directory: '%(basedir_repr)s/build'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
98 "creating directory: '%(basedir_repr)s/result'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
99 "creating directory: '%(basedir_repr)s/aptcache'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
100 "creating directory: '%(basedir_repr)s/extra-pkg'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
101 "creating pbuilderrc: '%(basedir_repr)s/pbuilderrc'\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
102 "turning the extra-pkg dir into a debian archive\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
103 "running pbuilder create\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
104 % dict(basedir_repr=repr(basedir)[1:-1])) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
105 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
106 def test_init_pbuilder_run_twice(self): |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
107 """Tests whether PBuilder.init_pbuilder prints an error when run twice. |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
108 """ |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
109 basedir = self.create_temp_dir(self.id()) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
110 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
111 # run it once |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
112 pbuilderrc = os.path.join(basedir, "pbuilderrc") |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
113 builder = PBuilder(pbuilderrc, self.root_command) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
114 old_stdout = sys.stdout |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
115 sys.stdout = captured_stdout = StringIO.StringIO() |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
116 try: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
117 builder.init_pbuilder(distribution="etch", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
118 mirrorsite="http://example.com/debian", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
119 extramirrors=None) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
120 finally: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
121 sys.stdout = old_stdout |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
122 |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
123 # running it again should not modify anything in the directory |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
124 # (which we don't check currently), it should print an error |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
125 # message and exit with exit code 1. |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
126 old_stderr = sys.stderr |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
127 sys.stderr = captured_stderr = StringIO.StringIO() |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
128 try: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
129 try: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
130 builder.init_pbuilder(distribution="etch", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
131 mirrorsite="http://example.com/debian", |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
132 extramirrors=None) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
133 except SystemExit, exc: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
134 self.assertEquals(exc.code, 1) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
135 finally: |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
136 sys.stderr = old_stderr |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
137 self.assertEquals("pbuilderrc %r already exists.\n" |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
138 % os.path.join(basedir, "pbuilderrc"), |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
139 captured_stderr.getvalue()) |
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
140 |
178
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
141 def test_update(self): |
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
142 """Tests the PBuilder.update method.""" |
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
143 builder = PBuilder("my_pbuilderrc", self.root_command) |
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
144 builder.update() |
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
145 self.check_command_line(['/usr/sbin/pbuilder', 'update', |
b2fa3b0926d0
PBuilder: refactor the "pbuilder update" call into a separate method
Bernhard Herzog <bh@intevation.de>
parents:
176
diff
changeset
|
146 '--configfile', 'my_pbuilderrc']) |
170
bfcb2bbf9a52
Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents:
126
diff
changeset
|
147 |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
148 def test_build(self): |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
149 """Tests the PBuilder.build method. |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
150 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
|
151 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
|
152 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
|
153 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
|
154 the arguments doesn't matter. |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
155 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
156 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
|
157 the packager tests. |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
158 """ |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
159 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
|
160 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
|
161 os.rmdir(binary_dir_name) |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
162 # 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
|
163 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
|
164 |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
165 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
|
166 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
|
167 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
|
168 '--configfile', 'my_pbuilderrc', |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
169 '--logfile', 'the_logfile', |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
170 '--buildresult', binary_dir_name, |
171
c0ea6cbb0fd2
Add "--debbuildopts -b" to "pbuilder build" command line to stop
Bernhard Herzog <bh@intevation.de>
parents:
170
diff
changeset
|
171 '--debbuildopts', '-b', |
118
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
172 'my_dsc_file']) |
9d59ed0e3116
Add test/test_builder.py with tests for treepkg.builder
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
173 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
|
174 |
122
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
175 def test_build_with_bindmounts(self): |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
176 """Tests the PBuilder.build method with the bindmounts parameter""" |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
177 binary_dir_name = self.temp_file_name("binary") |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
178 if os.path.exists(binary_dir_name): |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
179 os.rmdir(binary_dir_name) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
180 # sanity check: the binary directory must not exist yet. |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
181 self.failIf(os.path.exists(binary_dir_name)) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
182 |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
183 builder = PBuilder("my_pbuilderrc", self.root_command) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
184 builder.build("my_dsc_file", binary_dir_name, "the_logfile", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
185 bindmounts=["/home/builder/tracks", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
186 "/home/builder/pbuilder"]) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
187 self.check_command_line(['/usr/sbin/pbuilder', 'build', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
188 '--configfile', 'my_pbuilderrc', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
189 '--bindmounts', "/home/builder/tracks", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
190 '--bindmounts', "/home/builder/pbuilder", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
191 '--logfile', 'the_logfile', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
192 '--buildresult', binary_dir_name, |
171
c0ea6cbb0fd2
Add "--debbuildopts -b" to "pbuilder build" command line to stop
Bernhard Herzog <bh@intevation.de>
parents:
170
diff
changeset
|
193 '--debbuildopts', '-b', |
122
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
194 'my_dsc_file']) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
195 self.failUnless(os.path.isdir(binary_dir_name)) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
196 |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
197 def test_build_with_extra_packages(self): |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
198 """Tests the PBuilder.build method with the extra_packages parameter""" |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
199 binary_dir_name = self.temp_file_name("binary") |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
200 if os.path.exists(binary_dir_name): |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
201 os.rmdir(binary_dir_name) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
202 # sanity check: the binary directory must not exist yet. |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
203 self.failIf(os.path.exists(binary_dir_name)) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
204 |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
205 builder = PBuilder("my_pbuilderrc", self.root_command) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
206 builder.build("my_dsc_file", binary_dir_name, "the_logfile", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
207 extra_packages=["subversion", "texinfo"]) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
208 self.check_command_line(['/usr/sbin/pbuilder', 'build', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
209 '--configfile', 'my_pbuilderrc', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
210 '--extrapackages', "subversion", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
211 '--extrapackages', "texinfo", |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
212 '--logfile', 'the_logfile', |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
213 '--buildresult', binary_dir_name, |
171
c0ea6cbb0fd2
Add "--debbuildopts -b" to "pbuilder build" command line to stop
Bernhard Herzog <bh@intevation.de>
parents:
170
diff
changeset
|
214 '--debbuildopts', '-b', |
122
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
215 'my_dsc_file']) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
216 self.failUnless(os.path.isdir(binary_dir_name)) |
6e34fc4ebe39
New arguments for the PBuilder.build method:
Bernhard Herzog <bh@intevation.de>
parents:
121
diff
changeset
|
217 |
126
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
218 def test_build_with_extra_env(self): |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
219 """Tests the PBuilder.build method with the extra_env parameter""" |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
220 binary_dir_name = self.temp_file_name("binary") |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
221 if os.path.exists(binary_dir_name): |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
222 os.rmdir(binary_dir_name) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
223 env_test_file = self.temp_file_name(self.id() + "_envtest", remove=True) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
224 # sanity check: the binary directory must not exist yet. |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
225 self.failIf(os.path.exists(binary_dir_name)) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
226 # sanity check: the environment variable TREEPKG_TEST must not |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
227 # be set yet |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
228 self.failIf("TREEPKG_TEST" in os.environ) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
229 |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
230 builder = PBuilder("my_pbuilderrc", self.root_command) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
231 builder.build("my_dsc_file", binary_dir_name, "the_logfile", |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
232 extra_env=dict(TREEPKG_TEST=env_test_file)) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
233 self.check_command_line(['/usr/sbin/pbuilder', 'build', |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
234 '--configfile', 'my_pbuilderrc', |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
235 '--logfile', 'the_logfile', |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
236 '--buildresult', binary_dir_name, |
171
c0ea6cbb0fd2
Add "--debbuildopts -b" to "pbuilder build" command line to stop
Bernhard Herzog <bh@intevation.de>
parents:
170
diff
changeset
|
237 '--debbuildopts', '-b', |
126
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
238 'my_dsc_file']) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
239 self.failUnless(os.path.isdir(binary_dir_name)) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
240 self.failUnless(os.path.exists(env_test_file)) |
68d829cac3ff
New parameter for PBuilder.build: extra_env, a mapping with extra
Bernhard Herzog <bh@intevation.de>
parents:
122
diff
changeset
|
241 |
119
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
242 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
|
243 builder = PBuilder("my_pbuilderrc", self.root_command) |
181
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
244 builder.run_script(["my_script"], logfile="the_logfile") |
119
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
245 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
|
246 '--configfile', 'my_pbuilderrc', |
183
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
247 '--logfile', 'the_logfile', '--', |
119
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
248 'my_script']) |
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
249 |
181
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
250 def test_run_script_with_arguments(self): |
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
251 builder = PBuilder("my_pbuilderrc", self.root_command) |
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
252 builder.run_script(["my_script", "--verbose"], logfile="the_logfile") |
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
253 self.check_command_line(['/usr/sbin/pbuilder', 'execute', |
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
254 '--configfile', 'my_pbuilderrc', |
183
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
255 '--logfile', 'the_logfile', '--', |
181
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
256 'my_script', '--verbose']) |
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
257 |
119
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
258 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
|
259 builder = PBuilder("my_pbuilderrc", self.root_command) |
181
81585486281b
Extend the PBuilder.run_script method so that the script can be called
Bernhard Herzog <bh@intevation.de>
parents:
178
diff
changeset
|
260 builder.run_script(["my_script"], logfile="the_logfile", |
119
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
261 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
|
262 "/home/builder/treepkg")) |
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
263 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
|
264 '--configfile', 'my_pbuilderrc', |
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
265 '--logfile', 'the_logfile', |
92116333ef77
Add PBuilder.run_script method and associated tests. The run_script
Bernhard Herzog <bh@intevation.de>
parents:
118
diff
changeset
|
266 '--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
|
267 '--bindmounts', '/home/builder/treepkg', |
183
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
268 '--', 'my_script']) |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
269 |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
270 def test_run_script_save_after_exec(self): |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
271 builder = PBuilder("my_pbuilderrc", self.root_command) |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
272 builder.run_script(["my_script", "--verbose"], logfile="the_logfile", |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
273 save_after_exec=True) |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
274 self.check_command_line(['/usr/sbin/pbuilder', 'execute', |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
275 '--configfile', 'my_pbuilderrc', |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
276 '--logfile', 'the_logfile', |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
277 '--save-after-exec', '--', |
72e41b27f224
Add test case for the save_after_exec parameter and adapt the other
Bernhard Herzog <bh@intevation.de>
parents:
181
diff
changeset
|
278 'my_script', '--verbose']) |
121
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
279 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
280 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
281 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
|
282 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
283 minimal_package = [ |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
284 ("debian", |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
285 [("control", """\ |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
286 Source: minimal |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
287 Section: utils |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
288 Priority: optional |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
293 Package: minimal |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
294 Architecture: any |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
295 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
|
296 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
|
297 """), |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
298 ("rules", 0755, """\ |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
299 #!/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
|
300 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
301 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
|
302 build-stamp: |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
303 dh_testdir |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
304 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
|
305 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
306 clean: |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
307 dh_testdir |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
308 dh_testroot |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
309 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
|
310 dh_clean |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
311 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
312 # 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
|
313 binary-arch: |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
314 dh_testdir |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
315 dh_testroot |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
316 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
|
317 dh_installchangelogs |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
318 dh_fixperms |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
319 dh_installdeb |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
320 dh_gencontrol |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
321 dh_md5sums |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
322 dh_builddeb |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
323 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
324 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
|
325 .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
|
326 """), |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
327 ("changelog", """\ |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
328 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
|
329 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
330 * Newly packaged |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
331 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
332 -- 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
|
333 """)]), |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
334 ("README", """\ |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
335 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
|
336 """), |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
337 ] |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
338 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
339 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
|
340 ("extra-pkg", [])] |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
341 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 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
|
346 "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
|
347 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
|
348 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
|
349 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
|
350 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
|
351 "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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
357 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
|
358 """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
|
359 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
|
360 # 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
|
361 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
|
362 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
363 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
|
364 |
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
365 self.assertEquals(sorted(os.listdir(self.extra_pkg_dir)), |
176
7bde59aa611e
Make PBuilder.update_extra_pkg_dir create Release and Release.gpg files
Bernhard Herzog <bh@intevation.de>
parents:
173
diff
changeset
|
366 ["Packages", "Release", "minimal_1.0-1_i386.deb"]) |
121
890bb70920d6
Add the PBuilder.add_binaries_to_extra_pkg method. It allows automatic
Bernhard Herzog <bh@intevation.de>
parents:
119
diff
changeset
|
367 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
|
368 '--configfile', self.pbuilderrc]) |