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
108 BPO1ARCHIVE
=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages"
112 $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} backports/main i386 Packages"
113 SB
="$(echo "$SB" | tail -n 1)"
117 testsuccessequal
"coolstuff:
118 Installed: $INSTALLED
119 Candidate: $CANDIDATE
120 ${PINVERSION}Version table:${BPO2ARCHIVE}
124 $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} stable/main i386 Packages$SS" \
125 aptcache policy coolstuff
-o Policy
=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $
*
128 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 0 ""
129 testequalpolicycoolstuff
"" "1.0" 500 990 0 "" -t stable
130 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -t backports
132 Pin: release n=backports
133 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
134 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=GlobalPin
135 testequalpolicycoolstuff
"" "1.0" 200 990 0 "" -o Test
=GlobalPin
-t stable
136 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=GlobalPin
-t backports
138 Pin: release n=backports
139 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
140 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=GlobalPin
141 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=GlobalPin
-t stable
142 echo "Package: coolstuff
143 Pin: release n=backports
144 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
145 #FIXME: policy can't differentiate between two sources where one has a package specific pin in place
146 # testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin
147 # testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports
148 testequalpolicycoolstuff
"" "1.0" 500 990 200 "2.0~bpo1" -o Test
=PackagePin
-t stable
149 echo "Package: coolstuff
150 Pin: release n=backports
151 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
152 testequalpolicycoolstuff
"" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test
=PackagePin
153 testequalpolicycoolstuff
"" "1.0" 500 990 600 "2.0~bpo1" -o Test
=PackagePin
-t stable
154 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=PackagePin
-t backports
156 echo "Package: coolstuff
157 Pin: release n=backports
158 Pin-Priority: -1" > rootdir
/etc
/apt
/preferences
159 # testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin
160 # testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports
161 # testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable
163 rm rootdir
/etc
/apt
/preferences
164 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
168 testequalpolicycoolstuff
"" "1.0" 1 500 0 "" -o Test
=NotAutomatic
169 testequalpolicycoolstuff
"" "1.0" 1 990 0 "" -o Test
=NotAutomatic
-t stable
170 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=NotAutomatic
-t backports
172 Pin: release n=backports
173 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
174 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=NotAutomatic
176 Pin: release n=backports
177 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
178 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=NotAutomatic
179 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=NotAutomatic
-t stable
180 echo "Package: coolstuff
181 Pin: release n=backports
182 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
183 testequalpolicycoolstuff
"" "1.0" 1 500 200 "2.0~bpo1" -o Test
=NotAutomatic
184 echo "Package: coolstuff
185 Pin: release n=backports
186 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
187 testequalpolicycoolstuff
"" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test
=NotAutomatic
188 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=NotAutomatic
-t backports
189 testequalpolicycoolstuff
"" "1.0" 1 990 600 "2.0~bpo1" -o Test
=NotAutomatic
-t stable
191 rm rootdir
/etc
/apt
/preferences
192 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
196 testequalpolicycoolstuff
"" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
197 testequalpolicycoolstuff
"" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
198 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
200 Pin: release n=backports
201 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
202 testequalpolicycoolstuff
"" "1.0" 200 500 0 "" -o Test
=ButAutomaticUpgrades
204 Pin: release n=backports
205 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
206 testequalpolicycoolstuff
"" "2.0~bpo1" 600 500 0 "" -o Test
=ButAutomaticUpgrades
207 testequalpolicycoolstuff
"" "1.0" 600 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
208 echo "Package: coolstuff
209 Pin: release n=backports
210 Pin-Priority: 200" > rootdir
/etc
/apt
/preferences
211 testequalpolicycoolstuff
"" "1.0" 100 500 200 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
212 echo "Package: coolstuff
213 Pin: release n=backports
214 Pin-Priority: 600" > rootdir
/etc
/apt
/preferences
215 testequalpolicycoolstuff
"" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
216 testequalpolicycoolstuff
"" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t backports
217 testequalpolicycoolstuff
"" "1.0" 100 990 600 "2.0~bpo1" -o Test
=ButAutomaticUpgrades
-t stable
219 rm rootdir
/etc
/apt
/preferences
220 testsuccess aptget
install coolstuff
-y
221 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
222 testsuccess aptget dist
-upgrade -y
223 testequalpolicycoolstuff
"1.0" "1.0" 100 500 0 "" -o Test
=ButAutomaticUpgrades
224 testequalpolicycoolstuff
"1.0" "1.0" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
225 testequalpolicycoolstuff
"1.0" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
227 testsuccess aptget
install coolstuff
-t backports
-y
228 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
229 testsuccess aptget dist
-upgrade -y
230 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test
=ButAutomaticUpgrades
231 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test
=ButAutomaticUpgrades
-t stable
232 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test
=ButAutomaticUpgrades
-t backports
234 rm incoming
/backports.main.pkglist incoming
/backports.main.srclist
235 buildsimplenativepackage
"coolstuff" "all" "2.0~bpo2" "backports"
238 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"NotAutomatic: yes"
242 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
243 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t stable
244 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=NotAutomatic
-t backports
246 sed -i aptarchive
/dists
/backports
/Release
-e 1i
"ButAutomaticUpgrades: yes"
250 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
251 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t stable
252 testequalpolicycoolstuff
"2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test
=ButAutomaticUpgrades
-t backports