blob: b9d160af42c24f8e533c8767474e7eef2abb596e (
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
|
set -u
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf db pool
cat > conf/distributions <<EOF
Codename: n
Components: c
Architectures: a
EOF
cat > conf/options <<EOF
export silent-never
EOF
echo "fake-deb1" > fake1.deb
echo "fake-deb2" > fake2.deb
echo "fake-deb3" > fake3.deb
fakedeb1md="$(md5 fake1.deb)"
fakedeb2md="$(md5 fake2.deb)"
fakedeb3md="$(md5 fake3.deb)"
fakedeb1sha1="$(sha1 fake1.deb)"
fakedeb2sha1="$(sha1 fake2.deb)"
fakedeb3sha1="$(sha1 fake3.deb)"
fakedeb1sha2="$(sha256 fake1.deb)"
fakedeb2sha2="$(sha256 fake2.deb)"
fakedeb3sha2="$(sha256 fake3.deb)"
fakesize=10
cat > fakeindex <<EOF
Package: fake
Version: 0
Source: pseudo (9999)
Architecture: all
Filename: pool/c/p/pseudo/fake_0_all.deb
Section: base
Priority: extra
Description: test
test
Size: $fakesize
MD5Sum: $fakedeb1md
EOF
testrun - -b . -C c -A a -T deb _addpackage n fakeindex fake 3<<EOF
returns 249
stderr
*=Error: package fake version 0 lists file pool/c/p/pseudo/fake_0_all.deb not yet in the pool!
-v0*=There have been errors!
stdout
EOF
mkdir -p pool/c/p/pseudo
cp fake2.deb pool/c/p/pseudo/fake_0_all.deb
testrun - -b . _detect pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofa 'pool/c/p/pseudo/fake_0_all.deb')
-v0*=1 files were added but not used.
-v0*=The next deleteunreferenced call will delete them.
EOF
testrun - -b . -C c -A a -T deb _addpackage n fakeindex fake 3<<EOF
returns 254
stderr
*=File "pool/c/p/pseudo/fake_0_all.deb" is already registered with different checksums!
*=md5 expected: $fakedeb2md, got: $fakedeb1md
*=Error: package fake version 0 lists different checksums than in the pool!
-v0*=There have been errors!
stdout
EOF
testrun - -b . _forget pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofd 'pool/c/p/pseudo/fake_0_all.deb' false)
EOF
cp fake1.deb pool/c/p/pseudo/fake_0_all.deb
testrun - -b . _detect pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofa 'pool/c/p/pseudo/fake_0_all.deb')
-v0*=1 files were added but not used.
-v0*=The next deleteunreferenced call will delete them.
EOF
testrun - -b . -C c -A a -T deb _addpackage n fakeindex fake 3<<EOF
stdout
$(opa 'fake' '0' 'n' 'c' 'a' 'deb')
-v1*=Adding 'fake' '0' to 'n|c|a'.
EOF
testrun - -b . checkpool 3<<EOF
stderr
stdout
EOF
testrun - -b . check 3<<EOF
stderr
stdout
-v1*=Checking n...
EOF
cp fake3.deb pool/c/p/pseudo/fake_0_all.deb
testrun - -b . check 3<<EOF
stderr
stdout
-v1*=Checking n...
EOF
testrun - -b . checkpool 3<<EOF
return 254
stderr
*=WRONG CHECKSUMS of './pool/c/p/pseudo/fake_0_all.deb':
*=md5 expected: $fakedeb1md, got: $fakedeb3md
*=sha1 expected: $fakedeb1sha1, got: $fakedeb3sha1
*=sha256 expected: $fakedeb1sha2, got: $fakedeb3sha2
-v0*=There have been errors!
stdout
EOF
testrun - -b . _forget pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofd 'pool/c/p/pseudo/fake_0_all.deb' false)
EOF
testrun - -b . _detect pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofa 'pool/c/p/pseudo/fake_0_all.deb')
EOF
testrun - -b . checkpool 3<<EOF
stderr
stdout
EOF
testrun - -b . check 3<<EOF
stdout
-v1*=Checking n...
stderr
*=File "pool/c/p/pseudo/fake_0_all.deb" is already registered with different checksums!
*=md5 expected: $fakedeb3md, got: $fakedeb1md
*=Files are missing for 'fake'!
-v0*=There have been errors!
returns 254
EOF
testrun - -b . _forget pool/c/p/pseudo/fake_0_all.deb 3<<EOF
stderr
stdout
$(ofd 'pool/c/p/pseudo/fake_0_all.deb' false)
EOF
# Correct size but wrong checksum:
testrun - -b . check 3<<EOF
stdout
-v1*=Checking n...
stderr
*=Deleting unexpected file './pool/c/p/pseudo/fake_0_all.deb'!
*=(not in database and wrong in pool)
*= Missing file pool/c/p/pseudo/fake_0_all.deb
*=Files are missing for 'fake'!
-v0*=There have been errors!
returns 249
EOF
# Wrong size:
echo "Tooo long......" > pool/c/p/pseudo/fake_0_all.deb
testrun - -b . check 3<<EOF
stdout
-v1*=Checking n...
stderr
*=Deleting unexpected file './pool/c/p/pseudo/fake_0_all.deb'!
*=(not in database and wrong in pool)
*= Missing file pool/c/p/pseudo/fake_0_all.deb
*=Files are missing for 'fake'!
-v0*=There have been errors!
returns 249
EOF
cp fake1.deb pool/c/p/pseudo/fake_0_all.deb
testrun - -b . check 3<<EOF
stderr
-v0*=Warning: readded existing file 'pool/c/p/pseudo/fake_0_all.deb' mysteriously missing from the checksum database.
stdout
-v1*=Checking n...
$(ofa 'pool/c/p/pseudo/fake_0_all.deb')
stderr
EOF
testout - -b . _dumpcontents 'n|c|a' 3<<EOF
EOF
cat >results.expected << EOF
'fake' -> 'Package: fake
Version: 0
Source: pseudo (9999)
Architecture: all
Filename: pool/c/p/pseudo/fake_0_all.deb
Section: base
Priority: extra
Description: test
test
Size: $fakesize
MD5Sum: $fakedeb1md
'
EOF
dodiff results.expected results
cat results
testrun - -b . _listchecksums 3<<EOF
stdout
*=pool/c/p/pseudo/fake_0_all.deb :1:$fakedeb1sha1 :2:$fakedeb1sha2 $fakedeb1md $fakesize
stderr
EOF
dodo test ! -e dists
rm -r -f db conf pool fake*.deb fakeindex
testsuccess
|