]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-get-autoremove
add a testcase for support of various build-dependency types
[apt.git] / test / integration / test-apt-get-autoremove
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'i386'
8
9buildsimplenativepackage 'unrelated' 'all' '1' 'unstable'
10buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
11buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
12setupaptarchive
13
14testsuccess aptget install unrelated debhelper -y
15testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
16
17testmarkedauto 'po-debconf'
18testsuccess aptget remove debhelper -y
19testdpkgnotinstalled 'debhelper'
20testdpkginstalled 'po-debconf' 'unrelated'
21echo 'unrelated purge' | dpkg --set-selections
22testdpkgstatus 'pi' '1' 'unrelated'
23
24AUTOREMOVE='apt autoremove'
25if [ -n "$SUDO_USER" ]; then
26 AUTOREMOVE="sudo $AUTOREMOVE"
27fi
28echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
29testsuccessequal 'Reading package lists...
30Building dependency tree...
31Reading state information...
32The following packages will be REMOVED:
33 po-debconf
340 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
35Remv po-debconf [1.0.16]' aptget autoremove -s
36testequal "Reading package lists...
37Building dependency tree...
38Reading state information...
39The following package was automatically installed and is no longer required:
40 po-debconf
41Use '$AUTOREMOVE' to remove it.
420 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
43testequal "Reading package lists...
44Building dependency tree...
45Reading state information...
461 package was automatically installed and is no longer required.
47Use '$AUTOREMOVE' to remove it.
480 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
49testdpkginstalled 'po-debconf'
50
51echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
52testsuccess aptget autoremove -y
53testdpkginstalled 'po-debconf'
54testdpkgstatus 'pi' '1' 'unrelated'
55
56echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
57testsuccess aptget autoremove -y
58testdpkginstalled "po-debconf"
59testdpkgstatus 'pi' '1' 'unrelated'
60
61rm rootdir/etc/apt/apt.conf.d/00autoremove
62testsuccess aptget autoremove -y
63testdpkgnotinstalled 'po-debconf'
64testdpkgstatus 'pi' '1' 'unrelated'
65testmarkedauto
66
67sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' \
68 -e '/^Start-Date: / d' -e '/^End-Date: / d' \
69 -e '/^Requested-By: / d' \
70 -e 's#), #)\nInstall: #g' | sort -u > apt-history.log
71testfileequal 'apt-history.log' '
72Install: debhelper:i386 (8.0.0)
73Install: po-debconf:i386 (1.0.16, automatic)
74Install: unrelated:i386 (1)
75Remove: debhelper:i386 (8.0.0)
76Remove: po-debconf:i386 (1.0.16)'
77
78testsuccess aptget install debhelper -y
79testdpkgstatus 'pi' '1' 'unrelated'
80testdpkginstalled 'debhelper' 'po-debconf'
81testsuccess aptmark auto debhelper
82
83testmarkedauto 'debhelper' 'po-debconf'
84testsuccessequal 'Reading package lists...
85Building dependency tree...
86Reading state information...
87The following packages will be REMOVED:
88 debhelper po-debconf
890 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
90Remv debhelper [8.0.0]
91Remv po-debconf [1.0.16]' aptget autoremove -s
92testequal "Reading package lists...
93Building dependency tree...
94Reading state information...
95The following packages were automatically installed and are no longer required:
96 debhelper po-debconf
97Use '$AUTOREMOVE' to remove them.
980 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
99testequal "Reading package lists...
100Building dependency tree...
101Reading state information...
1022 packages were automatically installed and are no longer required.
103Use '$AUTOREMOVE' to remove them.
1040 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
105
106testsuccess aptmark hold debhelper
107testsuccessequal 'Reading package lists...
108Building dependency tree...
109Reading state information...
1100 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
111
112testsuccess aptget autoremove debhelper -y --allow-change-held-packages
113testdpkgnotinstalled 'po-debconf' 'debhelper'
114testdpkgstatus 'pi' '1' 'unrelated'
115testmarkedauto
116testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
117testmarkedauto 'po-debconf'
118testdpkgstatus 'pi' '1' 'unrelated'
119
120insertinstalledpackage 'bar' 'all' '1' 'Depends: foo-provider'
121insertinstalledpackage 'foo-multi1-1' 'all' '1' 'Provides: foo-provider
122Source: foo-multi (1)'
123insertinstalledpackage 'foo-multi1-2' 'all' '1' 'Provides: foo-provider
124Source: foo-multi (2)'
125insertinstalledpackage 'foo-multi1-3' 'all' '1' 'Provides: foo-provider
126Source: foo-multi (3)'
127insertinstalledpackage 'foo-multi2-1' 'all' '1' 'Provides: foo-provider
128Source: foo-multi (1)'
129insertinstalledpackage 'foo-multi2-2' 'all' '1' 'Provides: foo-provider
130Source: foo-multi (2)'
131insertinstalledpackage 'foo-multi2-3' 'all' '1' 'Provides: foo-provider
132Source: foo-multi (3)'
133insertinstalledpackage 'foo-plus-1' 'all' '1' 'Provides: foo-provider
134Source: foo-plus (1)'
135insertinstalledpackage 'foo-plus-2' 'all' '1' 'Provides: foo-provider
136Source: foo-plus (2)'
137insertinstalledpackage 'foo-plus-3' 'all' '1' 'Provides: foo-provider
138Source: foo-plus (3)'
139insertinstalledpackage 'foo-single-1' 'all' '1' 'Provides: foo-provider'
140insertinstalledpackage 'foo-single-2' 'all' '1' 'Provides: foo-provider'
141
142testsuccess aptmark auto 'foo-*'
143testsuccessequal 'Reading package lists...
144Building dependency tree...
145Reading state information...
146The following packages will be REMOVED:
147 foo-multi1-1 foo-multi1-2 foo-multi2-1 foo-multi2-2 foo-plus-1 foo-plus-2
1480 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
149Remv foo-multi1-1 [1]
150Remv foo-multi1-2 [1]
151Remv foo-multi2-1 [1]
152Remv foo-multi2-2 [1]
153Remv foo-plus-1 [1]
154Remv foo-plus-2 [1]' apt autoremove -s
155
156testdpkgstatus 'pi' '1' 'unrelated'
157testsuccess apt purge unrelated -y