]> git.saurik.com Git - apt.git/blob - test/integration/test-pin-non-existent-package
bd6ccc4769f6867dca4c0bca9bacabca5924573d
[apt.git] / test / integration / test-pin-non-existent-package
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture "i386"
8
9 insertpackage 'unstable' 'apt' 'i386' '0.8.15'
10
11 setupaptarchive
12
13 testcandidate() {
14 msgtest "Test that the Candidate for $1 is" $2
15 if [ "$(aptcache policy $1 | grep '^ Candidate:')" = " Candidate: $2" ]; then
16 msgpass
17 else
18 echo
19 aptcache policy $1
20 msgfail
21 fi
22 }
23
24 testcandidate apt '0.8.15'
25 testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
26 testequal 'Reading package lists...
27 Building dependency tree...
28 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
29
30 echo 'Package: apt
31 Pin: release a=unstable
32 Pin-Priority: -1' > rootdir/etc/apt/preferences
33
34 testcandidate apt '(none)'
35 testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
36 testequal 'Reading package lists...
37 Building dependency tree...
38 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
39
40 echo '
41 Package: doesntexist
42 Pin: release a=unstable
43 Pin-Priority: 1000' >> rootdir/etc/apt/preferences
44
45 testcandidate apt '(none)'
46
47 echo '
48 Package: apt
49 Pin: release a=unstable
50 Pin-Priority: 1000' >> rootdir/etc/apt/preferences
51
52 testcandidate apt '(none)'
53 testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
54
55 testequal 'Reading package lists...
56 Building dependency tree...
57 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade