]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-758153-versioned-provides-support
refactor EDSP classes for better internal reuse
[apt.git] / test / integration / test-bug-758153-versioned-provides-support
CommitLineData
40faab46
DK
1#!/bin/sh
2set -e
3
4# dpkg implements versioned provides in commit 5bb02fe80e9f40dcad9703a72f67cf615ff217b5
5# but previous versions seem to allow parsing, working and ignoring it.
6
3abb6a6a
DK
7TESTDIR="$(readlink -f "$(dirname "$0")")"
8. "$TESTDIR/framework"
40faab46
DK
9setupenvironment
10configarchitecture 'amd64' 'i386'
11
12insertinstalledpackage 'webapp' 'all' '1' 'Depends: httpd'
13insertinstalledpackage 'webserver' 'all' '1' 'Provides: httpd'
14
15insertpackage 'unstable' 'webapp' 'all' '2' 'Depends: httpd (>= 2)'
16insertpackage 'unstable' 'webserver' 'amd64' '2' 'Provides: httpd (= 2)'
17insertpackage 'unstable' 'foreign-webserver' 'i386' '2' 'Multi-Arch: foreign
18Provides: httpd (= 2)'
19
20insertpackage 'experimental' 'webapp' 'all' '3' 'Depends: httpd (>= 1.5)'
21insertpackage 'experimental' 'webserver' 'amd64' '3' 'Provides: httpd (= 3)'
22
23insertpackage 'experimental' 'foreign-webserver' 'i386' '4' 'Multi-Arch: foreign
24Provides: httpd (= 4)'
25insertpackage 'experimental' 'cool-webapp' 'all' '4' 'Depends: httpd (>= 4)'
26
25b86db1
DK
27# arch-qualified provides, see #777071
28insertpackage 'unstable' 'foo' 'all' '1' 'Provides: bar:i386'
29insertpackage 'unstable' 'baz' 'i386,amd64' '1' 'Depends: bar'
30insertpackage 'experimental' 'baz' 'i386,amd64' '2' 'Depends: bar:i386'
31insertpackage 'experimental' 'baz-broken' 'i386' '2' 'Depends: bar:amd64'
32
ecc138f8
DK
33insertpackage 'unstable' 'next' 'amd64' '1' 'Multi-Arch: foreign
34Provides: next (= 2)'
35insertpackage 'unstable' 'needsrealnext' 'amd64,i386' '2' 'Depends: next (>= 2)'
36
37insertpackage 'unstable' 'virtualnext2' 'amd64' '1' 'Multi-Arch: foreign
38Provides: next2 (= 2)'
39insertpackage 'unstable' 'needsnext2' 'amd64,i386' '2' 'Depends: next2 (>= 2)'
40
41insertpackage 'unstable' 'virtualnext3' 'amd64' '1' 'Multi-Arch: no
42Provides: next3 (= 2)'
43insertpackage 'unstable' 'needsnext3' 'amd64,i386' '2' 'Depends: next3 (>= 2)'
44
b755de25
DK
45insertpackage 'unstable' 'selfprov' 'amd64' '2' 'Provides: selfprov (= 1)'
46insertpackage 'unstable' 'needsselfprov1' 'amd64' '1' 'Depends: selfprov (= 1)'
47insertpackage 'unstable' 'needsselfprov2' 'amd64' '1' 'Depends: selfprov (= 2)'
48insertpackage 'unstable' 'needsselfprov12' 'amd64' '1' 'Depends: selfprov (= 1), selfprov (= 2)'
49insertpackage 'unstable' 'needsselfprov123' 'amd64' '1' 'Depends: selfprov (= 1), selfprov (= 2), selfprov (= 3)'
50
40faab46
DK
51setupaptarchive
52
2c53226b
DK
53SOMEPACKAGESCOULDNOT='Some packages could not be installed. This may mean that you have
54requested an impossible situation or if you are using the unstable
55distribution that some required packages have not yet been created
56or been moved out of Incoming.
57The following information may help to resolve the situation:
58
59The following packages have unmet dependencies:'
60
61for binary in 'aptget' 'apt'; do
62 for method in 'upgrade' 'dist-upgrade'; do
63 for solver in 'internal' 'apt'; do
64 if [ "$solver" = 'apt' ]; then
65 HEADER='Execute external solver...'
66 else
67 HEADER='Calculating upgrade...'
68 fi
69 testsuccessequal "Reading package lists...
40faab46 70Building dependency tree...
2c53226b 71$HEADER
40faab46
DK
72The following packages will be upgraded:
73 webapp webserver
742 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
75Inst webserver [1] (2 unstable [amd64])
76Inst webapp [1] (2 unstable [all])
77Conf webserver (2 unstable [amd64])
2c53226b
DK
78Conf webapp (2 unstable [all])" $binary $method -s --solver $solver
79 done
80 done
81done
82
83for solver in 'internal' 'apt'; do
84 msgmsg 'Testing with solver' "$solver"
85 HEADER_PRE='Reading package lists...
86Building dependency tree...'
87 HEADER_POST='Execute external solver...'
88 HEADER="${HEADER_PRE}"
89 if [ "$solver" = 'apt' ]; then
90 HEADER="${HEADER}
91${HEADER_POST}"
92 fi
93 testsuccessequal "$HEADER
40faab46
DK
94The following packages will be upgraded:
95 webapp webserver
962 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
97Inst webserver [1] (2 unstable [amd64])
98Inst webapp [1] (2 unstable [all])
99Conf webserver (2 unstable [amd64])
2c53226b 100Conf webapp (2 unstable [all])" aptget install webapp webserver -s --solver $solver
40faab46 101
2c53226b 102 testsuccessequal "$HEADER
40faab46
DK
103The following packages will be upgraded:
104 webapp webserver
1052 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
106Inst webserver [1] (2 unstable [amd64])
107Inst webapp [1] (3 experimental [all])
108Conf webserver (2 unstable [amd64])
2c53226b 109Conf webapp (3 experimental [all])" aptget install webapp=3 webserver -s --solver $solver
40faab46 110
2c53226b 111 testsuccessequal "$HEADER
40faab46
DK
112The following packages will be upgraded:
113 webapp webserver
1142 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
115Inst webserver [1] (3 experimental [amd64])
116Inst webapp [1] (2 unstable [all])
117Conf webserver (3 experimental [amd64])
2c53226b 118Conf webapp (2 unstable [all])" aptget install webapp webserver=3 -s --solver $solver
40faab46 119
2c53226b 120 testsuccessequal "$HEADER
40faab46
DK
121The following NEW packages will be installed:
122 foreign-webserver:i386
123The following packages will be upgraded:
124 webapp
1251 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
126Inst foreign-webserver:i386 (2 unstable [i386])
127Inst webapp [1] (2 unstable [all])
128Conf foreign-webserver:i386 (2 unstable [i386])
2c53226b 129Conf webapp (2 unstable [all])" aptget install webapp foreign-webserver:i386 -s --solver $solver
40faab46 130
2c53226b 131 testsuccessequal "$HEADER
40faab46
DK
132The following NEW packages will be installed:
133 foreign-webserver:i386
134The following packages will be upgraded:
135 webapp
1361 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
137Inst foreign-webserver:i386 (2 unstable [i386])
138Inst webapp [1] (3 experimental [all])
139Conf foreign-webserver:i386 (2 unstable [i386])
2c53226b 140Conf webapp (3 experimental [all])" aptget install webapp=3 foreign-webserver:i386 -s --solver $solver
40faab46 141
2c53226b 142 testsuccessequal "$HEADER
40faab46
DK
143The following NEW packages will be installed:
144 foreign-webserver:i386
145The following packages will be upgraded:
146 webapp
1471 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
148Inst foreign-webserver:i386 (4 experimental [i386])
149Inst webapp [1] (2 unstable [all])
150Conf foreign-webserver:i386 (4 experimental [i386])
2c53226b 151Conf webapp (2 unstable [all])" aptget install webapp foreign-webserver:i386=4 -s --solver $solver
40faab46 152
2c53226b
DK
153 if [ "$solver" = 'apt' ]; then
154 WEBAPP_ERR="$HEADER
155The solver encountered an error of type: ERR_UNSOLVABLE
156The following information might help you to understand what is wrong:
40faab46
DK
157The following packages have unmet dependencies:
158 cool-webapp : Depends: httpd (>= 4)
40faab46 159
2c53226b
DK
160$SOMEPACKAGESCOULDNOT
161 cool-webapp : Depends: httpd (>= 4)
162E: External solver failed with: The following packages have unmet dependencies:"
163 else
164 WEBAPP_ERR="$HEADER
165$SOMEPACKAGESCOULDNOT
40faab46 166 cool-webapp : Depends: httpd (>= 4)
2c53226b
DK
167E: Unable to correct problems, you have held broken packages."
168 fi
169 testfailureequal "$WEBAPP_ERR" aptget install cool-webapp -s --solver $solver
170 testfailureequal "$WEBAPP_ERR" aptget install cool-webapp foreign-webserver:i386 -s --solver $solver
40faab46 171
2c53226b 172 testsuccessequal "$HEADER
40faab46
DK
173The following NEW packages will be installed:
174 cool-webapp foreign-webserver:i386
1750 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
176Inst foreign-webserver:i386 (4 experimental [i386])
177Inst cool-webapp (4 experimental [all])
178Conf foreign-webserver:i386 (4 experimental [i386])
2c53226b 179Conf cool-webapp (4 experimental [all])" aptget install cool-webapp foreign-webserver:i386=4 -s --solver $solver
25b86db1 180
2c53226b 181 testsuccessequal "$HEADER
e7ebb414 182The following additional packages will be installed:
25b86db1
DK
183 foo
184The following NEW packages will be installed:
185 baz:i386 foo
1860 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
187Inst foo (1 unstable [all])
188Inst baz:i386 (1 unstable [i386])
189Conf foo (1 unstable [all])
2c53226b 190Conf baz:i386 (1 unstable [i386])" aptget install baz:i386 -s --solver $solver
25b86db1 191
2c53226b
DK
192 if [ "$solver" = 'apt' ]; then
193 testfailureequal "$HEADER
194The solver encountered an error of type: ERR_UNSOLVABLE
195The following information might help you to understand what is wrong:
25b86db1
DK
196The following packages have unmet dependencies:
197 baz : Depends: bar but it is not installable
25b86db1 198
2c53226b
DK
199$SOMEPACKAGESCOULDNOT
200 baz : Depends: bar but it is not installable
201E: External solver failed with: The following packages have unmet dependencies:" aptget install baz:amd64 -s --solver $solver
202 else
203 testfailureequal "$HEADER
204$SOMEPACKAGESCOULDNOT
205 baz : Depends: bar but it is not installable
206E: Unable to correct problems, you have held broken packages." aptget install baz:amd64 -s --solver $solver
207 fi
208
209 HEADER="${HEADER_PRE}
210Selected version '2' (experimental [amd64]) for 'baz'"
211 if [ "$solver" = 'apt' ]; then
212 HEADER="${HEADER}
213${HEADER_POST}"
214 fi
215 testsuccessequal "$HEADER
e7ebb414 216The following additional packages will be installed:
25b86db1
DK
217 foo
218The following NEW packages will be installed:
219 baz foo
2200 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
221Inst foo (1 unstable [all])
222Inst baz (2 experimental [amd64])
223Conf foo (1 unstable [all])
2c53226b
DK
224Conf baz (2 experimental [amd64])" aptget install baz/experimental -s --solver $solver
225
226 HEADER="${HEADER_PRE}
227Selected version '2' (experimental [i386]) for 'baz:i386'"
228 if [ "$solver" = 'apt' ]; then
229 HEADER="${HEADER}
230${HEADER_POST}"
231 fi
232 testsuccessequal "$HEADER
e7ebb414 233The following additional packages will be installed:
25b86db1
DK
234 foo
235The following NEW packages will be installed:
236 baz:i386 foo
2370 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
238Inst foo (1 unstable [all])
239Inst baz:i386 (2 experimental [i386])
240Conf foo (1 unstable [all])
2c53226b
DK
241Conf baz:i386 (2 experimental [i386])" aptget install baz:i386/experimental -s --solver $solver
242
243 if [ "$solver" = 'apt' ]; then
244 HEADER="${HEADER_PRE}
245${HEADER_POST}"
246 else
247 HEADER="${HEADER_PRE}"
248 fi
249
250 if [ "$solver" = 'apt' ]; then
251 testfailureequal "$HEADER
252The solver encountered an error of type: ERR_UNSOLVABLE
253The following information might help you to understand what is wrong:
25b86db1 254The following packages have unmet dependencies:
3addaba1 255 baz-broken:i386 : Depends: bar:amd64 but it is not installable
ecc138f8 256
2c53226b
DK
257$SOMEPACKAGESCOULDNOT
258 baz-broken:i386 : Depends: bar:amd64 but it is not installable
259E: External solver failed with: The following packages have unmet dependencies:" aptget install baz-broken -s --solver $solver
260 else
261 testfailureequal "$HEADER
262$SOMEPACKAGESCOULDNOT
263 baz-broken:i386 : Depends: bar:amd64 but it is not installable
264E: Unable to correct problems, you have held broken packages." aptget install baz-broken -s --solver $solver
265 fi
266
267 testsuccessequal "$HEADER
e7ebb414 268The following additional packages will be installed:
ecc138f8
DK
269 next
270The following NEW packages will be installed:
271 needsrealnext next
2720 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
273Inst next (1 unstable [amd64])
274Inst needsrealnext (2 unstable [amd64])
275Conf next (1 unstable [amd64])
2c53226b 276Conf needsrealnext (2 unstable [amd64])" aptget install needsrealnext -s --solver $solver
ecc138f8 277
2c53226b 278 testsuccessequal "$HEADER
e7ebb414 279The following additional packages will be installed:
ecc138f8
DK
280 next
281The following NEW packages will be installed:
282 needsrealnext:i386 next
2830 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
284Inst next (1 unstable [amd64])
285Inst needsrealnext:i386 (2 unstable [i386])
286Conf next (1 unstable [amd64])
2c53226b 287Conf needsrealnext:i386 (2 unstable [i386])" aptget install needsrealnext:i386 -s --solver $solver
ecc138f8 288
2c53226b 289 testsuccessequal "$HEADER
e7ebb414 290The following additional packages will be installed:
ecc138f8
DK
291 virtualnext2
292The following NEW packages will be installed:
293 needsnext2 virtualnext2
2940 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
295Inst virtualnext2 (1 unstable [amd64])
296Inst needsnext2 (2 unstable [amd64])
297Conf virtualnext2 (1 unstable [amd64])
2c53226b 298Conf needsnext2 (2 unstable [amd64])" aptget install needsnext2 -s --solver $solver
ecc138f8 299
2c53226b 300 testsuccessequal "$HEADER
e7ebb414 301The following additional packages will be installed:
ecc138f8
DK
302 virtualnext2
303The following NEW packages will be installed:
304 needsnext2:i386 virtualnext2
3050 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
306Inst virtualnext2 (1 unstable [amd64])
307Inst needsnext2:i386 (2 unstable [i386])
308Conf virtualnext2 (1 unstable [amd64])
2c53226b 309Conf needsnext2:i386 (2 unstable [i386])" aptget install needsnext2:i386 -s --solver $solver
ecc138f8 310
2c53226b 311 testsuccessequal "$HEADER
e7ebb414 312The following additional packages will be installed:
ecc138f8
DK
313 virtualnext3
314The following NEW packages will be installed:
315 needsnext3 virtualnext3
3160 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
317Inst virtualnext3 (1 unstable [amd64])
318Inst needsnext3 (2 unstable [amd64])
319Conf virtualnext3 (1 unstable [amd64])
2c53226b 320Conf needsnext3 (2 unstable [amd64])" aptget install needsnext3 -s --solver $solver
ecc138f8 321
2c53226b
DK
322 if [ "$solver" = 'apt' ]; then
323 testfailureequal "$HEADER
324The solver encountered an error of type: ERR_UNSOLVABLE
325The following information might help you to understand what is wrong:
ecc138f8
DK
326The following packages have unmet dependencies:
327 needsnext3:i386 : Depends: next3:i386 (>= 2) but it is not installable
b755de25 328
2c53226b
DK
329$SOMEPACKAGESCOULDNOT
330 needsnext3:i386 : Depends: next3:i386 (>= 2) but it is not installable
331E: External solver failed with: The following packages have unmet dependencies:" aptget install needsnext3:i386 -s --solver $solver
332 else
333 testfailureequal "$HEADER
334$SOMEPACKAGESCOULDNOT
335 needsnext3:i386 : Depends: next3:i386 (>= 2) but it is not installable
336E: Unable to correct problems, you have held broken packages." aptget install needsnext3:i386 -s --solver $solver
337 fi
338
339 testsuccessequal "$HEADER
b755de25
DK
340The following additional packages will be installed:
341 selfprov
342The following NEW packages will be installed:
343 needsselfprov1 selfprov
3440 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
345Inst selfprov (2 unstable [amd64])
346Inst needsselfprov1 (1 unstable [amd64])
347Conf selfprov (2 unstable [amd64])
2c53226b
DK
348Conf needsselfprov1 (1 unstable [amd64])" aptget install needsselfprov1 -s --solver $solver
349 testsuccessequal "$HEADER
b755de25
DK
350The following additional packages will be installed:
351 selfprov
352The following NEW packages will be installed:
353 needsselfprov2 selfprov
3540 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
355Inst selfprov (2 unstable [amd64])
356Inst needsselfprov2 (1 unstable [amd64])
357Conf selfprov (2 unstable [amd64])
2c53226b
DK
358Conf needsselfprov2 (1 unstable [amd64])" aptget install needsselfprov2 -s --solver $solver
359 testsuccessequal "$HEADER
b755de25
DK
360The following additional packages will be installed:
361 selfprov
362The following NEW packages will be installed:
363 needsselfprov12 selfprov
3640 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
365Inst selfprov (2 unstable [amd64])
366Inst needsselfprov12 (1 unstable [amd64])
367Conf selfprov (2 unstable [amd64])
2c53226b
DK
368Conf needsselfprov12 (1 unstable [amd64])" aptget install needsselfprov12 -s --solver $solver
369 if [ "$solver" = 'apt' ]; then
370 testfailureequal "$HEADER
371The solver encountered an error of type: ERR_UNSOLVABLE
372The following information might help you to understand what is wrong:
b755de25
DK
373The following packages have unmet dependencies:
374 needsselfprov123 : Depends: selfprov (= 3)
2c53226b
DK
375
376$SOMEPACKAGESCOULDNOT
377 needsselfprov123 : Depends: selfprov (= 1)
378 Depends: selfprov (= 2)
379 Depends: selfprov (= 3)
380E: External solver failed with: The following packages have unmet dependencies:" aptget install needsselfprov123 -s --solver $solver
381 else
382 testfailureequal "$HEADER
383$SOMEPACKAGESCOULDNOT
384 needsselfprov123 : Depends: selfprov (= 3)
385E: Unable to correct problems, you have held broken packages." aptget install needsselfprov123 -s --solver $solver
386 fi
387done