]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-get-autoremove
test-apt-download-progress: Allow smaller progress change
[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' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e 's#), #)\nInstall: #g' | sort -u > apt-history.log
63 testfileequal 'apt-history.log' '
64 Install: debhelper:i386 (8.0.0)
65 Install: po-debconf:i386 (1.0.16, automatic)
66 Install: unrelated:i386 (1)
67 Remove: debhelper:i386 (8.0.0)
68 Remove: po-debconf:i386 (1.0.16)'
69
70 testsuccess aptget install debhelper -y
71 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
72 testsuccess aptmark auto debhelper
73
74 testmarkedauto 'debhelper' 'po-debconf'
75 testsuccessequal 'Reading package lists...
76 Building dependency tree...
77 Reading state information...
78 The following packages will be REMOVED:
79 debhelper po-debconf
80 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
81 Remv debhelper [8.0.0]
82 Remv po-debconf [1.0.16]' aptget autoremove -s
83 testequal "Reading package lists...
84 Building dependency tree...
85 Reading state information...
86 The following packages were automatically installed and are no longer required:
87 debhelper po-debconf
88 Use '$AUTOREMOVE' to remove them.
89 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s
90 testequal "Reading package lists...
91 Building dependency tree...
92 Reading state information...
93 2 packages were automatically installed and are no longer required.
94 Use '$AUTOREMOVE' to remove them.
95 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small
96
97 testsuccess aptmark hold debhelper
98 testsuccessequal 'Reading package lists...
99 Building dependency tree...
100 Reading state information...
101 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
102
103 testsuccess aptget autoremove debhelper -y --allow-change-held-packages
104 testdpkgnotinstalled 'po-debconf' 'debhelper'
105 testmarkedauto
106 testsuccess aptget install debhelper --solver apt -y -o Debug::pkgDepCache::Marker=1
107 testmarkedauto 'po-debconf'