]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-543966-downgrade-below-1000-pin
Merge branch 'debian/sid' into debian/experimental
[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 0
23 100 $STATUS
24 5.0.0 0
25 500 file:${APTARCHIVE} unstable/main i386 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 PKGPIN=''
37 local PKGPINPRIO='0'
38 local REPPINPRIO=''
39 if [ "$1" != '*' ]; then
40 PKGPINPRIO=''
41 REPPINPRIO=' 500'
42 PKGPIN='Package pin: 5.0.0
43 '
44 fi
45 writepin "$1" '99'
46 testsuccessequal "base-files:
47 Installed: 5.0.0-1
48 Candidate: 5.0.0-1
49 ${PKGPIN}Version table:
50 *** 5.0.0-1 ${PKGPINPRIO:-99}
51 100 $STATUS
52 5.0.0 ${PKGPINPRIO:-99}
53 ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99
54
55 writepin "$1" '100'
56 testsuccessequal "base-files:
57 Installed: 5.0.0-1
58 Candidate: 5.0.0-1
59 ${PKGPIN}Version table:
60 *** 5.0.0-1 ${PKGPINPRIO:-100}
61 100 $STATUS
62 5.0.0 ${PKGPINPRIO:-100}
63 ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100
64
65 writepin "$1" '999'
66 testsuccessequal "base-files:
67 Installed: 5.0.0-1
68 Candidate: 5.0.0-1
69 ${PKGPIN}Version table:
70 *** 5.0.0-1 ${PKGPINPRIO:-999}
71 100 $STATUS
72 5.0.0 ${PKGPINPRIO:-999}
73 ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999
74
75 writepin "$1" '1000'
76 testsuccessequal "base-files:
77 Installed: 5.0.0-1
78 Candidate: 5.0.0
79 ${PKGPIN}Version table:
80 *** 5.0.0-1 ${PKGPINPRIO:-1000}
81 100 $STATUS
82 5.0.0 ${PKGPINPRIO:-1000}
83 ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000
84 }
85
86 msgmsg 'Tests with generic-form pin'
87 testpinning '*'
88 msgmsg 'Tests with specific-form pin'
89 testpinning 'base-files'
90 msgmsg 'Tests with specific-form pin with glob'
91 testpinning 'base-fil*'
92 msgmsg 'Tests with specific-form pin with regex'
93 testpinning '/^base-f[iI]les$/'