Commit | Line | Data |
---|---|---|
1479465f GJ |
1 | AT_TESTED([dpkg-deb]) |
2 | ||
3 | AT_SETUP([dpkg-deb options]) | |
4 | AT_KEYWORDS([dpkg-deb command-line]) | |
5 | AT_CHECK([dpkg-deb --help], [], [ignore]) | |
6 | AT_CLEANUP | |
7 | ||
8 | AT_SETUP([dpkg-deb .deb format]) | |
9 | AT_KEYWORDS([dpkg-deb deb]) | |
10 | ||
11 | DPKG_GEN_CONTROL([pkg-deb-format]) | |
12 | DPKG_MOD_CONTROL([pkg-deb-format], | |
13 | [s/^Description:.*$/& - deb format support/]) | |
14 | AT_DATA([pkg-deb-format/file-templ], [test | |
15 | ]) | |
16 | AT_CHECK([ | |
17 | # Initialize the template package | |
18 | mv pkg-deb-format pkg-templ | |
19 | chmod -R u+w pkg-templ | |
20 | find pkg-templ | xargs touch -t 197001010100.00 | |
21 | $ASROOT dpkg-deb --uniform-compression -Znone -b pkg-templ >/dev/null | |
22 | ||
23 | # Extract the base members | |
24 | ar x pkg-templ.deb | |
25 | gzip -c control.tar >control.tar.gz | |
26 | gzip -c data.tar >data.tar.gz | |
27 | xz -c control.tar >control.tar.xz | |
28 | xz -c data.tar >data.tar.xz | |
29 | bzip2 -c data.tar >data.tar.bz2 | |
30 | lzma -c data.tar >data.tar.lzma | |
31 | touch _ignore | |
32 | touch unknown | |
33 | ]) | |
34 | ||
35 | AT_CHECK([ | |
36 | # Test debian-binary with 2.x versions | |
37 | cp pkg-templ.deb pkg-version-2x.deb | |
38 | echo 2.999 >debian-binary | |
39 | ar rc pkg-version-2x.deb debian-binary | |
40 | ar t pkg-version-2x.deb | |
41 | ar x pkg-templ.deb debian-binary | |
42 | # XXX: Ideally we would have no need to strip trailing spaces. | |
43 | dpkg-deb -I pkg-version-2x.deb | sed -e 's/ *$//' | |
44 | ], [], [debian-binary | |
45 | control.tar | |
46 | data.tar | |
47 | new debian package, version 2.999. | |
48 | size 20674 bytes: control archive=10240 bytes. | |
49 | 193 bytes, 7 lines control | |
50 | Package: pkg-deb-format | |
51 | Version: 0.0-1 | |
52 | Section: test | |
53 | Priority: extra | |
54 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
55 | Architecture: all | |
56 | Description: test package - deb format support | |
57 | ]) | |
58 | ||
59 | AT_CHECK([ | |
60 | # Test debian-binary with extra lines | |
61 | cp pkg-templ.deb pkg-magic-extra.deb | |
62 | echo "extra line" >>debian-binary | |
63 | ar rc pkg-magic-extra.deb debian-binary | |
64 | ar t pkg-magic-extra.deb | |
65 | ar x pkg-templ.deb debian-binary | |
66 | # XXX: Ideally we would have no need to strip trailing spaces. | |
67 | dpkg-deb -I pkg-magic-extra.deb | sed -e 's/ *$//' | |
68 | ], [], [debian-binary | |
69 | control.tar | |
70 | data.tar | |
71 | new debian package, version 2.0. | |
72 | size 20684 bytes: control archive=10240 bytes. | |
73 | 193 bytes, 7 lines control | |
74 | Package: pkg-deb-format | |
75 | Version: 0.0-1 | |
76 | Section: test | |
77 | Priority: extra | |
78 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
79 | Architecture: all | |
80 | Description: test package - deb format support | |
81 | ]) | |
82 | ||
83 | AT_CHECK([ | |
84 | # Test missing debian-binary member | |
85 | cp pkg-templ.deb pkg-missing-magic.deb | |
86 | ar d pkg-missing-magic.deb debian-binary | |
87 | ar t pkg-missing-magic.deb | |
88 | dpkg-deb -I pkg-missing-magic.deb | |
89 | ], [2], [control.tar | |
90 | data.tar | |
91 | ], [dpkg-deb: error: file 'pkg-missing-magic.deb' is not a debian binary archive (try dpkg-split?) | |
92 | ]) | |
93 | ||
94 | AT_CHECK([ | |
95 | # Test missing control member | |
96 | cp pkg-templ.deb pkg-missing-control.deb | |
97 | ar d pkg-missing-control.deb control.tar | |
98 | ar t pkg-missing-control.deb | |
99 | dpkg-deb -I pkg-missing-control.deb | |
100 | ], [2], [debian-binary | |
101 | data.tar | |
102 | ], [dpkg-deb: error: archive 'pkg-missing-control.deb' has premature member 'data.tar' before 'control.tar', giving up | |
103 | ]) | |
104 | ||
105 | AT_CHECK([ | |
106 | # Test missing data member | |
107 | cp pkg-templ.deb pkg-missing-data.deb | |
108 | ar d pkg-missing-data.deb data.tar | |
109 | ar t pkg-missing-data.deb | |
110 | dpkg-deb -c pkg-missing-data.deb | |
111 | ], [2], [debian-binary | |
112 | control.tar | |
113 | ], [dpkg-deb: error: unexpected end of file in archive member header in pkg-missing-data.deb | |
114 | ]) | |
115 | ||
116 | AT_CHECK([ | |
117 | # Test mixed member (index 1) | |
118 | cp pkg-templ.deb pkg-mixed-1-member.deb | |
119 | ar ra debian-binary pkg-mixed-1-member.deb unknown | |
120 | ar t pkg-mixed-1-member.deb | |
121 | dpkg-deb -I pkg-mixed-1-member.deb | |
122 | ], [2], [debian-binary | |
123 | unknown | |
124 | control.tar | |
125 | data.tar | |
126 | ], [dpkg-deb: error: archive 'pkg-mixed-1-member.deb' has premature member 'unknown' before 'control.tar', giving up | |
127 | ]) | |
128 | ||
129 | AT_CHECK([ | |
130 | # Test mixed member (index 2) | |
131 | cp pkg-templ.deb pkg-mixed-2-member.deb | |
132 | ar ra control.tar pkg-mixed-2-member.deb unknown | |
133 | ar t pkg-mixed-2-member.deb | |
134 | dpkg-deb -c pkg-mixed-2-member.deb | |
135 | ], [2], [debian-binary | |
136 | control.tar | |
137 | unknown | |
138 | data.tar | |
139 | ], [dpkg-deb: error: archive 'pkg-mixed-2-member.deb' has premature member 'unknown' before 'data.tar', giving up | |
140 | ]) | |
141 | ||
142 | AT_CHECK([ | |
143 | # Test swapped control and data members | |
144 | cp pkg-templ.deb pkg-swap-members.deb | |
145 | ar ma data.tar pkg-swap-members.deb control.tar | |
146 | ar t pkg-swap-members.deb | |
147 | dpkg-deb -I pkg-swap-members.deb | |
148 | ], [2], [debian-binary | |
149 | data.tar | |
150 | control.tar | |
151 | ], [dpkg-deb: error: archive 'pkg-swap-members.deb' has premature member 'data.tar' before 'control.tar', giving up | |
152 | ]) | |
153 | ||
154 | AT_CHECK([ | |
155 | # Test extra member | |
156 | cp pkg-templ.deb pkg-extra-member.deb | |
157 | ar q pkg-extra-member.deb unknown | |
158 | ar t pkg-extra-member.deb | |
159 | # XXX: Ideally we would have no need to strip trailing spaces. | |
160 | dpkg-deb -I pkg-extra-member.deb | sed -e 's/ *$//' | |
161 | ], [], [debian-binary | |
162 | control.tar | |
163 | data.tar | |
164 | unknown | |
165 | new debian package, version 2.0. | |
166 | size 20732 bytes: control archive=10240 bytes. | |
167 | 193 bytes, 7 lines control | |
168 | Package: pkg-deb-format | |
169 | Version: 0.0-1 | |
170 | Section: test | |
171 | Priority: extra | |
172 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
173 | Architecture: all | |
174 | Description: test package - deb format support | |
175 | ]) | |
176 | ||
177 | AT_CHECK([ | |
178 | # Test _ member | |
179 | cp pkg-templ.deb pkg-under-member.deb | |
180 | ar ra debian-binary pkg-under-member.deb _ignore | |
181 | ar t pkg-under-member.deb | |
182 | # XXX: Ideally we would have no need to strip trailing spaces. | |
183 | dpkg-deb -I pkg-under-member.deb | sed -e 's/ *$//' | |
184 | ], [], [debian-binary | |
185 | _ignore | |
186 | control.tar | |
187 | data.tar | |
188 | new debian package, version 2.0. | |
189 | size 20732 bytes: control archive=10240 bytes. | |
190 | 193 bytes, 7 lines control | |
191 | Package: pkg-deb-format | |
192 | Version: 0.0-1 | |
193 | Section: test | |
194 | Priority: extra | |
195 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
196 | Architecture: all | |
197 | Description: test package - deb format support | |
198 | ]) | |
199 | ||
200 | AT_CHECK([ | |
201 | # Test data.tar.bad member | |
202 | dd if=/dev/zero of=data.tar.bad bs=1K count=4 status=none | |
203 | ar rc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad | |
204 | ar t pkg-data-bad.deb | |
205 | dpkg-deb -c pkg-data-bad.deb | |
206 | ], [2], [debian-binary | |
207 | control.tar.gz | |
208 | data.tar.bad | |
209 | ], [dpkg-deb: error: archive 'pkg-data-bad.deb' uses unknown compression for member 'data.tar.bad', giving up | |
210 | ]) | |
211 | ||
212 | AT_CHECK([ | |
213 | # Test control.tar member | |
214 | ar rc pkg-control-none.deb debian-binary control.tar data.tar | |
215 | ar t pkg-control-none.deb | |
216 | # XXX: Ideally we would have no need to strip trailing spaces. | |
217 | dpkg-deb -I pkg-control-none.deb | sed -e 's/ *$//' | |
218 | ], [], [debian-binary | |
219 | control.tar | |
220 | data.tar | |
221 | new debian package, version 2.0. | |
222 | size 20672 bytes: control archive=10240 bytes. | |
223 | 193 bytes, 7 lines control | |
224 | Package: pkg-deb-format | |
225 | Version: 0.0-1 | |
226 | Section: test | |
227 | Priority: extra | |
228 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
229 | Architecture: all | |
230 | Description: test package - deb format support | |
231 | ]) | |
232 | ||
233 | AT_CHECK([ | |
234 | # Test control.tar.xz member | |
235 | ar rc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz | |
236 | ar t pkg-control-xz.deb | |
237 | dpkg-deb -c pkg-control-xz.deb | |
238 | ], [], [debian-binary | |
239 | control.tar.xz | |
240 | data.tar.xz | |
241 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
242 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
243 | ]) | |
244 | ||
245 | AT_CHECK([ | |
246 | # Test data.tar member | |
247 | ar rc pkg-data-none.deb debian-binary control.tar.gz data.tar | |
248 | ar t pkg-data-none.deb | |
249 | dpkg-deb -c pkg-data-none.deb | |
250 | ], [], [debian-binary | |
251 | control.tar.gz | |
252 | data.tar | |
253 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
254 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
255 | ]) | |
256 | ||
257 | AT_CHECK([ | |
258 | # Test data.tar.gz member | |
259 | ar rc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz | |
260 | ar t pkg-data-gz.deb | |
261 | dpkg-deb -c pkg-data-gz.deb | |
262 | ], [], [debian-binary | |
263 | control.tar.gz | |
264 | data.tar.gz | |
265 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
266 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
267 | ]) | |
268 | ||
269 | AT_CHECK([ | |
270 | # Test data.tar.xz member | |
271 | ar rc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz | |
272 | ar t pkg-data-xz.deb | |
273 | dpkg-deb -c pkg-data-xz.deb | |
274 | ], [], [debian-binary | |
275 | control.tar.gz | |
276 | data.tar.xz | |
277 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
278 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
279 | ]) | |
280 | ||
281 | AT_CHECK([ | |
282 | # Test data.tar.bz2 member | |
283 | ar rc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2 | |
284 | ar t pkg-data-bz2.deb | |
285 | dpkg-deb -c pkg-data-bz2.deb | |
286 | ], [], [debian-binary | |
287 | control.tar.gz | |
288 | data.tar.bz2 | |
289 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
290 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
291 | ]) | |
292 | ||
293 | AT_CHECK([ | |
294 | # Test data.tar.lzma member | |
295 | ar rc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma | |
296 | ar t pkg-data-lzma.deb | |
297 | dpkg-deb -c pkg-data-lzma.deb | |
298 | ], [], [debian-binary | |
299 | control.tar.gz | |
300 | data.tar.lzma | |
301 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
302 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
303 | ]) | |
304 | ||
305 | AT_CHECK([ | |
306 | # Test non-uniform data.tar/control.tar member compression | |
307 | ar rc pkg-mixed-comp.deb debian-binary control.tar.xz data.tar.gz | |
308 | ar t pkg-mixed-comp.deb | |
309 | # XXX: Ideally we would have no need to strip trailing spaces. | |
310 | dpkg-deb -I pkg-mixed-comp.deb | sed -e 's/ *$//' | |
311 | dpkg-deb -c pkg-mixed-comp.deb | |
312 | ], [], [debian-binary | |
313 | control.tar.xz | |
314 | data.tar.gz | |
315 | new debian package, version 2.0. | |
316 | size 682 bytes: control archive=336 bytes. | |
317 | 193 bytes, 7 lines control | |
318 | Package: pkg-deb-format | |
319 | Version: 0.0-1 | |
320 | Section: test | |
321 | Priority: extra | |
322 | Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> | |
323 | Architecture: all | |
324 | Description: test package - deb format support | |
325 | drwxr-xr-x root/root 0 1970-01-01 00:00 ./ | |
326 | -rw-r--r-- root/root 5 1970-01-01 00:00 ./file-templ | |
327 | ]) | |
328 | ||
329 | AT_CLEANUP |