]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-autoremove
CMake: Switch integration tests and travis over
[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'
01a6e24c 21
73fe49f9
DK
22AUTOREMOVE='apt autoremove'
23if [ -n "$SUDO_USER" ]; then
24 AUTOREMOVE="sudo $AUTOREMOVE"
25fi
01a6e24c 26echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
25b86db1 27testsuccessequal 'Reading package lists...
01a6e24c
DK
28Building dependency tree...
29Reading state information...
30The following packages will be REMOVED:
31 po-debconf
320 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
33Remv po-debconf [1.0.16]' aptget autoremove -s
a0c19a21
DK
34testequal "Reading package lists...
35Building dependency tree...
36Reading state information...
37The following package was automatically installed and is no longer required:
38 po-debconf
73fe49f9 39Use '$AUTOREMOVE' to remove it.
a0c19a21
DK
400 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
41testequal "Reading package lists...
42Building dependency tree...
43Reading state information...
441 package was automatically installed and is no longer required.
73fe49f9 45Use '$AUTOREMOVE' to remove it.
a0c19a21 460 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
01a6e24c
DK
47testdpkginstalled 'po-debconf'
48
49echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 50testsuccess aptget autoremove -y
01a6e24c 51testdpkginstalled 'po-debconf'
b093a199 52
01a6e24c 53echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 54testsuccess aptget autoremove -y
01a6e24c
DK
55testdpkginstalled "po-debconf"
56
57rm rootdir/etc/apt/apt.conf.d/00autoremove
0440d936 58testsuccess aptget autoremove -y
5cf733e1 59testdpkgnotinstalled 'po-debconf'
ec7f904e 60testmarkedauto
b093a199 61
0479205d
DK
62sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' \
63 -e '/^Start-Date: / d' -e '/^End-Date: / d' \
64 -e '/^Requested-By: / d' \
65 -e 's#), #)\nInstall: #g' | sort -u > apt-history.log
a7250ed0
DK
66testfileequal 'apt-history.log' '
67Install: debhelper:i386 (8.0.0)
68Install: po-debconf:i386 (1.0.16, automatic)
69Install: unrelated:i386 (1)
b093a199 70Remove: debhelper:i386 (8.0.0)
b093a199 71Remove: po-debconf:i386 (1.0.16)'
8fa042ca
DK
72
73testsuccess aptget install debhelper -y
74testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
75testsuccess aptmark auto debhelper
76
77testmarkedauto 'debhelper' 'po-debconf'
25b86db1 78testsuccessequal 'Reading package lists...
8fa042ca
DK
79Building dependency tree...
80Reading state information...
81The following packages will be REMOVED:
82 debhelper po-debconf
830 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
84Remv debhelper [8.0.0]
85Remv po-debconf [1.0.16]' aptget autoremove -s
a0c19a21
DK
86testequal "Reading package lists...
87Building dependency tree...
88Reading state information...
89The following packages were automatically installed and are no longer required:
90 debhelper po-debconf
73fe49f9 91Use '$AUTOREMOVE' to remove them.
a0c19a21
DK
920 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
93testequal "Reading package lists...
94Building dependency tree...
95Reading state information...
962 packages were automatically installed and are no longer required.
73fe49f9 97Use '$AUTOREMOVE' to remove them.
a0c19a21 980 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
8fa042ca
DK
99
100testsuccess aptmark hold debhelper
25b86db1 101testsuccessequal 'Reading package lists...
8fa042ca
DK
102Building dependency tree...
103Reading state information...
1040 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
9777639e
DK
105
106testsuccess aptget autoremove debhelper -y --allow-change-held-packages
107testdpkgnotinstalled 'po-debconf' 'debhelper'
108testmarkedauto
109testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
110testmarkedauto 'po-debconf'
a0ed43f7
DK
111
112insertinstalledpackage 'bar' 'all' '1' 'Depends: foo-provider'
113insertinstalledpackage 'foo-multi1-1' 'all' '1' 'Provides: foo-provider
114Source: foo-multi (1)'
115insertinstalledpackage 'foo-multi1-2' 'all' '1' 'Provides: foo-provider
116Source: foo-multi (2)'
117insertinstalledpackage 'foo-multi1-3' 'all' '1' 'Provides: foo-provider
118Source: foo-multi (3)'
119insertinstalledpackage 'foo-multi2-1' 'all' '1' 'Provides: foo-provider
120Source: foo-multi (1)'
121insertinstalledpackage 'foo-multi2-2' 'all' '1' 'Provides: foo-provider
122Source: foo-multi (2)'
123insertinstalledpackage 'foo-multi2-3' 'all' '1' 'Provides: foo-provider
124Source: foo-multi (3)'
125insertinstalledpackage 'foo-plus-1' 'all' '1' 'Provides: foo-provider
126Source: foo-plus (1)'
127insertinstalledpackage 'foo-plus-2' 'all' '1' 'Provides: foo-provider
128Source: foo-plus (2)'
129insertinstalledpackage 'foo-plus-3' 'all' '1' 'Provides: foo-provider
130Source: foo-plus (3)'
131insertinstalledpackage 'foo-single-1' 'all' '1' 'Provides: foo-provider'
132insertinstalledpackage 'foo-single-2' 'all' '1' 'Provides: foo-provider'
133
134testsuccess aptmark auto 'foo-*'
135testsuccessequal 'Reading package lists...
136Building dependency tree...
137Reading state information...
138The following packages will be REMOVED:
139 foo-multi1-1 foo-multi1-2 foo-multi2-1 foo-multi2-2 foo-plus-1 foo-plus-2
1400 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
141Remv foo-multi1-1 [1]
142Remv foo-multi1-2 [1]
143Remv foo-multi2-1 [1]
144Remv foo-multi2-2 [1]
145Remv foo-plus-1 [1]
146Remv foo-plus-2 [1]' apt autoremove -s