summaryrefslogtreecommitdiffstats
path: root/tests/descriptions.test
blob: d751375b56c00d419d0355b3b6c1ffdc7d29a9d9 (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
set -u
. "$TESTSDIR"/test.inc

dodo test ! -d db
mkdir -p conf
cat > conf/distributions <<EOF
Codename: 1234
Components: a
UDebComponents: a
Architectures: abacus source
UDebIndices: Packages .
DebIndices: Packages .
DscIndices: Sources .

Codename: 4321
Components: a
UDebComponents: a
Architectures: abacus source
UDebIndices: Packages .
DebIndices: Packages .
DscIndices: Sources .
EOF

testrun - -b . export 3<<EOF
stderr
stdout
$(odb)
-v1*=Exporting 1234...
-v2*=Created directory "./dists"
-v2*=Created directory "./dists/1234"
-v2*=Created directory "./dists/1234/a"
-v2*=Created directory "./dists/1234/a/binary-abacus"
-v6*= exporting '1234|a|abacus'...
-v6*=  creating './dists/1234/a/binary-abacus/Packages' (uncompressed)
-v2*=Created directory "./dists/1234/a/debian-installer"
-v2*=Created directory "./dists/1234/a/debian-installer/binary-abacus"
-v6*= exporting 'u|1234|a|abacus'...
-v6*=  creating './dists/1234/a/debian-installer/binary-abacus/Packages' (uncompressed)
-v2*=Created directory "./dists/1234/a/source"
-v6*= exporting '1234|a|source'...
-v6*=  creating './dists/1234/a/source/Sources' (uncompressed)
-v1*=Exporting 4321...
-v2*=Created directory "./dists/4321"
-v2*=Created directory "./dists/4321/a"
-v2*=Created directory "./dists/4321/a/binary-abacus"
-v6*= exporting '4321|a|abacus'...
-v6*=  creating './dists/4321/a/binary-abacus/Packages' (uncompressed)
-v2*=Created directory "./dists/4321/a/debian-installer"
-v2*=Created directory "./dists/4321/a/debian-installer/binary-abacus"
-v6*= exporting 'u|4321|a|abacus'...
-v6*=  creating './dists/4321/a/debian-installer/binary-abacus/Packages' (uncompressed)
-v2*=Created directory "./dists/4321/a/source"
-v6*= exporting '4321|a|source'...
-v6*=  creating './dists/4321/a/source/Sources' (uncompressed)
EOF

mkdir i
(cd i ; PACKAGE=hello EPOCH="" VERSION=1 REVISION="" SECTION="base" genpackage.sh)

testrun - -b . -C a includedeb 1234 i/hello_1_abacus.deb 3<<EOF
stdout
-v9*=Adding reference to 'pool/a/h/hello/hello_1_abacus.deb' by '1234|a|abacus'
-v2*=Created directory "./pool"
-v2*=Created directory "./pool/a"
-v2*=Created directory "./pool/a/h"
-v2*=Created directory "./pool/a/h/hello"
$(ofa 'pool/a/h/hello/hello_1_abacus.deb')
$(opa 'hello' 1 '1234' 'a' 'abacus' 'deb')
-v0*=Exporting indices...
-v6*= looking for changes in '1234|a|abacus'...
-v6*=  replacing './dists/1234/a/binary-abacus/Packages' (uncompressed)
-v6*= looking for changes in '1234|a|source'...
-v6*= looking for changes in 'u|1234|a|abacus'...
EOF

cp dists/1234/a/binary-abacus/Packages i/mangled
sed -i -e "s/^ blub/Description-md5: 29e34048cfd56bbec39e6997af9c7057/" i/mangled

testrun - -b . -T deb -A abacus -C a _addpackage 4321 i/mangled hello 3<<EOF
stdout
-v1*=Adding 'hello' '1' to '4321|a|abacus'.
-v9*=Adding reference to 'pool/a/h/hello/hello_1_abacus.deb' by '4321|a|abacus'
$(opa 'hello' 1 '4321' 'a' 'abacus' 'deb')
-v0*=Exporting indices...
-v6*= looking for changes in '4321|a|abacus'...
-v6*=  replacing './dists/4321/a/binary-abacus/Packages' (uncompressed)
-v6*= looking for changes in '4321|a|source'...
-v6*= looking for changes in 'u|4321|a|abacus'...
EOF

dbversion="$(sed -n -e 's/^b\(db[0-9]\+\.[0-9]\+\)\.0$/\1/p;T;q' db/version)"

dodo ${dbversion}_dump -p -f db/packages.dump db/packages.db
dodo sed -e 's/\\0a blub\\0a/\\0aDescription-md5: 29e34048cfd56bbec39e6997af9c7057\\0a/' -i db/packages.dump
dodo ${dbversion}_load -f db/packages.dump db/packages.db

testrun - -b . export 4321 3<<EOF
stdout
-v0*=Exporting 4321...
-v6*= exporting '4321|a|abacus'...
-v6*=  replacing './dists/4321/a/binary-abacus/Packages' (uncompressed)
-v6*= exporting '4321|a|source'...
-v6*=  replacing './dists/4321/a/source/Sources' (uncompressed)
-v6*= exporting 'u|4321|a|abacus'...
-v6*=  replacing './dists/4321/a/debian-installer/binary-abacus/Packages' (uncompressed)
EOF

if diff dists/1234/a/binary-abacus/Packages dists/4321/a/binary-abacus/Packages  ; then
	echo "Failed to include Description-md5 for test" 2>&1
	exit 1
fi

testrun - -b . repairdescriptions 4321 3<<EOF
stdout
-v1*=Looking for 'Description's to repair in 4321...
-v3*=Redoing checksum information for packages in '4321|a|abacus'...
-v3*=Redoing checksum information for packages in 'u|4321|a|abacus'...
-v0*=Fixing description for 'hello'...
-v0*=Exporting indices...
-v6*= looking for changes in '4321|a|abacus'...
-v6*=  replacing './dists/4321/a/binary-abacus/Packages' (uncompressed)
-v6*= looking for changes in '4321|a|source'...
-v6*= looking for changes in 'u|4321|a|abacus'...
EOF

dodiff dists/1234/a/binary-abacus/Packages dists/4321/a/binary-abacus/Packages

dodo ${dbversion}_load -f db/packages.dump db/packages.db

rm pool/a/h/hello/hello_1_abacus.deb

testrun - -b . repairdescriptions 4321 3<<EOF
stdout
-v1*=Looking for 'Description's to repair in 4321...
-v3*=Redoing checksum information for packages in '4321|a|abacus'...
-v3*=Redoing checksum information for packages in 'u|4321|a|abacus'...
stderr
*=Error 2 opening ./pool/a/h/hello/hello_1_abacus.deb: No such file or directory
*=Cannot retrieve long description for package 'hello' out of package's files!
EOF

rm -r -f db conf dists pool i
testsuccess