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