test-apt-never-markauto-sections 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. aptconfig dump --no-empty --format '%v%n' APT::Never-MarkAuto-Sections > nevermarkauto.sections
  8. testsuccess grep '^metapackages$' nevermarkauto.sections
  9. buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg
  10. Recommends: notavailable' '' 'metapackages'
  11. buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg
  12. Recommends: notavailable
  13. Multi-Arch: foreign' '' 'metapackages'
  14. buildsimplenativepackage 'browser' 'amd64' '41' 'stable'
  15. buildsimplenativepackage 'browser' 'amd64' '42' 'unstable'
  16. buildsimplenativepackage 'texteditor' 'amd64' '1' 'stable'
  17. buildsimplenativepackage 'bad-texteditor' 'amd64' '1' 'stable' 'Depends: texteditor
  18. Conflicts: mydesktop-core'
  19. buildsimplenativepackage 'nosection' 'amd64' '1' 'stable' '' '' '<none>'
  20. buildsimplenativepackage 'foreignpkg' 'i386' '1' 'stable' 'Multi-Arch: foreign'
  21. setupaptarchive
  22. testsuccess aptcache show nosection
  23. testfailure grep 'Section' rootdir/tmp/testsuccess.output
  24. testequal 'dpkg' aptmark showmanual
  25. testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1
  26. testmarkedmanual 'dpkg' 'mydesktop'
  27. testmarkedauto 'mydesktop-core' 'foreignpkg:i386' 'texteditor' 'browser' 'nosection'
  28. # if the remove is from a user, don't do manual-bit passing
  29. testequal 'Reading package lists...
  30. Building dependency tree...
  31. Reading state information...
  32. The following packages will be REMOVED:
  33. browser foreignpkg:i386 mydesktop mydesktop-core nosection texteditor
  34. 0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
  35. Remv mydesktop [1]
  36. Remv mydesktop-core [1]
  37. Remv browser [42]
  38. Remv foreignpkg:i386 [1]
  39. Remv nosection [1]
  40. Remv texteditor [1]' aptget autoremove mydesktop -s
  41. testequal 'Reading package lists...
  42. Building dependency tree...
  43. Reading state information...
  44. The following packages will be REMOVED:
  45. mydesktop mydesktop-core texteditor
  46. 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
  47. Remv mydesktop [1]
  48. Remv mydesktop-core [1]
  49. Remv texteditor [1]' aptget autoremove texteditor -s #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1
  50. testsuccess aptget autoremove texteditor -y
  51. testdpkgnotinstalled mydesktop mydesktop-core texteditor
  52. testdpkginstalled browser
  53. testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection'
  54. testmarkedauto
  55. # test that installed/upgraded auto-pkgs are not set to manual
  56. testsuccess aptget install browser=41 -y --allow-downgrades
  57. testmarkedmanual 'browser' 'dpkg' 'foreignpkg:i386' 'nosection'
  58. testmarkedauto
  59. testsuccess aptmark auto browser
  60. testmarkedauto 'browser'
  61. testsuccess aptmark auto nosection
  62. testmarkedauto 'browser' 'nosection'
  63. testmarkedmanual 'dpkg' 'foreignpkg:i386'
  64. # nosection should be auto, not manual, but is marked as such by the resolver
  65. # removing mydesktop-core temporally… the resolver should be figuring out here
  66. # that there is no point of removing mydesktop-core as its an unavoidable
  67. # dependency of the user-requested mydesktop
  68. testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 -o Debug::pkgDepCache::AutoInstall=1
  69. testmarkedmanual 'dpkg' 'foreignpkg:i386' 'mydesktop' 'nosection'
  70. testmarkedauto 'browser' 'mydesktop-core' 'texteditor'