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
|
AT_SETUP([dpkg-split options])
AT_KEYWORDS([dpkg-split command-line])
AT_CHECK([dpkg-split --version], [], [ignore])
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
$PERL -E 'print "fade" foreach 1 .. 1024 * 512' >pkg-split/data-file
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 10 parts: 9 * 210 KiB B + 158 KiB)
dpkg-split -S 210 -s pkg-split.deb pkg-split-part
for p in DPKG_SEQ([10]); do
test -f pkg-split-part.${p}of10.deb
done
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [data.1])
], [], [Splitting package pkg-split into 10 parts: 1 2 3 4 5 6 7 8 9 10 done
])
DEB_SPLIT_MD5SUM=1684b6cdb72bf035ccafd653f307d3da
DEB_SPLIT_LENGTH=2109632
DEB_SPLIT_PART_LENGTH=214016
DEB_SPLIT_PART_SIZE=214222
DEB_SPLIT_LAST_LENGTH=183488
DEB_SPLIT_LAST_SIZE=183694
DEB_SPLIT_PART_SIZE_VERSION=$((DEB_SPLIT_PART_SIZE + 2))
AT_CHECK_UNQUOTED([
# Test debian-split with 2.x version
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split])
$PERL -p -i -E 's/.*/2.999/ if $. == 1' debian-split
DPKG_AR_GEN([pkg-split-part-version-2x.deb], [debian-split data.1])
DPKG_AR_LIST([pkg-split-part-version-2x.deb])
dpkg-split -I pkg-split-part-version-2x.deb
], [], [debian-split
data.1
pkg-split-part-version-2x.deb:
Part format version: 2.999
Part of package: pkg-split
... version: 0.0-1
... architecture: all
... MD5 checksum: $DEB_SPLIT_MD5SUM
... length: $DEB_SPLIT_LENGTH bytes
... split every: $DEB_SPLIT_PART_LENGTH bytes
Part number: 1/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 0 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE_VERSION bytes
])
DEB_SPLIT_PART_SIZE_MAGIC_EXTRA=$((DEB_SPLIT_PART_SIZE + 10))
AT_CHECK_UNQUOTED([
# Test debian-split with extra lines
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split])
echo "extra line" >>debian-split
DPKG_AR_GEN([pkg-split-part-magic-extra.deb], [debian-split data.1])
DPKG_AR_LIST([pkg-split-part-magic-extra.deb])
dpkg-split -I pkg-split-part-magic-extra.deb
], [], [debian-split
data.1
pkg-split-part-magic-extra.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 1/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 0 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE_MAGIC_EXTRA bytes
])
AT_CHECK([
# Test missing debian-split
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb])
DPKG_AR_GEN([pkg-split-part-missing-magic.deb], [data.1])
DPKG_AR_LIST([pkg-split-part-missing-magic.deb])
dpkg-split -I pkg-split-part-missing-magic.deb
], [], [data.1
file 'pkg-split-part-missing-magic.deb' is not an archive part
])
AT_CHECK([
# Test missing data part member
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb])
DPKG_AR_GEN([pkg-split-part-missing-data.deb], [debian-split])
DPKG_AR_LIST([pkg-split-part-missing-data.deb])
dpkg-split -I pkg-split-part-missing-data.deb
], [2], [debian-split
], [dpkg-split: error: unexpected end of file in reading data part member ar header in pkg-split-part-missing-data.deb
])
AT_CHECK([
# Test duplicate debian-split member
DPKG_AR_EXTRACT([pkg-split-part.1of10.deb], [debian-split data.1])
DPKG_AR_GEN([pkg-split-part-duplicate-magic.deb], [debian-split debian-split data.1])
DPKG_AR_LIST([pkg-split-part-duplicate-magic.deb])
dpkg-split -I pkg-split-part-duplicate-magic.deb
], [2], [debian-split
debian-split
data.1
], [dpkg-split: error: file 'pkg-split-part-duplicate-magic.deb' is corrupt - second member is not data member
])
AT_CHECK_UNQUOTED([
# Test unknown extra member
echo "some content" >unknown
DPKG_AR_GEN([pkg-split-part-extra-member.deb], [debian-split data.1 unknown])
DPKG_AR_LIST([pkg-split-part-extra-member.deb])
dpkg-split -I pkg-split-part-extra-member.deb
], [], [debian-split
data.1
unknown
pkg-split-part-extra-member.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 1/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 0 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes
])
AT_CHECK_UNQUOTED([
# Test getting information about the split parts (parsing verification)
dpkg-split -I pkg-split-part.1of10.deb
], [], [pkg-split-part.1of10.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 1/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 0 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes
])
AT_CHECK_UNQUOTED([
# Test getting information about the split parts (parsing verification)
dpkg-split -I pkg-split-part.2of10.deb
], [], [pkg-split-part.2of10.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 2/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 214016 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes
])
AT_CHECK_UNQUOTED([
# Test getting information about the split parts (parsing verification)
dpkg-split -I pkg-split-part.9of10.deb
], [], [pkg-split-part.9of10.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 9/10
Part length: $DEB_SPLIT_PART_LENGTH bytes
Part offset: 1712128 bytes
Part file size (used portion): $DEB_SPLIT_PART_SIZE bytes
])
AT_CHECK_UNQUOTED([
# Test getting information about the split parts (parsing verification)
dpkg-split -I pkg-split-part.10of10.deb
], [], [pkg-split-part.10of10.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: $DEB_SPLIT_PART_LENGTH bytes
Part number: 10/10
Part length: $DEB_SPLIT_LAST_LENGTH bytes
Part offset: 1926144 bytes
Part file size (used portion): $DEB_SPLIT_LAST_SIZE 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 10 parts: 1 2 3 4 5 6 7 8 9 10 done
])
AT_CLEANUP
|