]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-keep-downloaded-pkgs
Merge pull request julian-klode/apt#3 from adrian17/master
[apt.git] / test / integration / test-apt-keep-downloaded-pkgs
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'native'
9
10buildsimplenativepackage 'pkg1' 'all' '1.0' 'stable'
11buildsimplenativepackage 'pkg2' 'all' '1.0' 'stable'
12buildsimplenativepackage 'pkg3' 'all' '1.0' 'stable'
13buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'
14
15# local (file) installs
16setupaptarchive
17
18# ensure that install from local sources does not remove debs
19testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
20testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
21
22# now switch to http and downloading debs
23changetowebserver
24testsuccess aptget update
25
26# ensure that the downloaded pkg is kept with "keep=true"
27testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
28testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
29testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
30
31# ensure that the downloaded pkg is removed when requested
32testsuccess aptget install pkg3 -o APT::Keep-Downloaded-Packages=false
33testsuccess test -f aptarchive/pool/pkg3_1.0_all.deb
34# this was there before, keep it
35testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
36# this got installed so we can remove it now
37testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb
38
39
40# ensure that install from the download dir does not delete packages
41mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
42testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
43testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb