]>
Commit | Line | Data |
---|---|---|
16808002 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
16808002 DK |
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) | |
1da3b7b8 | 16 | APTARCHIVE="$(readlink -f aptarchive)" |
16808002 | 17 | |
25b86db1 | 18 | testsuccessequal "base-files: |
16808002 DK |
19 | Installed: 5.0.0-1 |
20 | Candidate: 5.0.0-1 | |
21 | Version table: | |
76b004d1 | 22 | *** 5.0.0-1 100 |
16808002 | 23 | 100 $STATUS |
76b004d1 | 24 | 5.0.0 500 |
1dd20368 | 25 | 500 file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=0 |
16808002 | 26 | |
3f732aa6 DK |
27 | writepin() { |
28 | echo "Package: $1 | |
16808002 | 29 | Pin: release a=unstable |
3f732aa6 DK |
30 | Pin-Priority: $2" > rootdir/etc/apt/preferences |
31 | } | |
16808002 | 32 | |
3f732aa6 DK |
33 | |
34 | ||
35 | testpinning() { | |
76b004d1 | 36 | local PKGPINPRIO='' |
3f732aa6 DK |
37 | local REPPINPRIO='' |
38 | if [ "$1" != '*' ]; then | |
39 | PKGPINPRIO='' | |
40 | REPPINPRIO=' 500' | |
3f732aa6 DK |
41 | fi |
42 | writepin "$1" '99' | |
43 | testsuccessequal "base-files: | |
16808002 DK |
44 | Installed: 5.0.0-1 |
45 | Candidate: 5.0.0-1 | |
bb08e204 | 46 | Version table: |
76b004d1 | 47 | *** 5.0.0-1 100 |
16808002 | 48 | 100 $STATUS |
3f732aa6 | 49 | 5.0.0 ${PKGPINPRIO:-99} |
1dd20368 | 50 | ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=99 |
16808002 | 51 | |
3f732aa6 DK |
52 | writepin "$1" '100' |
53 | testsuccessequal "base-files: | |
16808002 DK |
54 | Installed: 5.0.0-1 |
55 | Candidate: 5.0.0-1 | |
bb08e204 | 56 | Version table: |
76b004d1 | 57 | *** 5.0.0-1 100 |
16808002 | 58 | 100 $STATUS |
3f732aa6 | 59 | 5.0.0 ${PKGPINPRIO:-100} |
1dd20368 | 60 | ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=100 |
16808002 | 61 | |
3f732aa6 DK |
62 | writepin "$1" '999' |
63 | testsuccessequal "base-files: | |
16808002 DK |
64 | Installed: 5.0.0-1 |
65 | Candidate: 5.0.0-1 | |
bb08e204 | 66 | Version table: |
76b004d1 | 67 | *** 5.0.0-1 100 |
16808002 | 68 | 100 $STATUS |
3f732aa6 | 69 | 5.0.0 ${PKGPINPRIO:-999} |
1dd20368 | 70 | ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=999 |
16808002 | 71 | |
3f732aa6 DK |
72 | writepin "$1" '1000' |
73 | testsuccessequal "base-files: | |
16808002 DK |
74 | Installed: 5.0.0-1 |
75 | Candidate: 5.0.0 | |
bb08e204 | 76 | Version table: |
76b004d1 | 77 | *** 5.0.0-1 100 |
16808002 | 78 | 100 $STATUS |
3f732aa6 | 79 | 5.0.0 ${PKGPINPRIO:-1000} |
1dd20368 | 80 | ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=1000 |
3f732aa6 DK |
81 | } |
82 | ||
83 | msgmsg 'Tests with generic-form pin' | |
84 | testpinning '*' | |
85 | msgmsg 'Tests with specific-form pin' | |
86 | testpinning 'base-files' | |
ab640001 DK |
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$/' |