]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-543966-downgrade-below-1000-pin
rename Calculate- to GetIndexTargets and use it as official API
[apt.git] / test / integration / test-bug-543966-downgrade-below-1000-pin
CommitLineData
16808002
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture 'i386'
9
10insertpackage 'unstable' 'base-files' 'all' '5.0.0'
11insertinstalledpackage 'base-files' 'all' '5.0.0-1'
12
13setupaptarchive
14
15STATUS=$(readlink -f rootdir/var/lib/dpkg/status)
16APTARCHIVE="$(readlink -f aptarchive)/"
17
25b86db1 18testsuccessequal "base-files:
16808002
DK
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
3f732aa6
DK
27writepin() {
28 echo "Package: $1
16808002 29Pin: release a=unstable
3f732aa6
DK
30Pin-Priority: $2" > rootdir/etc/apt/preferences
31}
16808002 32
3f732aa6
DK
33
34
35testpinning() {
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:
16808002
DK
47 Installed: 5.0.0-1
48 Candidate: 5.0.0-1
3f732aa6
DK
49 ${PKGPIN}Version table:
50 *** 5.0.0-1 ${PKGPINPRIO:-99}
16808002 51 100 $STATUS
3f732aa6
DK
52 5.0.0 ${PKGPINPRIO:-99}
53 ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99
16808002 54
3f732aa6
DK
55 writepin "$1" '100'
56 testsuccessequal "base-files:
16808002
DK
57 Installed: 5.0.0-1
58 Candidate: 5.0.0-1
3f732aa6
DK
59 ${PKGPIN}Version table:
60 *** 5.0.0-1 ${PKGPINPRIO:-100}
16808002 61 100 $STATUS
3f732aa6
DK
62 5.0.0 ${PKGPINPRIO:-100}
63 ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100
16808002 64
3f732aa6
DK
65 writepin "$1" '999'
66 testsuccessequal "base-files:
16808002
DK
67 Installed: 5.0.0-1
68 Candidate: 5.0.0-1
3f732aa6
DK
69 ${PKGPIN}Version table:
70 *** 5.0.0-1 ${PKGPINPRIO:-999}
16808002 71 100 $STATUS
3f732aa6
DK
72 5.0.0 ${PKGPINPRIO:-999}
73 ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999
16808002 74
3f732aa6
DK
75 writepin "$1" '1000'
76 testsuccessequal "base-files:
16808002
DK
77 Installed: 5.0.0-1
78 Candidate: 5.0.0
3f732aa6
DK
79 ${PKGPIN}Version table:
80 *** 5.0.0-1 ${PKGPINPRIO:-1000}
16808002 81 100 $STATUS
3f732aa6
DK
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
86msgmsg 'Tests with generic-form pin'
87testpinning '*'
88msgmsg 'Tests with specific-form pin'
89testpinning 'base-files'
ab640001
DK
90msgmsg 'Tests with specific-form pin with glob'
91testpinning 'base-fil*'
92msgmsg 'Tests with specific-form pin with regex'
93testpinning '/^base-f[iI]les$/'