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