]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-get-clean
buildsystem: deal with spaces in path to source
[apt.git] / test / integration / test-apt-get-clean
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'amd64'
9
10insertpackage 'testing' 'foo' 'all' '1'
11insertpackage 'unstable' 'foo' 'all' '2'
12insertinstalledpackage 'foo' 'all' '3'
13
14setupaptarchive --no-update
15
16mkdir -p rootdir/var/lib/apt/lists/lost+found
17testsuccess apt update
18
19# nothing to do always works
20testsuccess aptget clean
21testsuccess aptget clean -s
22
23# generate some dirt and clean it up
24touch rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
25mkdir -p rootdir/var/cache/apt/archives/lost+found
26touch rootdir/var/cache/apt/archives/foo_1_all.deb
27touch rootdir/var/cache/apt/archives/foo_2_all.deb
28touch rootdir/var/cache/apt/archives/foo_3_all.deb
29touch rootdir/var/cache/apt/archives/foo_4_all.deb
30
31testsuccess aptget clean
32
33testfailure test -e rootdir/var/lib/apt/lists/partial/http.debian.net_debian_dists_sid_main_i18n_Translation-en
34testfailure test -e rootdir/var/cache/apt/archives/foo_1_all.deb
35testfailure test -e rootdir/var/cache/apt/archives/foo_2_all.deb
36testfailure test -e rootdir/var/cache/apt/archives/foo_3_all.deb
37testfailure test -e rootdir/var/cache/apt/archives/foo_4_all.deb
38
39directorygone() {
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}
51msgmsg 'Partial directory missing'
52directorygone 'rootdir/var/cache/apt/archives/partial'
53directorygone 'rootdir/var/lib/apt/lists/partial'
54
55msgmsg 'Archives directory missing'
56directorygone 'rootdir/var/cache/apt/archives'
57directorygone 'rootdir/var/lib/apt/lists'
58
59msgmsg 'apt directory missing'
60directorygone 'rootdir/var/cache/apt'
61directorygone 'rootdir/var/lib/apt'