test-apt-never-markauto-sections 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. # this is a very crude regression test, not a "this is how it should be" test:
  10. # In theory mydesktop-core and texteditor should be marked as manual, but
  11. # texteditor is installed as a dependency of bad-texteditor, not of
  12. # mydesktop-core and mydesktop-core is removed while bad-texteditor is
  13. # installed losing the manual bit as the problem resolver will later decide to
  14. # drop bad-texteditor and re-instate mydesktop-core which is considered an
  15. # auto-install at that point (in theory the never-auto handling should be
  16. # copied to this place – as to the many other places dependencies are resolved
  17. # 'by hand' instead of via MarkInstall AutoInst…
  18. #
  19. # Both could be fixed if apt would figure out early that installing
  20. # bad-texteditor is a bad idea and eventually it should (as mydesktop-core is
  21. # a direct descendant of mydesktop which was a user-request mydesktop-core should
  22. # be as protected from removal as mydesktop is), but this is hard in the general case
  23. # as with more or-groups and provides you can produce 'legal' examples for this.
  24. buildsimplenativepackage 'mydesktop' 'all' '1' 'unstable' 'Depends: mydesktop-core, foreignpkg
  25. Recommends: notavailable' '' 'metapackages'
  26. buildsimplenativepackage 'mydesktop-core' 'amd64' '1' 'unstable' 'Depends: bad-texteditor | texteditor, browser (>= 42), nosection, foreignpkg
  27. Recommends: notavailable
  28. Multi-Arch: foreign' '' 'metapackages'
  29. buildsimplenativepackage 'browser' 'amd64' '41' 'stable'
  30. buildsimplenativepackage 'browser' 'amd64' '42' 'unstable'
  31. buildsimplenativepackage 'texteditor' 'amd64' '1' 'stable'
  32. buildsimplenativepackage 'bad-texteditor' 'amd64' '1' 'stable' 'Depends: texteditor
  33. Conflicts: mydesktop-core'
  34. buildsimplenativepackage 'nosection' 'amd64' '1' 'stable' '' '' '<none>'
  35. buildsimplenativepackage 'foreignpkg' 'i386' '1' 'stable' 'Multi-Arch: foreign'
  36. setupaptarchive
  37. testsuccess aptcache show nosection
  38. testfailure grep 'Section' rootdir/tmp/testsuccess.output
  39. testequal 'dpkg' aptmark showmanual
  40. testsuccess aptget install mydesktop -y -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1
  41. testequal 'browser
  42. dpkg
  43. foreignpkg:i386
  44. mydesktop
  45. nosection' aptmark showmanual
  46. testmarkedauto 'mydesktop-core' 'texteditor'
  47. testequal 'Reading package lists...
  48. Building dependency tree...
  49. Reading state information...
  50. The following packages will be REMOVED:
  51. mydesktop mydesktop-core texteditor
  52. 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
  53. Remv mydesktop [1]
  54. Remv mydesktop-core [1]
  55. Remv texteditor [1]' aptget autoremove mydesktop -s
  56. testequal 'Reading package lists...
  57. Building dependency tree...
  58. Reading state information...
  59. The following packages will be REMOVED:
  60. mydesktop mydesktop-core texteditor
  61. 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
  62. Remv mydesktop [1]
  63. Remv mydesktop-core [1]
  64. Remv texteditor [1]' aptget autoremove texteditor -s
  65. testsuccess aptget autoremove texteditor -y
  66. testdpkgnotinstalled mydesktop mydesktop-core texteditor
  67. testdpkginstalled browser
  68. testequal 'browser
  69. dpkg
  70. foreignpkg:i386
  71. nosection' aptmark showmanual
  72. testmarkedauto
  73. # test that installed/upgraded auto-pkgs are not set to manual
  74. testsuccess aptget install browser=41 -y --force-yes
  75. testequal 'browser
  76. dpkg
  77. foreignpkg:i386
  78. nosection' aptmark showmanual
  79. testmarkedauto
  80. testsuccess aptmark auto browser
  81. testmarkedauto 'browser'
  82. testsuccess aptmark auto nosection
  83. testmarkedauto 'browser' 'nosection'
  84. testequal 'dpkg
  85. foreignpkg:i386' aptmark showmanual
  86. testsuccess aptget install mydesktop -y
  87. testequal 'dpkg
  88. foreignpkg:i386
  89. mydesktop' aptmark showmanual
  90. testmarkedauto 'browser' 'nosection' 'mydesktop-core' 'texteditor'