]>
Commit | Line | Data |
---|---|---|
5ed56f93 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
9962ae93 | 4 | TESTDIR=$(readlink -f $(dirname $0)) |
5ed56f93 DK |
5 | . $TESTDIR/framework |
6 | ||
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | buildaptarchive | |
11 | setupflataptarchive | |
12 | ||
13 | STATUS=$(readlink -f rootdir/var/lib/dpkg/status) | |
14 | APTARCHIVE=$(readlink -f aptarchive) | |
15 | ||
16 | testequalpolicy() { | |
17 | local SP="$1" | |
18 | local AP="$2" | |
19 | shift 2 | |
20 | testequal "Package files: | |
21 | $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS} | |
22 | release a=now | |
23 | $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages | |
24 | release c= | |
25 | Pinned packages:" aptcache policy $* | |
26 | } | |
27 | ||
28 | aptget update -qq | |
29 | testequalpolicy 100 500 | |
30 | testequalpolicy 990 500 -t now | |
31 | ||
32 | sed -i aptarchive/Release -e 1i"NotAutomatic: yes" | |
5ed56f93 DK |
33 | aptget update -qq |
34 | ||
35 | testequalpolicy 100 1 -o Test=NotAutomatic | |
36 | testequalpolicy 990 1 -o Test=NotAutomatic -t now | |
37 | ||
38 | sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" | |
5ed56f93 DK |
39 | aptget update -qq |
40 | ||
41 | testequalpolicy 100 100 -o Test=ButAutomaticUpgrades | |
42 | testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now | |
43 | ||
44 | sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' | |
5ed56f93 DK |
45 | aptget update -qq |
46 | ||
47 | testequalpolicy 100 500 -o Test=Automatic | |
48 | testequalpolicy 990 500 -o Test=Automatic -t now | |
49 | ||
50 | buildsimplenativepackage "coolstuff" "all" "1.0" "stable" | |
51 | buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports" | |
52 | ||
53 | setupaptarchive | |
54 | ||
55 | testequalpolicycoolstuff() { | |
56 | local INSTALLED="${1:-(none)}" | |
57 | local CANDIDATE="${2:-(none)}" | |
58 | local AB="$3" | |
59 | local AS="$4" | |
60 | local PB="$5" | |
61 | local PINVERSION="$6" | |
62 | if [ -n "$PINVERSION" ]; then | |
63 | PINVERSION="Package pin: $PINVERSION | |
64 | " | |
65 | fi | |
66 | local IS="" | |
67 | local IB="" | |
68 | local SB="" | |
69 | local SS="" | |
70 | [ "$1" = "2.0~bpo1" ] && IB="***" && SB=" | |
71 | 100 $STATUS" || IB=" " | |
72 | [ "$1" = "1.0" ] && IS="***" && SS=" | |
73 | 100 $STATUS" || IS=" " | |
74 | local BPO1ARCHIVE="" | |
75 | local BPO2ARCHIVE="" | |
76 | if [ ! "$7" = "2.0~bpo2" ]; then | |
77 | BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" | |
78 | else | |
79 | BPO2ARCHIVE=" | |
80 | 2.0~bpo2 $PB | |
81 | $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" | |
82 | SB="$(echo "$SB" | tail -n 1)" | |
83 | shift | |
84 | fi | |
85 | shift 6 | |
86 | testequal "coolstuff: | |
87 | Installed: $INSTALLED | |
88 | Candidate: $CANDIDATE | |
89 | ${PINVERSION}Version table:${BPO2ARCHIVE} | |
90 | $IB 2.0~bpo1 $PB | |
91 | ${BPO1ARCHIVE}$SB | |
92 | $IS 1.0 $PB | |
93 | $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \ | |
94 | aptcache policy coolstuff -o Policy=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $* | |
95 | } | |
96 | ||
97 | testequalpolicycoolstuff "" "2.0~bpo1" 500 500 0 "" | |
98 | testequalpolicycoolstuff "" "1.0" 500 990 0 "" -t stable | |
99 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -t backports | |
100 | echo "Package: * | |
101 | Pin: release n=backports | |
102 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
103 | testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=GlobalPin | |
104 | testequalpolicycoolstuff "" "1.0" 200 990 0 "" -o Test=GlobalPin -t stable | |
105 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=GlobalPin -t backports | |
106 | echo "Package: * | |
107 | Pin: release n=backports | |
108 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
109 | testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=GlobalPin | |
110 | testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=GlobalPin -t stable | |
111 | echo "Package: coolstuff | |
112 | Pin: release n=backports | |
113 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
114 | #FIXME: policy can't differentiate between two sources where one has a package specific pin in place | |
115 | # testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin | |
116 | # testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports | |
117 | testequalpolicycoolstuff "" "1.0" 500 990 200 "2.0~bpo1" -o Test=PackagePin -t stable | |
118 | echo "Package: coolstuff | |
119 | Pin: release n=backports | |
120 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
121 | testequalpolicycoolstuff "" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test=PackagePin | |
122 | testequalpolicycoolstuff "" "1.0" 500 990 600 "2.0~bpo1" -o Test=PackagePin -t stable | |
123 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=PackagePin -t backports | |
124 | ||
125 | echo "Package: coolstuff | |
126 | Pin: release n=backports | |
127 | Pin-Priority: -1" > rootdir/etc/apt/preferences | |
128 | # testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin | |
129 | # testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports | |
130 | # testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable | |
131 | ||
132 | rm rootdir/etc/apt/preferences | |
133 | sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" | |
134 | signreleasefiles | |
5ed56f93 DK |
135 | aptget update -qq |
136 | ||
137 | testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic | |
138 | testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable | |
139 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=NotAutomatic -t backports | |
140 | echo "Package: * | |
141 | Pin: release n=backports | |
142 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
143 | testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=NotAutomatic | |
144 | echo "Package: * | |
145 | Pin: release n=backports | |
146 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
147 | testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=NotAutomatic | |
148 | testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=NotAutomatic -t stable | |
149 | echo "Package: coolstuff | |
150 | Pin: release n=backports | |
151 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
152 | testequalpolicycoolstuff "" "1.0" 1 500 200 "2.0~bpo1" -o Test=NotAutomatic | |
153 | echo "Package: coolstuff | |
154 | Pin: release n=backports | |
155 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
156 | testequalpolicycoolstuff "" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test=NotAutomatic | |
157 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=NotAutomatic -t backports | |
158 | testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t stable | |
159 | ||
160 | rm rootdir/etc/apt/preferences | |
161 | sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" | |
162 | signreleasefiles | |
5ed56f93 DK |
163 | aptget update -qq |
164 | ||
165 | testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades | |
166 | testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable | |
167 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports | |
168 | echo "Package: * | |
169 | Pin: release n=backports | |
170 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
171 | testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=ButAutomaticUpgrades | |
172 | echo "Package: * | |
173 | Pin: release n=backports | |
174 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
175 | testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=ButAutomaticUpgrades | |
176 | testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=ButAutomaticUpgrades -t stable | |
177 | echo "Package: coolstuff | |
178 | Pin: release n=backports | |
179 | Pin-Priority: 200" > rootdir/etc/apt/preferences | |
180 | testequalpolicycoolstuff "" "1.0" 100 500 200 "2.0~bpo1" -o Test=ButAutomaticUpgrades | |
181 | echo "Package: coolstuff | |
182 | Pin: release n=backports | |
183 | Pin-Priority: 600" > rootdir/etc/apt/preferences | |
184 | testequalpolicycoolstuff "" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades | |
185 | testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t backports | |
186 | testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable | |
187 | ||
188 | rm rootdir/etc/apt/preferences | |
189 | aptget install coolstuff -qq > /dev/null 2> /dev/null | |
190 | testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades | |
191 | aptget dist-upgrade -qq > /dev/null 2> /dev/null | |
192 | testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades | |
193 | testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable | |
194 | testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports | |
195 | ||
196 | aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null | |
197 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades | |
198 | aptget dist-upgrade -qq > /dev/null 2> /dev/null | |
199 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades | |
200 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable | |
201 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports | |
202 | ||
203 | rm incoming/backports.main.pkglist incoming/backports.main.srclist | |
204 | buildsimplenativepackage "coolstuff" "all" "2.0~bpo2" "backports" | |
205 | setupaptarchive | |
206 | ||
207 | sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" | |
208 | signreleasefiles | |
5ed56f93 DK |
209 | aptget update -qq |
210 | ||
211 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic | |
212 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable | |
213 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=NotAutomatic -t backports | |
214 | ||
215 | sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" | |
216 | signreleasefiles | |
5ed56f93 DK |
217 | aptget update -qq |
218 | ||
219 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades | |
220 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable | |
221 | testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t backports |