summaryrefslogtreecommitdiffstats
path: root/src/at/deb-format.at
blob: e67ee105d900ac56608cabe591b25e8f4edee0d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
AT_SETUP([dpkg-deb options])
AT_KEYWORDS([dpkg-deb command-line])

AT_CHECK([dpkg-deb --version], [], [ignore])
AT_CHECK([dpkg-deb --help], [], [ignore])

AT_CLEANUP


AT_SETUP([dpkg-deb .deb format 0.93x])
AT_KEYWORDS([dpkg-deb deb-old])

AT_SKIP_IF([! command -v gzip >/dev/null])

AT_DATA([pkg-deb-old-bogus-only-version.deb], [0.93
])
AT_CHECK([
# Check truncated old deb w/ only version magic
dpkg-deb --info pkg-deb-old-bogus-only-version.deb
], [2], [], [dpkg-deb: error: unexpected end of file in archive control member size in pkg-deb-old-bogus-only-version.deb
])

DPKG_GEN_CONTROL([pkg-deb-old-format])
DPKG_MOD_CONTROL([pkg-deb-old-format],
                 [s/^Description:.*$/$& - deb old format support/])
AT_DATA([pkg-deb-old-format/file-templ], [test
])
AT_CHECK([
# Initialize the template package
mv pkg-deb-old-format pkg-old-templ
cp $top_srcdir/ChangeLog.old pkg-old-templ/
chmod 0644 pkg-old-templ/ChangeLog.old
chmod -R u+w pkg-old-templ
find pkg-old-templ | xargs touch -t 197001010100.00
dpkg-deb --deb-format=0.939000 --root-owner-group -b pkg-old-templ >/dev/null

dpkg-deb --ctrl-tarfile pkg-old-templ.deb >ctrl.tar
dpkg-deb --fsys-tarfile pkg-old-templ.deb >fsys.tar
gzip -n ctrl.tar
gzip -n fsys.tar

# Create deb-old 0.939
echo '0.939000' >pkg-old.deb
DPKG_FILE_SIZE([ctrl.tar.gz]) >>pkg-old.deb
cat ctrl.tar.gz >>pkg-old.deb
cat fsys.tar.gz >>pkg-old.deb

# Create deb-old-old-old 0.931
mkdir -p pkg-old-0931-templ/.DEBIAN
cp pkg-old-templ/DEBIAN/* pkg-old-0931-templ/.DEBIAN/
find pkg-old-0931-templ | xargs touch -t 197001010100.00
$TAR czf ctrl-0931.tar.gz --format=gnu --mtime @0 --clamp-mtime --owner root:0 --group root:0 -C pkg-old-0931-templ .DEBIAN

echo '0.931000' >pkg-old-0931.deb
DPKG_FILE_SIZE([ctrl-0931.tar.gz]) >>pkg-old-0931.deb
cat ctrl-0931.tar.gz >>pkg-old-0931.deb
cat fsys.tar.gz >>pkg-old-0931.deb

# Create deb-old-old template
mkdir -p pkg-old-0932-templ/DEBIAN
cp pkg-old-templ/DEBIAN/* pkg-old-0932-templ/DEBIAN/
find pkg-old-0932-templ | xargs touch -t 197001010100.00
$TAR czf ctrl-0932.tar.gz --format=gnu --mtime @0 --clamp-mtime --owner root:0 --group root:0 -C pkg-old-0932-templ DEBIAN

# Create deb-old-old 0.932
echo '0.932000' >pkg-old-0932.deb
DPKG_FILE_SIZE([ctrl-0932.tar.gz]) >>pkg-old-0932.deb
cat ctrl-0932.tar.gz >>pkg-old-0932.deb
cat fsys.tar.gz >>pkg-old-0932.deb

# Create deb-old-old 0.933
echo '0.933000' >pkg-old-0933.deb
DPKG_FILE_SIZE([ctrl-0932.tar.gz]) >>pkg-old-0933.deb
cat ctrl-0932.tar.gz >>pkg-old-0933.deb
cat fsys.tar.gz >>pkg-old-0933.deb
])

DEB_OLD_CTRL_SIZE=$(DPKG_FILE_SIZE([ctrl.tar.gz]))
DEB_OLD_FSYS_SIZE=$(DPKG_FILE_SIZE([fsys.tar.gz]))
DEB_OLD_SIZE=$(DPKG_FILE_SIZE([pkg-old.deb]))

AT_CHECK_UNQUOTED([
# Check old package metadata
dpkg-deb -I pkg-old.deb
], [], [ old Debian package, version 0.939000.
 size $DEB_OLD_SIZE bytes: control archive=$DEB_OLD_CTRL_SIZE, main archive=$DEB_OLD_FSYS_SIZE.
     201 bytes,     7 lines      control
 Package: pkg-deb-old-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb old format support
])

DEB_OLD_0931_SIZE=$(DPKG_FILE_SIZE([pkg-old-0931.deb]))
DEB_OLD_0931_CTRL_SIZE=$(DPKG_FILE_SIZE([ctrl-0931.tar.gz]))

AT_CHECK_UNQUOTED([
# Check old package metadata
dpkg-deb -I pkg-old-0931.deb
], [], [ old Debian package, version 0.931000.
 size $DEB_OLD_0931_SIZE bytes: control archive=$DEB_OLD_0931_CTRL_SIZE, main archive=$DEB_OLD_FSYS_SIZE.
     201 bytes,     7 lines      control
 Package: pkg-deb-old-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb old format support
])

DEB_OLD_0932_SIZE=$(DPKG_FILE_SIZE([pkg-old-0932.deb]))
DEB_OLD_0932_CTRL_SIZE=$(DPKG_FILE_SIZE([ctrl-0932.tar.gz]))

AT_CHECK_UNQUOTED([
# Check old package metadata
dpkg-deb -I pkg-old-0932.deb
], [], [ old Debian package, version 0.932000.
 size $DEB_OLD_0932_SIZE bytes: control archive=$DEB_OLD_0932_CTRL_SIZE, main archive=$DEB_OLD_FSYS_SIZE.
     201 bytes,     7 lines      control
 Package: pkg-deb-old-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb old format support
])

DEB_OLD_0933_SIZE=$(DPKG_FILE_SIZE([pkg-old-0933.deb]))
DEB_OLD_0933_CTRL_SIZE=$DEB_OLD_0932_CTRL_SIZE

AT_CHECK_UNQUOTED([
# Check old package metadata
dpkg-deb -I pkg-old-0933.deb
], [], [ old Debian package, version 0.933000.
 size $DEB_OLD_0933_SIZE bytes: control archive=$DEB_OLD_0933_CTRL_SIZE, main archive=$DEB_OLD_FSYS_SIZE.
     201 bytes,     7 lines      control
 Package: pkg-deb-old-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb old format support
])

AT_CHECK([
# Check old package contents
dpkg-deb -c pkg-old.deb
], [], [drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Check old package contents
dpkg-deb -c pkg-old-0931.deb
], [], [drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Check old package contents
dpkg-deb -c pkg-old-0932.deb
], [], [drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Check old package contents
dpkg-deb -c pkg-old-0933.deb
], [], [drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CLEANUP

m4_define([DPKG_GEN_PKG_DEB_FORMAT_TEMPL], [
  DPKG_GEN_CONTROL([pkg-deb-format])
  DPKG_MOD_CONTROL([pkg-deb-format],
                   [s/^Description:.*$/$& - deb format support/])
  AT_DATA([pkg-deb-format/file-templ], [test
])
  AT_CHECK([
  # Initialize the template package
  mv pkg-deb-format pkg-templ
  cp $top_srcdir/ChangeLog.old pkg-templ/
  chmod 0644 pkg-templ/ChangeLog.old
  chmod -R u+w pkg-templ
  find pkg-templ | xargs touch -t 197001010100.00
  dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ >/dev/null

  # Extract the base members
  ar x pkg-templ.deb
  gzip -cn control.tar >control.tar.gz
  gzip -cn data.tar >data.tar.gz
  ])
])


AT_SETUP([dpkg-deb .deb format 2.x (core)])
AT_KEYWORDS([dpkg-deb deb])

AT_SKIP_IF([! command -v gzip >/dev/null])

AT_DATA([pkg-deb-bogus-empty.deb], [])
AT_CHECK([
# Check truncated deb w/ 0 size
dpkg-deb --info pkg-deb-bogus-empty.deb
], [2], [], [dpkg-deb: error: unexpected end of file in archive magic version number in pkg-deb-bogus-empty.deb
])

AT_DATA([unknown], [])

DPKG_GEN_PKG_DEB_FORMAT_TEMPL()

AT_CHECK([
# Test debian-binary with 2.x versions
echo 2.999 >debian-binary
ar qSc pkg-version-2x.deb debian-binary control.tar data.tar
ar t pkg-version-2x.deb
ar x pkg-templ.deb debian-binary
dpkg-deb -I pkg-version-2x.deb
], [], [debian-binary
control.tar
data.tar
 new Debian package, version 2.999.
 size 655554 bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
])

AT_CHECK([
# Test debian-binary with extra lines
echo "extra line" >>debian-binary
ar qSc pkg-magic-extra.deb debian-binary control.tar data.tar
ar t pkg-magic-extra.deb
ar x pkg-templ.deb debian-binary
dpkg-deb -I pkg-magic-extra.deb
], [], [debian-binary
control.tar
data.tar
 new Debian package, version 2.0.
 size 655564 bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
])

AT_CHECK([
# Test missing debian-binary member
cp pkg-templ.deb pkg-missing-magic.deb
ar d pkg-missing-magic.deb debian-binary
ar t pkg-missing-magic.deb
dpkg-deb -I pkg-missing-magic.deb
], [2], [control.tar
data.tar
], [dpkg-deb: error: file 'pkg-missing-magic.deb' is not a Debian binary archive (try dpkg-split?)
])

AT_CHECK([
# Test missing control member
cp pkg-templ.deb pkg-missing-control.deb
ar d pkg-missing-control.deb control.tar
ar t pkg-missing-control.deb
dpkg-deb -I pkg-missing-control.deb
], [2], [debian-binary
data.tar
], [dpkg-deb: error: archive 'pkg-missing-control.deb' has premature member 'data.tar' before 'control.tar', giving up
])

AT_CHECK([
# Test missing data member
cp pkg-templ.deb pkg-missing-data.deb
ar d pkg-missing-data.deb data.tar
ar t pkg-missing-data.deb
dpkg-deb -c pkg-missing-data.deb
], [2], [debian-binary
control.tar
], [dpkg-deb: error: unexpected end of file in archive member header in pkg-missing-data.deb
])

AT_CHECK([
# Test duplicate debian-binary member
ar qSc pkg-duplicate-magic.deb debian-binary debian-binary control.tar data.tar
ar t pkg-duplicate-magic.deb
dpkg-deb -I pkg-duplicate-magic.deb
], [2], [debian-binary
debian-binary
control.tar
data.tar
], [dpkg-deb: error: archive 'pkg-duplicate-magic.deb' has premature member 'debian-binary' before 'control.tar', giving up
])

AT_CHECK([
# Test duplicate control member
ar qSc pkg-duplicate-control.deb debian-binary control.tar control.tar data.tar
ar t pkg-duplicate-control.deb
dpkg-deb -c pkg-duplicate-control.deb
], [2], [debian-binary
control.tar
control.tar
data.tar
], [dpkg-deb: error: archive 'pkg-duplicate-control.deb' contains two control members, giving up
])

AT_CHECK([
# Test mixed member (index 1)
ar qSc pkg-mixed-1-member.deb debian-binary unknown control.tar data.tar
ar t pkg-mixed-1-member.deb
dpkg-deb -I pkg-mixed-1-member.deb
], [2], [debian-binary
unknown
control.tar
data.tar
], [dpkg-deb: error: archive 'pkg-mixed-1-member.deb' has premature member 'unknown' before 'control.tar', giving up
])

AT_CHECK([
# Test mixed member (index 2)
ar qSc pkg-mixed-2-member.deb debian-binary control.tar unknown data.tar
ar t pkg-mixed-2-member.deb
dpkg-deb -c pkg-mixed-2-member.deb
], [2], [debian-binary
control.tar
unknown
data.tar
], [dpkg-deb: error: archive 'pkg-mixed-2-member.deb' has premature member 'unknown' before 'data.tar', giving up
])

AT_CHECK([
# Test swapped control and data members
cp pkg-templ.deb pkg-swap-members.deb
ar ma data.tar pkg-swap-members.deb control.tar
ar t pkg-swap-members.deb
dpkg-deb -I pkg-swap-members.deb
], [2], [debian-binary
data.tar
control.tar
], [dpkg-deb: error: archive 'pkg-swap-members.deb' has premature member 'data.tar' before 'control.tar', giving up
])

AT_CHECK([
# Test extra member
cp pkg-templ.deb pkg-extra-member.deb
ar qS pkg-extra-member.deb unknown
ar t pkg-extra-member.deb
dpkg-deb -I pkg-extra-member.deb
], [], [debian-binary
control.tar
data.tar
unknown
 new Debian package, version 2.0.
 size 655612 bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
])

AT_DATA([_ignore], [])
AT_CHECK([
# Test _ member
ar qSc pkg-under-member.deb debian-binary _ignore control.tar data.tar
ar t pkg-under-member.deb
dpkg-deb -I pkg-under-member.deb
], [], [debian-binary
_ignore
control.tar
data.tar
 new Debian package, version 2.0.
 size 655612 bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
])

AT_CHECK([
# Test data.tar.bad member
$PERL -E 'print "\0" x 4096' >data.tar.bad
ar qSc pkg-data-bad.deb debian-binary control.tar.gz data.tar.bad
ar t pkg-data-bad.deb
dpkg-deb -c pkg-data-bad.deb
], [2], [debian-binary
control.tar.gz
data.tar.bad
], [dpkg-deb: error: archive 'pkg-data-bad.deb' uses unknown compression for member 'data.tar.bad', giving up
])

AT_CHECK([
# Test control.tar member
ar qSc pkg-control-none.deb debian-binary control.tar data.tar
ar t pkg-control-none.deb
dpkg-deb -I pkg-control-none.deb
], [], [debian-binary
control.tar
data.tar
 new Debian package, version 2.0.
 size 655552 bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
])

AT_CHECK([
# Test data.tar member
ar qSc pkg-data-none.deb debian-binary control.tar.gz data.tar
ar t pkg-data-none.deb
dpkg-deb -c pkg-data-none.deb
], [], [debian-binary
control.tar.gz
data.tar
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test data.tar.gz member
ar qSc pkg-data-gz.deb debian-binary control.tar.gz data.tar.gz
ar t pkg-data-gz.deb
dpkg-deb -c pkg-data-gz.deb
], [], [debian-binary
control.tar.gz
data.tar.gz
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

# Create .deb with non-uniform data.tar/control.tar member compression
ar qSc pkg-mixed-comp.deb debian-binary control.tar data.tar.gz
DEB_MIXED_COMP_SIZE=$(DPKG_FILE_SIZE([pkg-mixed-comp.deb]))

AT_CHECK_UNQUOTED([
# Test non-uniform data.tar/control.tar member compression
ar t pkg-mixed-comp.deb
dpkg-deb -I pkg-mixed-comp.deb
dpkg-deb -c pkg-mixed-comp.deb
], [], [debian-binary
control.tar
data.tar.gz
 new Debian package, version 2.0.
 size $DEB_MIXED_COMP_SIZE bytes: control archive=10240 bytes.
     193 bytes,     7 lines      control
 Package: pkg-deb-format
 Version: 0.0-1
 Section: test
 Priority: extra
 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
 Architecture: all
 Description: test package - deb format support
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test building and extracting none compressed archive
dpkg-deb --uniform-compression --root-owner-group -Znone -b pkg-templ pkg-comp-none.deb >/dev/null
dpkg-deb --ctrl-tarfile pkg-comp-none.deb >ctrl-none.tar
dpkg-deb --fsys-tarfile pkg-comp-none.deb >fsys-none.tar
cmp ctrl-none.tar control.tar
cmp fsys-none.tar data.tar
])

AT_CHECK([
# Test building and extracting gzip compressed archive
dpkg-deb --uniform-compression --root-owner-group -Zgzip -b pkg-templ pkg-comp-gzip.deb >/dev/null
dpkg-deb --ctrl-tarfile pkg-comp-gzip.deb >ctrl-gzip.tar
dpkg-deb --fsys-tarfile pkg-comp-gzip.deb >fsys-gzip.tar
cmp ctrl-gzip.tar control.tar
cmp fsys-gzip.tar data.tar
])

AT_CLEANUP


AT_SETUP([dpkg-deb .deb format 2.x (xz)])
AT_KEYWORDS([dpkg-deb deb])

AT_SKIP_IF([! command -v gzip >/dev/null])
AT_SKIP_IF([! command -v xz >/dev/null])

DPKG_GEN_PKG_DEB_FORMAT_TEMPL()
AT_CHECK([
# Extract the base members
xz -c control.tar >control.tar.xz
xz -c data.tar >data.tar.xz
])

AT_CHECK([
# Test control.tar.xz member
ar qSc pkg-control-xz.deb debian-binary control.tar.xz data.tar.xz
ar t pkg-control-xz.deb
dpkg-deb -c pkg-control-xz.deb
], [], [debian-binary
control.tar.xz
data.tar.xz
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test data.tar.xz member
ar qSc pkg-data-xz.deb debian-binary control.tar.gz data.tar.xz
ar t pkg-data-xz.deb
dpkg-deb -c pkg-data-xz.deb
], [], [debian-binary
control.tar.gz
data.tar.xz
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test building and extracting xz compressed archive
dpkg-deb --uniform-compression --root-owner-group -Zxz -b pkg-templ pkg-comp-xz.deb >/dev/null
dpkg-deb --ctrl-tarfile pkg-comp-xz.deb >ctrl-xz.tar
dpkg-deb --fsys-tarfile pkg-comp-xz.deb >fsys-xz.tar
cmp ctrl-xz.tar control.tar
cmp fsys-xz.tar data.tar
])

AT_CLEANUP


AT_SETUP([dpkg-deb .deb format 2.x (zstd)])
AT_KEYWORDS([dpkg-deb deb])

AT_SKIP_IF([! command -v gzip >/dev/null])
AT_SKIP_IF([! command -v zstd >/dev/null])

DPKG_GEN_PKG_DEB_FORMAT_TEMPL()
AT_CHECK([
# Extract the base members
zstd -c control.tar >control.tar.zst
zstd -c data.tar >data.tar.zst
])

AT_CHECK([
# Test control.tar.zst member
ar qSc pkg-control-zst.deb debian-binary control.tar.zst data.tar.zst
ar t pkg-control-zst.deb
dpkg-deb -c pkg-control-zst.deb
], [], [debian-binary
control.tar.zst
data.tar.zst
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test data.tar.zst member
ar qSc pkg-data-zst.deb debian-binary control.tar.gz data.tar.zst
ar t pkg-data-zst.deb
dpkg-deb -c pkg-data-zst.deb
], [], [debian-binary
control.tar.gz
data.tar.zst
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CHECK([
# Test building and extracting zstd compressed archive
dpkg-deb --uniform-compression --root-owner-group -Zzstd -b pkg-templ pkg-comp-zstd.deb >/dev/null
dpkg-deb --ctrl-tarfile pkg-comp-zstd.deb >ctrl-zstd.tar
dpkg-deb --fsys-tarfile pkg-comp-zstd.deb >fsys-zstd.tar
cmp ctrl-zstd.tar control.tar
cmp fsys-zstd.tar data.tar
])

AT_CLEANUP


AT_SETUP([dpkg-deb .deb format 2.x (bzip2)])
AT_KEYWORDS([dpkg-deb deb])

AT_SKIP_IF([! command -v gzip >/dev/null])
AT_SKIP_IF([! command -v bzip2 >/dev/null])

DPKG_GEN_PKG_DEB_FORMAT_TEMPL()
AT_CHECK([
# Extract the base members
bzip2 -c data.tar >data.tar.bz2
])

AT_CHECK([
# Test data.tar.bz2 member
ar qSc pkg-data-bz2.deb debian-binary control.tar.gz data.tar.bz2
ar t pkg-data-bz2.deb
dpkg-deb -c pkg-data-bz2.deb
], [], [debian-binary
control.tar.gz
data.tar.bz2
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CLEANUP


AT_SETUP([dpkg-deb .deb format 2.x (lzma)])
AT_KEYWORDS([dpkg-deb deb])

AT_SKIP_IF([! command -v gzip >/dev/null])
AT_SKIP_IF([! command -v lzma >/dev/null])

DPKG_GEN_PKG_DEB_FORMAT_TEMPL()
AT_CHECK([
# Extract the base members
lzma -c data.tar >data.tar.lzma
])

AT_CHECK([
# Test data.tar.lzma member
ar qSc pkg-data-lzma.deb debian-binary control.tar.gz data.tar.lzma
ar t pkg-data-lzma.deb
dpkg-deb -c pkg-data-lzma.deb
], [], [debian-binary
control.tar.gz
data.tar.lzma
drwxr-xr-x root/root         0 1970-01-01 00:00 ./
-rw-r--r-- root/root    641345 1970-01-01 00:00 ./ChangeLog.old
-rw-r--r-- root/root         5 1970-01-01 00:00 ./file-templ
])

AT_CLEANUP