test-bug-758153-versioned-provides-support 15 KB

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