]> git.saurik.com Git - apt.git/blob - test/integration/test-autoremove
releasing version 0.8.7
[apt.git] / test / integration / test-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 aptget install unrelated debhelper -qq 2>&1 > /dev/null
15 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
16
17 testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf
18 Architecture: i386
19 Auto-Installed: 1
20 '
21 aptget remove debhelper -y -qq 2>&1 > /dev/null
22 testdpkgnoninstalled 'debhelper'
23 testdpkginstalled 'po-debconf unrelated'
24
25 echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
26 testequal 'Reading package lists...
27 Building dependency tree...
28 Reading state information...
29 The following packages will be REMOVED:
30 po-debconf
31 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
32 Remv po-debconf [1.0.16]' aptget autoremove -s
33 testdpkginstalled 'po-debconf'
34
35 echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
36 aptget autoremove -y -qq 2>&1 > /dev/null
37 testdpkginstalled 'po-debconf'
38
39 echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
40 aptget autoremove -y -qq 2>&1 > /dev/null
41 testdpkginstalled "po-debconf"
42
43 rm rootdir/etc/apt/apt.conf.d/00autoremove
44 aptget autoremove -y -qq 2>&1 > /dev/null
45 testdpkgnoninstalled 'po-debconf'
46
47 testfileequal 'rootdir/var/lib/apt/extended_states' ''
48
49 sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
50 testfileequal 'rootdir/var/log/apt/history.log' '
51 Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, automatic)
52
53 Remove: debhelper:i386 (8.0.0)
54
55 Remove: po-debconf:i386 (1.0.16)'