]>
Commit | Line | Data |
---|---|---|
20e6965a DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
20e6965a DK |
6 | |
7 | setupenvironment | |
8 | configarchitecture 'amd64' | |
9 | ||
10 | insertpackage 'testing' 'foo' 'all' '1' | |
11 | insertpackage 'unstable' 'foo' 'all' '2' | |
12 | insertinstalledpackage 'foo' 'all' '3' | |
13 | ||
6aef1942 DK |
14 | setupaptarchive --no-update |
15 | ||
16 | mkdir -p rootdir/var/lib/apt/lists/lost+found | |
17 | testsuccess apt update | |
20e6965a DK |
18 | |
19 | # nothing to do always works | |
20 | testsuccess aptget clean | |
7414af7f | 21 | testsuccess aptget clean -s |
20e6965a DK |
22 | |
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 | |
6aef1942 | 25 | mkdir -p rootdir/var/cache/apt/archives/lost+found |
20e6965a DK |
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 | |
30 | ||
31 | testsuccess aptget clean | |
32 | ||
e52aad52 DK |
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 | |
20e6965a | 38 | |
dffc17ba DK |
39 | directorygone() { |
40 | rm -rf "$1" | |
41 | testsuccess apt autoclean | |
42 | testfailure test -d "$1" | |
43 | testsuccess apt clean | |
44 | # clean creates an empty partial directory via GetLock | |
45 | if [ "$(basename "$1")" = 'partial' ]; then | |
46 | testsuccess test -d "$1" | |
47 | else | |
48 | testfailure test -d "$1" | |
49 | fi | |
50 | } | |
51 | msgmsg 'Partial directory missing' | |
52 | directorygone 'rootdir/var/cache/apt/archives/partial' | |
53 | directorygone 'rootdir/var/lib/apt/lists/partial' | |
54 | ||
55 | msgmsg 'Archives directory missing' | |
56 | directorygone 'rootdir/var/cache/apt/archives' | |
57 | directorygone 'rootdir/var/lib/apt/lists' | |
58 | ||
59 | msgmsg 'apt directory missing' | |
60 | directorygone 'rootdir/var/cache/apt' | |
61 | directorygone 'rootdir/var/lib/apt' |