4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
13 STATUS
=$(readlink -f rootdir/var/lib/dpkg/status)
14 APTARCHIVE
=$(readlink -f aptarchive)
20 testsuccessequal
"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
"$@"
31 testequalpolicy
100 500
32 testequalpolicy
990 500 -t now
34 sed -i aptarchive
/Release
-e 1i
"NotAutomatic: yes"
37 testequalpolicy
100 1 -o Test
=NotAutomatic
38 testequalpolicy
990 1 -o Test
=NotAutomatic
-t now
40 sed -i aptarchive
/Release
-e 1i
"ButAutomaticUpgrades: yes"
43 testequalpolicy
100 100 -o Test
=ButAutomaticUpgrades
44 testequalpolicy
990 100 -o Test
=ButAutomaticUpgrades
-t now
46 sed -i aptarchive
/Release
-e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
49 testequalpolicy
100 500 -o Test
=Automatic
50 testequalpolicy
990 500 -o Test
=Automatic
-t now
52 sed -i aptarchive
/Release
-e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
55 msgmsg
'Test with not signed archive'
57 rm -rf rootdir
/var
/lib
/apt
58 testwarning aptget update
--allow-insecure-repositories
62 msgmsg
'Test with signed but no key in trusted'
64 rm -rf rootdir
/var
/lib
/apt
65 signreleasefiles
'Marvin Paranoid'
66 testwarning aptget update
--allow-insecure-repositories
70 # much the same tests will be executed below in more detail again for this one
71 msgmsg
'Test with signed and valid key'
73 rm -rf rootdir
/var
/lib
/apt
74 signreleasefiles
'Joe Sixpack'
75 testsuccess aptget update
79 msgmsg
'Test with specific packages'
81 buildsimplenativepackage
"coolstuff" "all" "1.0" "stable"
82 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo1" "backports"
86 testequalpolicycoolstuff
() {
87 local INSTALLED
="${1:-(none)}"
88 local CANDIDATE
="${2:-(none)}"
93 if [ -n "$PINVERSION" ]; then
94 PINVERSION
="Package pin: $PINVERSION
101 [ "$1" = "2.0~bpo1" ] && IB
="***" && SB
="
102 100 $STATUS" || IB
=" "
103 [ "$1" = "1.0" ] && IS
="***" && SS
="
104 100 $STATUS" || IS
=" "
107 if [ ! "$7" = "2.0~bpo2" ]; then
109 BPO1ARCHIVE
=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages"
113 $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages"
114 SB
="$(echo "$SB" | tail -n 1)"
118 testsuccessequal
"coolstuff:
119 Installed: $INSTALLED
120 Candidate: $CANDIDATE
121 ${PINVERSION}Version table:${BPO2ARCHIVE}
125 $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} stable/main i386 Packages$SS" \
126 aptcache policy coolstuff
-o Policy
=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $
*
129 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 500 ""
130 testequalpolicycoolstuff
"" "1.0" 500 990 500 "" -t stable
131 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 990 "" -t backports
133 Pin: release n=backports
134 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
135 testequalpolicycoolstuff
"" "1.0" 200 500 200 "" -o Test
=GlobalPin
136 testequalpolicycoolstuff
"" "1.0" 200 990 200 "" -o Test
=GlobalPin
-t stable
137 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 990 "" -o Test
=GlobalPin
-t backports
139 Pin: release n=backports
140 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
141 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 600 "" -o Test
=GlobalPin
142 testequalpolicycoolstuff
"" "1.0" 600 990 600 "" -o Test
=GlobalPin
-t stable
143 echo "Package: coolstuff
144 Pin: release n=backports
145 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
146 #FIXME: policy can't differentiate between two sources where one has a package specific pin in place
147 # testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin
148 # testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports
149 testequalpolicycoolstuff
"" "1.0" 500 990 200 "2.0~bpo1" -o Test
=PackagePin
-t stable
150 echo "Package: coolstuff
151 Pin: release n=backports
152 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
153 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test
=PackagePin
154 testequalpolicycoolstuff
"" "1.0" 500 990 600 "2.0~bpo1" -o Test
=PackagePin
-t stable
155 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=PackagePin
-t backports
157 echo "Package: coolstuff
158 Pin: release n=backports
159 Pin-Priority: -1" > rootdir
/etc
/apt
/preferences
160 # testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin
161 # testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports
162 # testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable
164 rm rootdir
/etc
/apt
/preferences
165 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
169 testequalpolicycoolstuff
"" "1.0" 1 500 1 "" -o Test
=NotAutomatic
170 testequalpolicycoolstuff
"" "1.0" 1 990 1 "" -o Test
=NotAutomatic
-t stable
171 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 990 "" -o Test
=NotAutomatic
-t backports
173 Pin: release n=backports
174 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
175 testequalpolicycoolstuff
"" "1.0" 200 500 200 "" -o Test
=NotAutomatic
177 Pin: release n=backports
178 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
179 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 600 "" -o Test
=NotAutomatic
180 testequalpolicycoolstuff
"" "1.0" 600 990 600 "" -o Test
=NotAutomatic
-t stable
181 echo "Package: coolstuff
182 Pin: release n=backports
183 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
184 testequalpolicycoolstuff
"" "1.0" 1 500 200 "2.0~bpo1" -o Test
=NotAutomatic
185 echo "Package: coolstuff
186 Pin: release n=backports
187 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
188 testequalpolicycoolstuff
"" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test
=NotAutomatic
189 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=NotAutomatic
-t backports
190 testequalpolicycoolstuff
"" "1.0" 1 990 600 "2.0~bpo1" -o Test
=NotAutomatic
-t stable
192 rm rootdir
/etc
/apt
/preferences
193 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
197 testequalpolicycoolstuff
"" "1.0" 100 500 100 "" -o Test
=ButAutomaticUpgrades
198 testequalpolicycoolstuff
"" "1.0" 100 990 100 "" -o Test
=ButAutomaticUpgrades
-t stable
199 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 990 "" -o Test
=ButAutomaticUpgrades
-t backports
201 Pin: release n=backports
202 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
203 testequalpolicycoolstuff
"" "1.0" 200 500 200 "" -o Test
=ButAutomaticUpgrades
205 Pin: release n=backports
206 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
207 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 600 "" -o Test
=ButAutomaticUpgrades
208 testequalpolicycoolstuff
"" "1.0" 600 990 600 "" -o Test
=ButAutomaticUpgrades
-t stable
209 echo "Package: coolstuff
210 Pin: release n=backports
211 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
212 testequalpolicycoolstuff
"" "1.0" 100 500 200 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
213 echo "Package: coolstuff
214 Pin: release n=backports
215 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
216 testequalpolicycoolstuff
"" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
217 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t backports
218 testequalpolicycoolstuff
"" "1.0" 100 990 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t stable
220 rm rootdir
/etc
/apt
/preferences
221 testsuccess aptget
install coolstuff
-y
222 testequalpolicycoolstuff
"1.0" "1.0" 100 500 100 "" -o Test
=ButAutomaticUpgrades
223 testsuccess aptget dist
-upgrade -y
224 testequalpolicycoolstuff
"1.0" "1.0" 100 500 100 "" -o Test
=ButAutomaticUpgrades
225 testequalpolicycoolstuff
"1.0" "1.0" 100 990 100 "" -o Test
=ButAutomaticUpgrades
-t stable
226 testequalpolicycoolstuff
"1.0" "2.0~bpo1" 990 500 990 "" -o Test
=ButAutomaticUpgrades
-t backports
228 testsuccess aptget
install coolstuff
-t backports
-y
229 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 100 "" -o Test
=ButAutomaticUpgrades
230 testsuccess aptget dist
-upgrade -y
231 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 100 "" -o Test
=ButAutomaticUpgrades
232 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 990 100 "" -o Test
=ButAutomaticUpgrades
-t stable
233 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 990 500 990 "" -o Test
=ButAutomaticUpgrades
-t backports
235 rm incoming
/backports.main.pkglist incoming
/backports.main.srclist
236 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo2" "backports"
239 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
243 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 500 100 "" "2.0~bpo2" -o Test
=NotAutomatic
244 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 990 100 "" "2.0~bpo2" -o Test
=NotAutomatic
-t stable
245 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 100 "" "2.0~bpo2" -o Test
=NotAutomatic
-t backports
247 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
251 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 500 100 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
252 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 990 100 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t stable
253 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 100 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t backports