summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-keep-downloaded-pkgs
blob: 4cc7fbb0430f57bc9ff2c7285c12f9ec88ab2648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
configarchitecture 'native'

buildsimplenativepackage 'pkg1' 'all' '1.0' 'stable'
buildsimplenativepackage 'pkg2' 'all' '1.0' 'stable'
buildsimplenativepackage 'pkg3' 'all' '1.0' 'stable'
buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'

# local (file) installs
setupaptarchive

# ensure that install from local sources does not remove debs
testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb

# now switch to http and downloading debs
changetowebserver
testsuccess aptget update

# ensure that the downloaded pkg is kept with "keep=true"
testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb

# ensure that the downloaded pkg is removed when requested
testsuccess aptget install pkg3 -o APT::Keep-Downloaded-Packages=false
testsuccess test -f aptarchive/pool/pkg3_1.0_all.deb
# this was there before, keep it
testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
# this got installed so we can remove it now
testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb


# ensure that install from the download dir does not delete packages
mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb