4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
13 STATUS
=$(readlink -f rootdir/var/lib/dpkg/status)
14 APTARCHIVE
=$(readlink -f aptarchive)
20 testequal
"Package files:
21 $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS}
23 $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages
25 Pinned packages:" aptcache policy $
*
29 # just to be sure that no old files are used
30 rm -rf rootdir
/var
/lib
/apt
31 if aptget update
--allow-insecure-repositories -qq 2>&1 | grep '^E: '; then
32 msgwarn
'apt-get update failed with an error'
36 ### not signed archive
40 testequalpolicy
100 500
41 testequalpolicy
990 500 -t now
43 sed -i aptarchive
/Release
-e 1i
"NotAutomatic: yes"
46 testequalpolicy
100 1 -o Test
=NotAutomatic
47 testequalpolicy
990 1 -o Test
=NotAutomatic
-t now
49 sed -i aptarchive
/Release
-e 1i
"ButAutomaticUpgrades: yes"
52 testequalpolicy
100 100 -o Test
=ButAutomaticUpgrades
53 testequalpolicy
990 100 -o Test
=ButAutomaticUpgrades
-t now
55 sed -i aptarchive
/Release
-e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
58 testequalpolicy
100 500 -o Test
=Automatic
59 testequalpolicy
990 500 -o Test
=Automatic
-t now
61 sed -i aptarchive
/Release
-e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
63 ### signed but no key in trusted
65 signreleasefiles
'Marvin Paranoid'
67 testequalpolicy
100 500
68 testequalpolicy
990 500 -t now
70 sed -i aptarchive
/Release
-e 1i
"NotAutomatic: yes"
71 signreleasefiles
'Marvin Paranoid'
74 testequalpolicy
100 1 -o Test
=NotAutomatic
75 testequalpolicy
990 1 -o Test
=NotAutomatic
-t now
77 sed -i aptarchive
/Release
-e 1i
"ButAutomaticUpgrades: yes"
78 signreleasefiles
'Marvin Paranoid'
81 testequalpolicy
100 100 -o Test
=ButAutomaticUpgrades
82 testequalpolicy
990 100 -o Test
=ButAutomaticUpgrades
-t now
84 sed -i aptarchive
/Release
-e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
85 signreleasefiles
'Marvin Paranoid'
88 testequalpolicy
100 500 -o Test
=Automatic
89 testequalpolicy
990 500 -o Test
=Automatic
-t now
91 ### signed and valid key
93 buildsimplenativepackage
"coolstuff" "all" "1.0" "stable"
94 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo1" "backports"
98 testequalpolicycoolstuff
() {
99 local INSTALLED
="${1:-(none)}"
100 local CANDIDATE
="${2:-(none)}"
104 local PINVERSION
="$6"
105 if [ -n "$PINVERSION" ]; then
106 PINVERSION
="Package pin: $PINVERSION
113 [ "$1" = "2.0~bpo1" ] && IB
="***" && SB
="
114 100 $STATUS" || IB
=" "
115 [ "$1" = "1.0" ] && IS
="***" && SS
="
116 100 $STATUS" || IS
=" "
119 if [ ! "$7" = "2.0~bpo2" ]; then
120 BPO1ARCHIVE
=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages"
124 $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages"
125 SB
="$(echo "$SB" | tail -n 1)"
129 testequal
"coolstuff:
130 Installed: $INSTALLED
131 Candidate: $CANDIDATE
132 ${PINVERSION}Version table:${BPO2ARCHIVE}
136 $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \
137 aptcache policy coolstuff
-o Policy
=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $
*
140 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 0 ""
141 testequalpolicycoolstuff
"" "1.0" 500 990 0 "" -t stable
142 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -t backports
144 Pin: release n=backports
145 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
146 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=GlobalPin
147 testequalpolicycoolstuff
"" "1.0" 200 990 0 "" -o Test
=GlobalPin
-t stable
148 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=GlobalPin
-t backports
150 Pin: release n=backports
151 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
152 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=GlobalPin
153 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=GlobalPin
-t stable
154 echo "Package: coolstuff
155 Pin: release n=backports
156 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
157 #FIXME: policy can't differentiate between two sources where one has a package specific pin in place
158 # testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin
159 # testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports
160 testequalpolicycoolstuff
"" "1.0" 500 990 200 "2.0~bpo1" -o Test
=PackagePin
-t stable
161 echo "Package: coolstuff
162 Pin: release n=backports
163 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
164 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test
=PackagePin
165 testequalpolicycoolstuff
"" "1.0" 500 990 600 "2.0~bpo1" -o Test
=PackagePin
-t stable
166 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=PackagePin
-t backports
168 echo "Package: coolstuff
169 Pin: release n=backports
170 Pin-Priority: -1" > rootdir
/etc
/apt
/preferences
171 # testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin
172 # testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports
173 # testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable
175 rm rootdir
/etc
/apt
/preferences
176 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
180 testequalpolicycoolstuff
"" "1.0" 1 500 0 "" -o Test
=NotAutomatic
181 testequalpolicycoolstuff
"" "1.0" 1 990 0 "" -o Test
=NotAutomatic
-t stable
182 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=NotAutomatic
-t backports
184 Pin: release n=backports
185 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
186 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=NotAutomatic
188 Pin: release n=backports
189 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
190 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=NotAutomatic
191 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=NotAutomatic
-t stable
192 echo "Package: coolstuff
193 Pin: release n=backports
194 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
195 testequalpolicycoolstuff
"" "1.0" 1 500 200 "2.0~bpo1" -o Test
=NotAutomatic
196 echo "Package: coolstuff
197 Pin: release n=backports
198 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
199 testequalpolicycoolstuff
"" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test
=NotAutomatic
200 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=NotAutomatic
-t backports
201 testequalpolicycoolstuff
"" "1.0" 1 990 600 "2.0~bpo1" -o Test
=NotAutomatic
-t stable
203 rm rootdir
/etc
/apt
/preferences
204 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
208 testequalpolicycoolstuff
"" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
209 testequalpolicycoolstuff
"" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
210 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
212 Pin: release n=backports
213 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
214 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=ButAutomaticUpgrades
216 Pin: release n=backports
217 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
218 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=ButAutomaticUpgrades
219 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
220 echo "Package: coolstuff
221 Pin: release n=backports
222 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
223 testequalpolicycoolstuff
"" "1.0" 100 500 200 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
224 echo "Package: coolstuff
225 Pin: release n=backports
226 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
227 testequalpolicycoolstuff
"" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
228 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t backports
229 testequalpolicycoolstuff
"" "1.0" 100 990 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t stable
231 rm rootdir
/etc
/apt
/preferences
232 testsuccess aptget
install coolstuff
-y
233 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
234 testsuccess aptget dist
-upgrade -y
235 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
236 testequalpolicycoolstuff
"1.0" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
237 testequalpolicycoolstuff
"1.0" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
239 testsuccess aptget
install coolstuff
-t backports
-y
240 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
241 testsuccess aptget dist
-upgrade -y
242 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
243 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
244 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
246 rm incoming
/backports.main.pkglist incoming
/backports.main.srclist
247 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo2" "backports"
250 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
254 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
255 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t stable
256 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t backports
258 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
262 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
263 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t stable
264 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t backports