always run 'dpkg --configure -a' at the end of our dpkg callings
[ntk/apt.git] / test / integration / test-pin-non-existent-package
CommitLineData
00c6e1a3
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture "i386"
8
a02f0c29 9insertpackage 'unstable' 'rapt' 'i386' '0.8.15'
00c6e1a3
MV
10insertpackage 'unstable' 'arch' 'i386' '1.0'
11
12setupaptarchive
13
14testcandidate() {
15 msgtest "Test that the Candidate for $1 is" $2
16 if [ "$(aptcache policy $1 | grep '^ Candidate:')" = " Candidate: $2" ]; then
17 msgpass
18 else
19 echo
20 aptcache policy $1
21 msgfail
22 fi
23}
24
a02f0c29 25testcandidate rapt '0.8.15'
00c6e1a3
MV
26testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
27testequal 'Reading package lists...
28Building dependency tree...
a02f0c29 290 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
00c6e1a3 30
a02f0c29 31echo 'Package: rapt
00c6e1a3
MV
32Pin: release a=unstable
33Pin-Priority: -1' > rootdir/etc/apt/preferences
34
a02f0c29 35testcandidate rapt '(none)'
00c6e1a3
MV
36testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
37testequal 'Reading package lists...
38Building dependency tree...
a02f0c29 390 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
00c6e1a3
MV
40
41echo '
42Package: doesntexist
43Pin: release a=unstable
44Pin-Priority: 1000' >> rootdir/etc/apt/preferences
45
a02f0c29 46testcandidate rapt '(none)'
00c6e1a3
MV
47
48echo '
a02f0c29 49Package: rapt
00c6e1a3
MV
50Pin: release a=unstable
51Pin-Priority: 1000' >> rootdir/etc/apt/preferences
52
a02f0c29 53testcandidate rapt '(none)'
00c6e1a3
MV
54testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
55
56testequal 'Reading package lists...
57Building dependency tree...
a02f0c29 580 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
00c6e1a3
MV
59
60echo 'Package: arch:amd64
61Pin: release a=unstable
62Pin-Priority: -1' > rootdir/etc/apt/preferences
63
64testcandidate arch '1.0'
65
66echo '
67Package: arch:i386
68Pin: release a=unstable
69Pin-Priority: -1' >> rootdir/etc/apt/preferences
70
71testcandidate arch '(none)'
72