]>
git.saurik.com Git - apt.git/blob - test/integration/test-apt-get-clean
4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'amd64'
10 insertpackage 'testing' 'foo' 'all' '1'
11 insertpackage 'unstable' 'foo' 'all' '2'
12 insertpackage 'experimental' 'foo' 'all' '1:1'
13 insertinstalledpackage 'foo' 'all' '3'
15 setupaptarchive --no-update
17 mkdir -p rootdir/var/lib/apt/lists/lost+found
18 testsuccess apt update
20 # nothing to do always works
21 testsuccess aptget clean
22 testsuccess aptget clean -s
24 # generate some dirt and clean it up
26 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
27 mkdir -p rootdir/var/cache/apt/archives/lost+found
28 touch rootdir/var/cache/apt/archives/foo_1_all.deb
29 touch rootdir/var/cache/apt/archives/foo_1%3a1_all.deb
30 touch rootdir/var/cache/apt/archives/foo_2%3a1_all.deb
31 touch rootdir/var/cache/apt/archives/foo_2_all.deb
32 touch rootdir/var/cache/apt/archives/foo_3_all.deb
33 touch rootdir/var/cache/apt/archives/foo_4_all.deb
37 testsuccess aptget autoclean
38 testsuccess test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
39 testsuccess test -e rootdir/var/cache/apt/archives/foo_1_all.deb
40 testsuccess test -e rootdir/var/cache/apt/archives/foo_1%3a1_all.deb
41 testfailure test -e rootdir/var/cache/apt/archives/foo_2%3a1_all.deb
42 testsuccess test -e rootdir/var/cache/apt/archives/foo_2_all.deb
43 testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
44 testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
47 testsuccess aptget clean
48 testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
49 testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb
50 testfailure test -e rootdir/var/cache/apt/archives/foo_1%3a1_all.deb
51 testfailure test -e rootdir/var/cache/apt/archives/foo_2%3a1_all.deb
52 testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb
53 testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
54 testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
56 if [ "$(id -u)" != '0' ]; then
57 msgmsg 'No clean if lock can not be acquired'
58 touch rootdir/var/cache/apt/archives/foo_4_all.deb
59 touch rootdir/var/cache/apt/archives/lock
60 chmod 444 rootdir/var/cache/apt/archives/lock
62 testsuccess test -e rootdir/var/cache/apt/archives/foo_4_all.deb
63 chmod 644 rootdir/var/cache/apt/archives/lock
68 testsuccess apt autoclean
69 testfailure test -d "$1"
71 # clean creates an empty partial directory via GetLock
72 if [ "$(basename "$1")" = 'partial' ]; then
73 testsuccess test -d "$1"
75 testfailure test -d "$1"
78 msgmsg 'Partial directory missing'
79 directorygone 'rootdir/var/cache/apt/archives/partial'
80 directorygone 'rootdir/var/lib/apt/lists/partial'
82 msgmsg 'Archives directory missing'
83 directorygone 'rootdir/var/cache/apt/archives'
84 directorygone 'rootdir/var/lib/apt/lists'
86 msgmsg 'apt directory missing'
87 directorygone 'rootdir/var/cache/apt'
88 directorygone 'rootdir/var/lib/apt'