]>
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 insertinstalledpackage 'foo' 'all' '3'
14 setupaptarchive --no-update
16 mkdir -p rootdir/var/lib/apt/lists/lost+found
17 testsuccess apt update
19 # nothing to do always works
20 testsuccess aptget clean
21 testsuccess aptget clean -s
23 # generate some dirt and clean it up
24 touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
25 mkdir -p rootdir/var/cache/apt/archives/lost+found
26 touch rootdir/var/cache/apt/archives/foo_1_all.deb
27 touch rootdir/var/cache/apt/archives/foo_2_all.deb
28 touch rootdir/var/cache/apt/archives/foo_3_all.deb
29 touch rootdir/var/cache/apt/archives/foo_4_all.deb
31 testsuccess aptget clean
33 testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
34 testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb
35 testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb
36 testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
37 testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
39 if [ "$(id -u)" != '0' ]; then
40 msgmsg 'No clean if lock can not be acquired'
41 touch rootdir/var/cache/apt/archives/foo_4_all.deb
42 touch rootdir/var/cache/apt/archives/lock
43 chmod 444 rootdir/var/cache/apt/archives/lock
45 testsuccess test -e rootdir/var/cache/apt/archives/foo_4_all.deb
46 chmod 644 rootdir/var/cache/apt/archives/lock
51 testsuccess apt autoclean
52 testfailure test -d "$1"
54 # clean creates an empty partial directory via GetLock
55 if [ "$(basename "$1")" = 'partial' ]; then
56 testsuccess test -d "$1"
58 testfailure test -d "$1"
61 msgmsg 'Partial directory missing'
62 directorygone 'rootdir/var/cache/apt/archives/partial'
63 directorygone 'rootdir/var/lib/apt/lists/partial'
65 msgmsg 'Archives directory missing'
66 directorygone 'rootdir/var/cache/apt/archives'
67 directorygone 'rootdir/var/lib/apt/lists'
69 msgmsg 'apt directory missing'
70 directorygone 'rootdir/var/cache/apt'
71 directorygone 'rootdir/var/lib/apt'