You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

239 lines
9.4 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. buildsimplenativepackage 'unrelated' 'all' '1' 'unstable'
  8. buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
  9. buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
  10. buildsimplenativepackage 'base-files' 'all' '10' 'unstable' 'Essential: yes'
  11. buildsimplenativepackage 'fdisk' 'all' '2.30.2' 'unstable' 'XB-Important: yes'
  12. buildsimplenativepackage 'linux-image' 'all' '4.9.80' 'unstable'
  13. buildsimplenativepackage 'hold-me' 'all' '1.0' 'unstable'
  14. buildsimplenativepackage 'remove-me' 'all' '1.0' 'unstable'
  15. buildsimplenativepackage 'system-base' 'all' '1.0' 'unstable' 'Depends: unrelated, base-files, fdisk, linux-image, hold-me, remove-me'
  16. setupaptarchive
  17. testsuccess aptget install unrelated debhelper -y
  18. testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
  19. testmarkedauto 'po-debconf'
  20. testsuccess aptget remove debhelper -y
  21. testdpkgnotinstalled 'debhelper'
  22. testdpkginstalled 'po-debconf' 'unrelated'
  23. echo 'unrelated purge' | dpkg --set-selections
  24. testdpkgstatus 'pi' '1' 'unrelated'
  25. AUTOREMOVE='apt autoremove'
  26. if [ -n "$SUDO_USER" ]; then
  27. AUTOREMOVE="sudo $AUTOREMOVE"
  28. fi
  29. echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
  30. testsuccessequal 'Reading package lists...
  31. Building dependency tree...
  32. Reading state information...
  33. The following packages will be REMOVED:
  34. po-debconf
  35. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  36. Remv po-debconf [1.0.16]' aptget autoremove -s
  37. testequal "Reading package lists...
  38. Building dependency tree...
  39. Reading state information...
  40. The following package was automatically installed and is no longer required:
  41. po-debconf
  42. Use '$AUTOREMOVE' to remove it.
  43. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
  44. testequal "Reading package lists...
  45. Building dependency tree...
  46. Reading state information...
  47. 1 package was automatically installed and is no longer required.
  48. Use '$AUTOREMOVE' to remove it.
  49. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
  50. testequal "Reading package lists...
  51. Building dependency tree...
  52. Reading state information...
  53. Calculating upgrade...
  54. The following package was automatically installed and is no longer required:
  55. po-debconf
  56. Use '$AUTOREMOVE' to remove it.
  57. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget upgrade -s
  58. testsuccessequal 'Reading package lists...
  59. Building dependency tree...
  60. Reading state information...
  61. The following packages will be REMOVED:
  62. po-debconf
  63. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  64. Remv po-debconf [1.0.16]' aptget install -s --autoremove
  65. testsuccessequal 'Reading package lists...
  66. Building dependency tree...
  67. Reading state information...
  68. Calculating upgrade...
  69. The following packages will be REMOVED:
  70. po-debconf
  71. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  72. Remv po-debconf [1.0.16]' aptget upgrade -s --autoremove
  73. echo 'APT::Get::AutomaticRemove "true";' > rootdir/etc/apt/apt.conf.d/autoremoval
  74. testsuccessequal 'Reading package lists...
  75. Building dependency tree...
  76. Reading state information...
  77. The following packages will be REMOVED:
  78. po-debconf
  79. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  80. Remv po-debconf [1.0.16]' aptget install -s
  81. testequal "Reading package lists...
  82. Building dependency tree...
  83. Reading state information...
  84. Calculating upgrade...
  85. The following package was automatically installed and is no longer required:
  86. po-debconf
  87. Use '$AUTOREMOVE' to remove it.
  88. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget upgrade -s
  89. rm -f rootdir/etc/apt/apt.conf.d/autoremoval
  90. testdpkginstalled 'po-debconf'
  91. echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
  92. testsuccess aptget autoremove -y
  93. testdpkginstalled 'po-debconf'
  94. testdpkgstatus 'pi' '1' 'unrelated'
  95. echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
  96. testsuccess aptget autoremove -y
  97. testdpkginstalled "po-debconf"
  98. testdpkgstatus 'pi' '1' 'unrelated'
  99. rm rootdir/etc/apt/apt.conf.d/00autoremove
  100. testsuccess aptget autoremove -y
  101. testdpkgnotinstalled 'po-debconf'
  102. testdpkgstatus 'pi' '1' 'unrelated'
  103. testmarkedauto
  104. sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' \
  105. -e '/^Start-Date: / d' -e '/^End-Date: / d' \
  106. -e '/^Requested-By: / d' \
  107. -e 's#), #)\nInstall: #g' | sort -u > apt-history.log
  108. testfileequal 'apt-history.log' '
  109. Install: debhelper:i386 (8.0.0)
  110. Install: po-debconf:i386 (1.0.16, automatic)
  111. Install: unrelated:i386 (1)
  112. Remove: debhelper:i386 (8.0.0)
  113. Remove: po-debconf:i386 (1.0.16)'
  114. testsuccess aptget install debhelper -y
  115. testdpkgstatus 'pi' '1' 'unrelated'
  116. testdpkginstalled 'debhelper' 'po-debconf'
  117. testsuccess aptmark auto debhelper
  118. testmarkedauto 'debhelper' 'po-debconf'
  119. testsuccessequal 'Reading package lists...
  120. Building dependency tree...
  121. Reading state information...
  122. The following packages will be REMOVED:
  123. debhelper po-debconf
  124. 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
  125. Remv debhelper [8.0.0]
  126. Remv po-debconf [1.0.16]' aptget autoremove -s
  127. testequal "Reading package lists...
  128. Building dependency tree...
  129. Reading state information...
  130. The following packages were automatically installed and are no longer required:
  131. debhelper po-debconf
  132. Use '$AUTOREMOVE' to remove them.
  133. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
  134. testequal "Reading package lists...
  135. Building dependency tree...
  136. Reading state information...
  137. 2 packages were automatically installed and are no longer required.
  138. Use '$AUTOREMOVE' to remove them.
  139. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
  140. testsuccess aptmark hold debhelper
  141. testsuccessequal 'Reading package lists...
  142. Building dependency tree...
  143. Reading state information...
  144. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
  145. testsuccess aptget autoremove debhelper -y --allow-change-held-packages
  146. testdpkgnotinstalled 'po-debconf' 'debhelper'
  147. testdpkgstatus 'pi' '1' 'unrelated'
  148. testmarkedauto
  149. testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
  150. testmarkedauto 'po-debconf'
  151. testdpkgstatus 'pi' '1' 'unrelated'
  152. testsuccess aptget install system-base debhelper -y
  153. testdpkginstalled 'debhelper' 'po-debconf' 'system-base' 'base-files' 'fdisk' 'linux-image' 'hold-me' 'remove-me'
  154. testsuccess aptmark hold 'hold-me'
  155. echo 'APT::NeverAutoRemove { "^linux-image$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
  156. testsuccess aptget remove system-base -y
  157. testsuccess aptget autoremove -y -o Debug::pkgAutoRemove=yes
  158. DEBUGLOG=${TMPWORKINGDIRECTORY}/rootdir/tmp/autoremove.debuglog
  159. cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$DEBUGLOG"
  160. testsuccess grep -Fx 'Marking: fdisk:i386 2.30.2 (Important)' "$DEBUGLOG"
  161. testsuccess grep -Fx 'Marking: base-files:i386 10 (Essential)' "$DEBUGLOG"
  162. testsuccess grep -Fx 'Marking: unrelated:i386 1 (Manual-Installed)' "$DEBUGLOG"
  163. testsuccess grep -Fx 'Marking: hold-me:i386 1.0 (Hold)' "$DEBUGLOG"
  164. testsuccess grep -Fx 'Marking: po-debconf:i386 1.0.16 (Dependency)' "$DEBUGLOG"
  165. testsuccess grep -Fx 'Marking: linux-image:i386 4.9.80 (Blacklisted [APT::NeverAutoRemove])' "$DEBUGLOG"
  166. testdpkginstalled 'debhelper' 'po-debconf' 'base-files' 'fdisk' 'linux-image'
  167. testdpkgstatus 'hi' '1' 'hold-me'
  168. testdpkgnotinstalled 'remove-me'
  169. testdpkgstatus 'pi' '1' 'unrelated'
  170. insertinstalledpackage 'bar' 'all' '1' 'Depends: foo-provider'
  171. insertinstalledpackage 'foo-multi1-1' 'all' '1' 'Provides: foo-provider
  172. Source: foo-multi (1)'
  173. insertinstalledpackage 'foo-multi1-2' 'all' '1' 'Provides: foo-provider
  174. Source: foo-multi (2)'
  175. insertinstalledpackage 'foo-multi1-3' 'all' '1' 'Provides: foo-provider
  176. Source: foo-multi (3)'
  177. insertinstalledpackage 'foo-multi2-1' 'all' '1' 'Provides: foo-provider
  178. Source: foo-multi (1)'
  179. insertinstalledpackage 'foo-multi2-2' 'all' '1' 'Provides: foo-provider
  180. Source: foo-multi (2)'
  181. insertinstalledpackage 'foo-multi2-3' 'all' '1' 'Provides: foo-provider
  182. Source: foo-multi (3)'
  183. insertinstalledpackage 'foo-plus-1' 'all' '1' 'Provides: foo-provider
  184. Source: foo-plus (1)'
  185. insertinstalledpackage 'foo-plus-2' 'all' '1' 'Provides: foo-provider
  186. Source: foo-plus (2)'
  187. insertinstalledpackage 'foo-plus-3' 'all' '1' 'Provides: foo-provider
  188. Source: foo-plus (3)'
  189. insertinstalledpackage 'foo-single-1' 'all' '1' 'Provides: foo-provider'
  190. insertinstalledpackage 'foo-single-2' 'all' '1' 'Provides: foo-provider'
  191. testsuccess aptmark auto 'foo-*'
  192. testsuccessequal 'Reading package lists...
  193. Building dependency tree...
  194. Reading state information...
  195. The following packages will be REMOVED:
  196. foo-multi1-1 foo-multi1-2 foo-multi2-1 foo-multi2-2 foo-plus-1 foo-plus-2
  197. 0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
  198. Remv foo-multi1-1 [1]
  199. Remv foo-multi1-2 [1]
  200. Remv foo-multi2-1 [1]
  201. Remv foo-multi2-2 [1]
  202. Remv foo-plus-1 [1]
  203. Remv foo-plus-2 [1]' apt autoremove -s
  204. testsuccessequal 'Reading package lists...
  205. Building dependency tree...
  206. Reading state information...
  207. The following packages will be REMOVED:
  208. foo-multi1-1* foo-multi1-2* foo-multi2-1* foo-multi2-2* foo-plus-1*
  209. foo-plus-2*
  210. 0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
  211. Purg foo-multi1-1 [1]
  212. Purg foo-multi1-2 [1]
  213. Purg foo-multi2-1 [1]
  214. Purg foo-multi2-2 [1]
  215. Purg foo-plus-1 [1]
  216. Purg foo-plus-2 [1]' apt autopurge -s
  217. testdpkgstatus 'pi' '1' 'unrelated'
  218. testsuccess apt purge unrelated -y