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
-qq 2>&1 | grep '^E: '; then
32 msgwarn
'apt-get update failed with an error'
36 ### not signed archive
39 testequalpolicy
100 500
40 testequalpolicy
990 500 -t now
42 sed -i aptarchive
/Release
-e 1i
"NotAutomatic: yes"
45 testequalpolicy
100 1 -o Test
=NotAutomatic
46 testequalpolicy
990 1 -o Test
=NotAutomatic
-t now
48 sed -i aptarchive
/Release
-e 1i
"ButAutomaticUpgrades: yes"
51 testequalpolicy
100 100 -o Test
=ButAutomaticUpgrades
52 testequalpolicy
990 100 -o Test
=ButAutomaticUpgrades
-t now
54 sed -i aptarchive
/Release
-e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
57 testequalpolicy
100 500 -o Test
=Automatic
58 testequalpolicy
990 500 -o Test
=Automatic
-t now
60 sed -i aptarchive
/Release
-e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
62 ### signed but no key in trusted
64 signreleasefiles
'Marvin Paranoid'
66 testequalpolicy
100 500
67 testequalpolicy
990 500 -t now
69 sed -i aptarchive
/Release
-e 1i
"NotAutomatic: yes"
70 signreleasefiles
'Marvin Paranoid'
73 testequalpolicy
100 1 -o Test
=NotAutomatic
74 testequalpolicy
990 1 -o Test
=NotAutomatic
-t now
76 sed -i aptarchive
/Release
-e 1i
"ButAutomaticUpgrades: yes"
77 signreleasefiles
'Marvin Paranoid'
80 testequalpolicy
100 100 -o Test
=ButAutomaticUpgrades
81 testequalpolicy
990 100 -o Test
=ButAutomaticUpgrades
-t now
83 sed -i aptarchive
/Release
-e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
84 signreleasefiles
'Marvin Paranoid'
87 testequalpolicy
100 500 -o Test
=Automatic
88 testequalpolicy
990 500 -o Test
=Automatic
-t now
90 ### signed and valid key
92 buildsimplenativepackage
"coolstuff" "all" "1.0" "stable"
93 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo1" "backports"
97 testequalpolicycoolstuff
() {
98 local INSTALLED
="${1:-(none)}"
99 local CANDIDATE
="${2:-(none)}"
103 local PINVERSION
="$6"
104 if [ -n "$PINVERSION" ]; then
105 PINVERSION
="Package pin: $PINVERSION
112 [ "$1" = "2.0~bpo1" ] && IB
="***" && SB
="
113 100 $STATUS" || IB
=" "
114 [ "$1" = "1.0" ] && IS
="***" && SS
="
115 100 $STATUS" || IS
=" "
118 if [ ! "$7" = "2.0~bpo2" ]; then
119 BPO1ARCHIVE
=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages"
123 $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages"
124 SB
="$(echo "$SB" | tail -n 1)"
128 testequal
"coolstuff:
129 Installed: $INSTALLED
130 Candidate: $CANDIDATE
131 ${PINVERSION}Version table:${BPO2ARCHIVE}
135 $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \
136 aptcache policy coolstuff
-o Policy
=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $
*
139 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 0 ""
140 testequalpolicycoolstuff
"" "1.0" 500 990 0 "" -t stable
141 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -t backports
143 Pin: release n=backports
144 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
145 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=GlobalPin
146 testequalpolicycoolstuff
"" "1.0" 200 990 0 "" -o Test
=GlobalPin
-t stable
147 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=GlobalPin
-t backports
149 Pin: release n=backports
150 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
151 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=GlobalPin
152 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=GlobalPin
-t stable
153 echo "Package: coolstuff
154 Pin: release n=backports
155 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
156 #FIXME: policy can't differentiate between two sources where one has a package specific pin in place
157 # testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin
158 # testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports
159 testequalpolicycoolstuff
"" "1.0" 500 990 200 "2.0~bpo1" -o Test
=PackagePin
-t stable
160 echo "Package: coolstuff
161 Pin: release n=backports
162 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
163 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test
=PackagePin
164 testequalpolicycoolstuff
"" "1.0" 500 990 600 "2.0~bpo1" -o Test
=PackagePin
-t stable
165 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=PackagePin
-t backports
167 echo "Package: coolstuff
168 Pin: release n=backports
169 Pin-Priority: -1" > rootdir
/etc
/apt
/preferences
170 # testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin
171 # testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports
172 # testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable
174 rm rootdir
/etc
/apt
/preferences
175 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
179 testequalpolicycoolstuff
"" "1.0" 1 500 0 "" -o Test
=NotAutomatic
180 testequalpolicycoolstuff
"" "1.0" 1 990 0 "" -o Test
=NotAutomatic
-t stable
181 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=NotAutomatic
-t backports
183 Pin: release n=backports
184 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
185 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=NotAutomatic
187 Pin: release n=backports
188 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
189 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=NotAutomatic
190 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=NotAutomatic
-t stable
191 echo "Package: coolstuff
192 Pin: release n=backports
193 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
194 testequalpolicycoolstuff
"" "1.0" 1 500 200 "2.0~bpo1" -o Test
=NotAutomatic
195 echo "Package: coolstuff
196 Pin: release n=backports
197 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
198 testequalpolicycoolstuff
"" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test
=NotAutomatic
199 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=NotAutomatic
-t backports
200 testequalpolicycoolstuff
"" "1.0" 1 990 600 "2.0~bpo1" -o Test
=NotAutomatic
-t stable
202 rm rootdir
/etc
/apt
/preferences
203 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
207 testequalpolicycoolstuff
"" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
208 testequalpolicycoolstuff
"" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
209 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
211 Pin: release n=backports
212 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
213 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=ButAutomaticUpgrades
215 Pin: release n=backports
216 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
217 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=ButAutomaticUpgrades
218 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
219 echo "Package: coolstuff
220 Pin: release n=backports
221 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
222 testequalpolicycoolstuff
"" "1.0" 100 500 200 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
223 echo "Package: coolstuff
224 Pin: release n=backports
225 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
226 testequalpolicycoolstuff
"" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
227 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t backports
228 testequalpolicycoolstuff
"" "1.0" 100 990 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t stable
230 rm rootdir
/etc
/apt
/preferences
231 aptget
install coolstuff
-qq > /dev
/null
2> /dev
/null
232 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
233 aptget dist
-upgrade -qq > /dev
/null
2> /dev
/null
234 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
235 testequalpolicycoolstuff
"1.0" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
236 testequalpolicycoolstuff
"1.0" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
238 aptget
install coolstuff
-t backports
-qq > /dev
/null
2> /dev
/null
239 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
240 aptget dist
-upgrade -qq > /dev
/null
2> /dev
/null
241 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
242 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
243 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
245 rm incoming
/backports.main.pkglist incoming
/backports.main.srclist
246 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo2" "backports"
249 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
253 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
254 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t stable
255 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t backports
257 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
261 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
262 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t stable
263 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t backports