]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-autoremove
randomize acquire order for same type index files
[apt.git] / test / integration / test-apt-get-autoremove
CommitLineData
b093a199
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
b093a199 6setupenvironment
01a6e24c 7configarchitecture 'i386'
b093a199 8
01a6e24c
DK
9buildsimplenativepackage 'unrelated' 'all' '1' 'unstable'
10buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
11buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
b093a199
DK
12setupaptarchive
13
0440d936 14testsuccess aptget install unrelated debhelper -y
01a6e24c 15testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
b093a199 16
ec7f904e 17testmarkedauto 'po-debconf'
0440d936 18testsuccess aptget remove debhelper -y
5cf733e1 19testdpkgnotinstalled 'debhelper'
87bc1c45 20testdpkginstalled 'po-debconf' 'unrelated'
b820fd59
DK
21echo 'unrelated purge' | dpkg --set-selections
22testdpkgstatus 'pi' '1' 'unrelated'
01a6e24c 23
73fe49f9
DK
24AUTOREMOVE='apt autoremove'
25if [ -n "$SUDO_USER" ]; then
26 AUTOREMOVE="sudo $AUTOREMOVE"
27fi
01a6e24c 28echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
25b86db1 29testsuccessequal 'Reading package lists...
01a6e24c
DK
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
a0c19a21
DK
36testequal "Reading package lists...
37Building dependency tree...
38Reading state information...
39The following package was automatically installed and is no longer required:
40 po-debconf
73fe49f9 41Use '$AUTOREMOVE' to remove it.
a0c19a21
DK
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.
73fe49f9 47Use '$AUTOREMOVE' to remove it.
a0c19a21 480 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
01a6e24c
DK
49testdpkginstalled 'po-debconf'
50
51echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 52testsuccess aptget autoremove -y
01a6e24c 53testdpkginstalled 'po-debconf'
b820fd59 54testdpkgstatus 'pi' '1' 'unrelated'
b093a199 55
01a6e24c 56echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 57testsuccess aptget autoremove -y
01a6e24c 58testdpkginstalled "po-debconf"
b820fd59 59testdpkgstatus 'pi' '1' 'unrelated'
01a6e24c
DK
60
61rm rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 62testsuccess aptget autoremove -y
5cf733e1 63testdpkgnotinstalled 'po-debconf'
b820fd59 64testdpkgstatus 'pi' '1' 'unrelated'
ec7f904e 65testmarkedauto
b093a199 66
0479205d
DK
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
a7250ed0
DK
71testfileequal 'apt-history.log' '
72Install: debhelper:i386 (8.0.0)
73Install: po-debconf:i386 (1.0.16, automatic)
74Install: unrelated:i386 (1)
b093a199 75Remove: debhelper:i386 (8.0.0)
b093a199 76Remove: po-debconf:i386 (1.0.16)'
8fa042ca
DK
77
78testsuccess aptget install debhelper -y
b820fd59
DK
79testdpkgstatus 'pi' '1' 'unrelated'
80testdpkginstalled 'debhelper' 'po-debconf'
8fa042ca
DK
81testsuccess aptmark auto debhelper
82
83testmarkedauto 'debhelper' 'po-debconf'
25b86db1 84testsuccessequal 'Reading package lists...
8fa042ca
DK
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
a0c19a21
DK
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
73fe49f9 97Use '$AUTOREMOVE' to remove them.
a0c19a21
DK
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.
73fe49f9 103Use '$AUTOREMOVE' to remove them.
a0c19a21 1040 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
8fa042ca
DK
105
106testsuccess aptmark hold debhelper
25b86db1 107testsuccessequal 'Reading package lists...
8fa042ca
DK
108Building dependency tree...
109Reading state information...
1100 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
9777639e
DK
111
112testsuccess aptget autoremove debhelper -y --allow-change-held-packages
113testdpkgnotinstalled 'po-debconf' 'debhelper'
b820fd59 114testdpkgstatus 'pi' '1' 'unrelated'
9777639e
DK
115testmarkedauto
116testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
117testmarkedauto 'po-debconf'
b820fd59 118testdpkgstatus 'pi' '1' 'unrelated'
a0ed43f7
DK
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
70ff288b
DK
155
156testdpkgstatus 'pi' '1' 'unrelated'
157testsuccess apt purge unrelated -y