Fix build-priority setting
[mirror/wanna-build.git] / tests / qd.pl
1 #!/usr/bin/perl -w -I lib
2
3 use Test::More tests => 1;
4
5 $src = <<EOF
6 Package: bash
7 Binary: bash, bash-static, bash-builtins, bash-doc, bashdb
8 Version: 4.1-3
9 Priority: required
10 Architecture: any
11 Section: shell
12
13 Package: test
14 Binary: test
15 Version: 4.1-3
16 Priority: optional
17 Architecture: any
18 Section: shell
19
20 Package: nfu
21 Binary: nfu
22 Version: 4.1-3
23 Priority: optional
24 Architecture: any
25 Section: shell
26
27 Package: all
28 Binary: all
29 Version: 4.1-3
30 Priority: optional
31 Architecture: all
32 Section: shell
33
34 Package: allbin
35 Binary: allbin
36 Version: 4.1-3
37 Priority: optional
38 Architecture: all
39 Section: shell
40
41 Package: e2fsprogs
42 Binary: e2fsck-static
43 Version: 1.41.12-1
44 Priority: required
45 Section: admin
46 Architecture: any
47
48 Package: e2fsprogs
49 Binary: e2fsck-static
50 Version: 1.41.11-1
51 Priority: required
52 Section: admin
53 Architecture: any
54
55 Package: base-files
56 Binary: base-files
57 Version: 5.7
58 Priority: required
59 Section: admin
60 Architecture: i386 all
61 Build-Depends: debhelper [i386 amd64], bash [!kfreebsd-i386], perl [!i386 !amd64]
62
63 Package: pbuilder
64 Binary: pbuilder, pbuilder-uml
65 Version: 0.196
66 Priority: extra
67 Section: devel
68 Build-Depends: debhelper (>= 7), docbook-xsl, ldp-docbook-xsl (>= 0.0.20040321-0.1), xsltproc, dpkg-dev (>= 1.13.19), dblatex, debconf | debconf-2.0, po-debconf, po4a
69 Build-Conflicts: dash
70 Architecture: all i386 amd64
71
72 Package: autonfu
73 Binary: autonfu
74 Version: 1.41.11-1
75 Priority: required
76 Section: admin
77 Architecture: amd64
78
79 Package: autonfu1
80 Binary: autonfu1
81 Version: 1.41.11-1
82 Priority: required
83 Section: admin
84 Architecture: linux-any
85
86 Package: lv2core
87 Binary: lv2core
88 Version: 4.0-5
89 Priority: optional
90 Section: sound
91 Architecture: any
92
93 Package: haskell-haxr
94 Binary: libghc6-haxr-prof
95 Version: 3000.2.1-2
96 Priority: extra
97 Section: haskell
98 Architecture: any
99
100 Package: haskall-dummy
101 Binary: libghc6-haxr-prof
102 Version: 1:3
103 Priority: extra
104 Section: haskell
105 Architecture: all
106
107 EOF
108 ;
109
110 $bin = <<EOF
111 Package: base-files
112 Priority: required
113 Section: admin
114 Architecture: i386
115 Version: 5.6
116
117 Package: bash
118 Source: bash (4.1-3)
119 Priority: required
120 Section: shells
121 Architecture: i386
122 Version: 4.1-3+b2
123
124 Package: bash-static
125 Priority: required
126 Section: shells
127 Architecture: i386
128 Version: 4.1-3+b1
129
130 Package: e2fsprogs
131 Priority: required
132 Section: admin
133 Architecture: i386
134 Version: 1.41.11-1
135
136 Package: all
137 Version: 4.1-3
138 Priority: optional
139 Architecture: all
140 Section: shell
141
142 Package: pbuilder
143 Priority: extra
144 Section: devel
145 Architecture: all
146 Version: 0.196
147
148 Package: lv2core
149 Priority: optional
150 Section: sound
151 Installed-Size: 112
152 Architecture: all
153 Version: 3.0-3
154
155 Package: libghc6-haxr-prof
156 Version: 1:3
157 Priority: extra
158 Section: haskell
159 Architecture: all
160
161 EOF
162 ;
163
164 $pas = <<EOF
165 %nfu: amd64 # we fake to be i386 here
166 e2fsprogs: i386
167 pbuilder-uml: amd64                                              # depends on user-mode-linux
168 EOF
169 ;
170
171 use WB::QD;
172 my $srcs = WB::QD::readsourcebins('i386', \$pas, [\$src], [\$bin]);
173 use Data::Dumper;
174
175 #print Dumper $srcs;
176 is_deeply ($$srcs, {
177             'e2fsprogs' => {
178                              'priority' => 'required',
179                              'status' => 'out-of-date',
180                              'version' => '1.41.12-1',
181                              'name' => 'e2fsprogs',
182                              'section' => 'admin',
183                              'binary' => ['e2fsck-static', ],
184                            },
185             'bash' => {
186                         'priority' => 'required',
187                         'status' => 'installed',
188                         'version' => '4.1-3',
189                         'name' => 'bash',
190                         'section' => 'shell',
191                         'binnmu' => '2',
192                              'binary' => ['bash', 'bash-static', 'bash-builtins', 'bash-doc', 'bashdb'],
193                       },
194             'base-files' => {
195                               'priority' => 'required',
196                               'status' => 'out-of-date',
197                               'version' => '5.7',
198                               'name' => 'base-files',
199                               'section' => 'admin',
200                               'depends' => 'debhelper [i386 amd64], bash [!kfreebsd-i386], perl [!i386 !amd64]',
201                              'binary' => ['base-files'],
202                             },
203             'haskall-dummy' => {
204                                  'priority' => 'extra',
205                                  'status' => 'arch-all-only',
206                                  'version' => '1:3',
207                                  'binary' => [
208                                                'libghc6-haxr-prof'
209                                              ],
210                                  'name' => 'haskall-dummy',
211                                  'section' => 'haskell'
212                                },
213             'all' => {
214                        'priority' => 'optional',
215                        'status' => 'arch-all-only',
216                        'version' => '4.1-3',
217                        'binary' => [
218                                      'all'
219                                    ],
220                        'name' => 'all',
221                        'section' => 'shell'
222                      },
223             'allbin' => {
224                           'priority' => 'optional',
225                           'status' => 'arch-all-only',
226                           'version' => '4.1-3',
227                           'binary' => [
228                                         'allbin'
229                                       ],
230                           'name' => 'allbin',
231                           'section' => 'shell'
232                         },
233             'test' => {
234                         'priority' => 'optional',
235                         'status' => 'uncompiled',
236                         'version' => '4.1-3',
237                         'name' => 'test',
238                         'section' => 'shell',
239                              'binary' => ['test'],
240                       },
241             'nfu' => {
242                         'priority' => 'optional',
243                         'status' => 'packages-arch-specific',
244                         'version' => '4.1-3',
245                         'name' => 'nfu',
246                         'section' => 'shell',
247                              'binary' => ['nfu'],
248                       },
249             'autonfu' => {
250                         'priority' => 'required',
251                         'status' => 'arch-not-in-arch-list',
252                         'version' => '1.41.11-1',
253                         'name' => 'autonfu',
254                         'section' => 'admin',
255                              'binary' => ['autonfu'],
256                       },
257             'autonfu1' => {
258                         'priority' => 'required',
259                         'status' => 'uncompiled',
260                         'version' => '1.41.11-1',
261                         'name' => 'autonfu1',
262                         'section' => 'admin',
263                              'binary' => ['autonfu1'],
264                       },
265             'pbuilder' => {
266                             'priority' => 'extra',
267                             'status' => 'packages-arch-specific',
268                             'version' => '0.196',
269                             'binary' => [
270                                           'pbuilder',
271                                           'pbuilder-uml'
272                                         ],
273                             'name' => 'pbuilder',
274                             'section' => 'devel',
275                             'depends' => 'debhelper (>= 7), docbook-xsl, ldp-docbook-xsl (>= 0.0.20040321-0.1), xsltproc, dpkg-dev (>= 1.13.19), dblatex, debconf | debconf-2.0, po-debconf, po4a',
276                             'conflicts' => 'dash'
277                           },
278             'lv2core' => {
279                 'priority' => 'optional',
280                 'status' => 'uncompiled',
281                 'version' => '4.0-5',
282                 'binary' => [
283                         'lv2core'
284                       ],
285                 'name' => 'lv2core',
286                 'section' => 'sound'
287             },
288             'haskell-haxr' => {
289                 'priority' => 'extra',
290                 'status' => 'overwritten-by-arch-all',
291                 'version' => '3000.2.1-2',
292                 'binary' => [
293                         'libghc6-haxr-prof'
294                       ],
295                 'name' => 'haskell-haxr',
296                 'section' => 'haskell'
297             },
298             '_binary' => {
299                 'e2fsprogs' => {'version' => '1.41.11-1', 'arch' => 'i386'},
300                 'bash' => {'version' => '4.1-3', 'arch' => 'i386'},
301                 'base-files' => {'version' => '5.6', 'arch' => 'i386'},
302                 'bash-static' => {'version' => '4.1-3', 'arch' => 'i386'},
303                 'all' => {'version' => '4.1-3', 'arch' => 'all'},
304                 'pbuilder' => { 'arch' => 'all', 'version' => '0.196' },
305                 'libghc6-haxr-prof' => { 'arch' => 'all', 'version' => '1:3' },
306             },
307 }, 'reading packages');