summaryrefslogtreecommitdiffstats
path: root/t-func/deb-split.at
blob: 20a3519502170204ba7814c9d358c9d987811814 (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
AT_TESTED([dpkg-split])

AT_SETUP([dpkg-split options])
AT_KEYWORDS([dpkg-split command-line])
AT_CHECK([dpkg-split --help], [], [ignore])
AT_CLEANUP

AT_SETUP([dpkg-split .deb format])
AT_KEYWORDS([dpkg-split deb-split])

DPKG_GEN_CONTROL([pkg-split])
DPKG_MOD_CONTROL([pkg-split],
                 [s/^Description:.*$/& - normal package to be split/])
AT_CHECK([
# Initialize the template package
chmod -R u+w pkg-split
# XXX: Some environments set SIGPIPE to ignore which we cannot reset, and 'yes'
# does check print error conditions, so we ignore its error message here.
yes 2>/dev/null | dd of=pkg-split/data-file bs=1024 count=1024 status=none
find pkg-split | xargs touch -t 197001010100.00
dpkg-deb --root-owner-group -Znone -b pkg-split >/dev/null
])

AT_CHECK([
# Test splitting a package (in 3 parts: 400 KiB + 400 KiB + 224 KiB)
dpkg-split -S 400 -s pkg-split.deb pkg-split-part
test -f pkg-split-part.1of3.deb
test -f pkg-split-part.2of3.deb
test -f pkg-split-part.3of3.deb
], [], [Splitting package pkg-split into 3 parts: 1 2 3 done
])

DEB_SPLIT_MD5SUM=c669258de88761bf90ad6621bdffd6f1
DEB_SPLIT_LENGTH=1065152

AT_CHECK_UNQUOTED([
# Test getting information about the split parts (parsing verification)
dpkg-split -I pkg-split-part.1of3.deb
dpkg-split -I pkg-split-part.2of3.deb
dpkg-split -I pkg-split-part.3of3.deb
], [], [pkg-split-part.1of3.deb:
    Part format version:            2.1
    Part of package:                pkg-split
        ... version:                0.0-1
        ... architecture:           all
        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
        ... length:                 $DEB_SPLIT_LENGTH bytes
        ... split every:            408576 bytes
    Part number:                    1/3
    Part length:                    408576 bytes
    Part offset:                    0 bytes
    Part file size (used portion):  408780 bytes

pkg-split-part.2of3.deb:
    Part format version:            2.1
    Part of package:                pkg-split
        ... version:                0.0-1
        ... architecture:           all
        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
        ... length:                 $DEB_SPLIT_LENGTH bytes
        ... split every:            408576 bytes
    Part number:                    2/3
    Part length:                    408576 bytes
    Part offset:                    408576 bytes
    Part file size (used portion):  408780 bytes

pkg-split-part.3of3.deb:
    Part format version:            2.1
    Part of package:                pkg-split
        ... version:                0.0-1
        ... architecture:           all
        ... MD5 checksum:           $DEB_SPLIT_MD5SUM
        ... length:                 $DEB_SPLIT_LENGTH bytes
        ... split every:            408576 bytes
    Part number:                    3/3
    Part length:                    248000 bytes
    Part offset:                    817152 bytes
    Part file size (used portion):  248204 bytes

])

AT_CHECK([
# Test joining the split parts back together
dpkg-split -o pkg-joined.deb -j pkg-split-part.*.deb
cmp pkg-split.deb pkg-joined.deb
], [], [Putting package pkg-split together from 3 parts: 1 2 3 done
])

AT_CLEANUP