]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-get-autoremove
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / test / integration / test-apt-get-autoremove
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6 setupenvironment
7 configarchitecture 'i386'
8
9 buildsimplenativepackage 'unrelated' 'all' '1' 'unstable'
10 buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
11 buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
12 setupaptarchive
13
14 testsuccess aptget install unrelated debhelper -y
15 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
16
17 testmarkedauto 'po-debconf'
18 testsuccess aptget remove debhelper -y
19 testdpkgnotinstalled 'debhelper'
20 testdpkginstalled 'po-debconf' 'unrelated'
21
22 AUTOREMOVE='apt autoremove'
23 if [ -n "$SUDO_USER" ]; then
24 AUTOREMOVE="sudo $AUTOREMOVE"
25 fi
26 echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
27 testsuccessequal 'Reading package lists...
28 Building dependency tree...
29 Reading state information...
30 The following packages will be REMOVED:
31 po-debconf
32 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
33 Remv po-debconf [1.0.16]' aptget autoremove -s
34 testequal "Reading package lists...
35 Building dependency tree...
36 Reading state information...
37 The following package was automatically installed and is no longer required:
38 po-debconf
39 Use '$AUTOREMOVE' to remove it.
40 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
41 testequal "Reading package lists...
42 Building dependency tree...
43 Reading state information...
44 1 package was automatically installed and is no longer required.
45 Use '$AUTOREMOVE' to remove it.
46 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
47 testdpkginstalled 'po-debconf'
48
49 echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
50 testsuccess aptget autoremove -y
51 testdpkginstalled 'po-debconf'
52
53 echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
54 testsuccess aptget autoremove -y
55 testdpkginstalled "po-debconf"
56
57 rm rootdir/etc/apt/apt.conf.d/00autoremove
58 testsuccess aptget autoremove -y
59 testdpkgnotinstalled 'po-debconf'
60 testmarkedauto
61
62 sed 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
66 testfileequal 'apt-history.log' '
67 Install: debhelper:i386 (8.0.0)
68 Install: po-debconf:i386 (1.0.16, automatic)
69 Install: unrelated:i386 (1)
70 Remove: debhelper:i386 (8.0.0)
71 Remove: po-debconf:i386 (1.0.16)'
72
73 testsuccess aptget install debhelper -y
74 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
75 testsuccess aptmark auto debhelper
76
77 testmarkedauto 'debhelper' 'po-debconf'
78 testsuccessequal 'Reading package lists...
79 Building dependency tree...
80 Reading state information...
81 The following packages will be REMOVED:
82 debhelper po-debconf
83 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
84 Remv debhelper [8.0.0]
85 Remv po-debconf [1.0.16]' aptget autoremove -s
86 testequal "Reading package lists...
87 Building dependency tree...
88 Reading state information...
89 The following packages were automatically installed and are no longer required:
90 debhelper po-debconf
91 Use '$AUTOREMOVE' to remove them.
92 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
93 testequal "Reading package lists...
94 Building dependency tree...
95 Reading state information...
96 2 packages were automatically installed and are no longer required.
97 Use '$AUTOREMOVE' to remove them.
98 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
99
100 testsuccess aptmark hold debhelper
101 testsuccessequal 'Reading package lists...
102 Building dependency tree...
103 Reading state information...
104 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
105
106 testsuccess aptget autoremove debhelper -y --allow-change-held-packages
107 testdpkgnotinstalled 'po-debconf' 'debhelper'
108 testmarkedauto
109 testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
110 testmarkedauto 'po-debconf'