]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-543966-downgrade-below-1000-pin
Strip trailing commas for created signed-by fingerprint lists
[apt.git] / test / integration / test-bug-543966-downgrade-below-1000-pin
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6
7 setupenvironment
8 configarchitecture 'i386'
9
10 insertpackage 'unstable' 'base-files' 'all' '5.0.0'
11 insertinstalledpackage 'base-files' 'all' '5.0.0-1'
12
13 setupaptarchive
14
15 STATUS=$(readlink -f rootdir/var/lib/dpkg/status)
16 APTARCHIVE="$(readlink -f aptarchive)"
17
18 testsuccessequal "base-files:
19 Installed: 5.0.0-1
20 Candidate: 5.0.0-1
21 Version table:
22 *** 5.0.0-1 100
23 100 $STATUS
24 5.0.0 500
25 500 file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=0
26
27 writepin() {
28 echo "Package: $1
29 Pin: release a=unstable
30 Pin-Priority: $2" > rootdir/etc/apt/preferences
31 }
32
33
34
35 testpinning() {
36 local PKGPINPRIO=''
37 local REPPINPRIO=''
38 if [ "$1" != '*' ]; then
39 PKGPINPRIO=''
40 REPPINPRIO=' 500'
41 fi
42 writepin "$1" '99'
43 testsuccessequal "base-files:
44 Installed: 5.0.0-1
45 Candidate: 5.0.0-1
46 Version table:
47 *** 5.0.0-1 100
48 100 $STATUS
49 5.0.0 ${PKGPINPRIO:-99}
50 ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=99
51
52 writepin "$1" '100'
53 testsuccessequal "base-files:
54 Installed: 5.0.0-1
55 Candidate: 5.0.0-1
56 Version table:
57 *** 5.0.0-1 100
58 100 $STATUS
59 5.0.0 ${PKGPINPRIO:-100}
60 ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=100
61
62 writepin "$1" '999'
63 testsuccessequal "base-files:
64 Installed: 5.0.0-1
65 Candidate: 5.0.0-1
66 Version table:
67 *** 5.0.0-1 100
68 100 $STATUS
69 5.0.0 ${PKGPINPRIO:-999}
70 ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=999
71
72 writepin "$1" '1000'
73 testsuccessequal "base-files:
74 Installed: 5.0.0-1
75 Candidate: 5.0.0
76 Version table:
77 *** 5.0.0-1 100
78 100 $STATUS
79 5.0.0 ${PKGPINPRIO:-1000}
80 ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=1000
81 }
82
83 msgmsg 'Tests with generic-form pin'
84 testpinning '*'
85 msgmsg 'Tests with specific-form pin'
86 testpinning 'base-files'
87 msgmsg 'Tests with specific-form pin with glob'
88 testpinning 'base-fil*'
89 msgmsg 'Tests with specific-form pin with regex'
90 testpinning '/^base-f[iI]les$/'