]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-ims
eipp: enable xz-compressed scenario logging
[apt.git] / test / integration / test-apt-update-ims
CommitLineData
63d0f853
MV
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
63d0f853
MV
6setupenvironment
7configarchitecture 'amd64'
8
ba6b79bd 9insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
1dd20368 10insertpackage 'unstable' 'unrelated2' 'amd64' '0.5~squeeze1'
ba6b79bd 11insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
63d0f853 12
5a23c56d 13export APT_DONT_SIGN=""
846bc058 14setupaptarchive --no-update
63d0f853
MV
15changetowebserver
16
47450dea 17runtest() {
995a4bf6 18 local APTOPT=""
ba6b79bd 19 if [ -n "$1" ]; then
995a4bf6 20 APTOPT='--allow-insecure-repositories'
ba6b79bd 21 else
995a4bf6 22 APTOPT='--no-allow-insecure-repositories'
ba6b79bd 23 fi
4fa34122 24
ba6b79bd 25 rm -rf rootdir/var/lib/apt/lists/
63d0f853 26
ba6b79bd 27 local TEST="test${1:-success}"
0179cfa8 28 $TEST aptget update $APTOPT -o Debug::pkgAcquire::Worker=1
ba6b79bd
DK
29 if [ "$1" = 'failure' ]; then
30 # accept the outdated Release file so we can check Hit behaviour
995a4bf6 31 "test${2:-success}" aptget update -o Acquire::Min-ValidTime=9999999 $APTOPT
4fa34122 32 fi
ba6b79bd 33 listcurrentlistsdirectory > listsdir.lst
0179cfa8
DK
34 testsuccess grep '_Packages\(\.[0-9a-z]\+\)\?$' listsdir.lst
35 testsuccess grep '_Sources\(\.[0-9a-z]\+\)\?$' listsdir.lst
36 testsuccess grep '_Translation-en\(\.[0-9a-z]\+\)\?$' listsdir.lst
47450dea
MV
37
38 # ensure no leftovers in partial
ba6b79bd 39 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
40
41 # check that I-M-S header is kept in redirections
ba6b79bd 42 echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
87d6947d 43 $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 $APTOPT
ba6b79bd
DK
44 sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output
45 testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output
46 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
47
48 # ensure that we still do a hash check for other files on ims hit of Release
1eb1836f 49 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then
995a4bf6 50 $TEST aptget update -o Debug::Acquire::gpgv=1 $APTOPT
ba6b79bd
DK
51 cp rootdir/tmp/${TEST}.output goodsign.output
52 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
5419a6ce 53 testsuccess grep '^Got GOODSIG ' goodsign.output
ba6b79bd 54 fi
47450dea
MV
55
56 # ensure no leftovers in partial
ba6b79bd 57 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
58}
59
ba6b79bd 60msgmsg 'InRelease'
6c0765c0
DK
61EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
62Reading package lists..."
ba6b79bd 63echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318 64runtest
ba6b79bd 65echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318
MV
66runtest
67
ba6b79bd 68msgmsg 'Release/Release.gpg'
6c0765c0 69EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
4dbfe436 70 404 Not Found
6c0765c0
DK
71Hit:2 http://localhost:${APTHTTPPORT} unstable Release
72Reading package lists..."
ab25bf1f 73find aptarchive -name 'InRelease' -delete
ba6b79bd 74echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 75runtest
ba6b79bd 76echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 77runtest
f3097647 78
ba6b79bd 79msgmsg 'Release only'
6c0765c0 80EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
4dbfe436 81 404 Not Found
6c0765c0
DK
82Hit:2 http://localhost:${APTHTTPPORT} unstable Release
83Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
4dbfe436 84 404 Not Found
9d653a6d 85Reading package lists...
f18f2338 86W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
d04e44ac 87N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 88N: See apt-secure(8) manpage for repository creation and user configuration details."
ba6b79bd
DK
89find aptarchive -name 'Release.gpg' -delete
90echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
91runtest 'warning'
92echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
93runtest 'warning'
94
95
96# make the release file old
97find aptarchive -name '*Release' -exec sed -i \
9febc2b2 98 -e "s#^Date: .*\$#Date: $(date -ud '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
ba6b79bd 99 -e '/^Valid-Until: / d' -e "/^Date: / a\
9febc2b2 100Valid-Until: $(date -ud '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
ba6b79bd
DK
101signreleasefiles
102
103msgmsg 'expired InRelease'
6c0765c0 104EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
95278287 105Reading package lists...
6c0765c0 106E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
ba6b79bd
DK
107echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
108runtest 'failure'
109echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
110runtest 'failure'
111
112msgmsg 'expired Release/Release.gpg'
6c0765c0 113EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 114 404 Not Found
6c0765c0 115Hit:2 http://localhost:${APTHTTPPORT} unstable Release
95278287 116Reading package lists...
6c0765c0 117E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
ba6b79bd
DK
118find aptarchive -name 'InRelease' -delete
119echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
120runtest 'failure'
121echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
122runtest 'failure'
f3097647 123
ba6b79bd 124msgmsg 'expired Release only'
6c0765c0 125EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 126 404 Not Found
6c0765c0
DK
127Hit:2 http://localhost:${APTHTTPPORT} unstable Release
128Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
ba6b79bd 129 404 Not Found
95278287 130Reading package lists...
f18f2338 131W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
d04e44ac 132N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 133N: See apt-secure(8) manpage for repository creation and user configuration details.
6c0765c0 134E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
ab25bf1f 135find aptarchive -name 'Release.gpg' -delete
ba6b79bd
DK
136echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
137runtest 'failure' 'warning'
138echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
139runtest 'failure' 'warning'
f3097647 140
f3097647 141
ba6b79bd 142msgmsg 'no Release at all'
6c0765c0 143EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 144 404 Not Found
6c0765c0 145Ign:2 http://localhost:${APTHTTPPORT} unstable Release
ba6b79bd 146 404 Not Found
6c0765c0 147Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 148 404 Not Found
6c0765c0 149Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 150 404 Not Found
1dd20368
DK
151Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
152 404 Not Found
153Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 154 404 Not Found
6c0765c0 155Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 156 404 Not Found
6c0765c0 157Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 158 404 Not Found
1dd20368
DK
159Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
160 404 Not Found
161Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 162 404 Not Found
6c0765c0 163Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 164 404 Not Found
6c0765c0 165Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 166 404 Not Found
1dd20368
DK
167Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
168 404 Not Found
169Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 170 404 Not Found
6c0765c0
DK
171Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources
172Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
1dd20368
DK
173Hit:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
174Hit:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
ba6b79bd 175Reading package lists...
f18f2338 176W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file.
d04e44ac 177N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 178N: See apt-secure(8) manpage for repository creation and user configuration details."
ba6b79bd
DK
179find aptarchive -name '*Release*' -delete
180echo 'Acquire::GzipIndexes "0";
181Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
182runtest 'warning'
183echo 'Acquire::GzipIndexes "1";
184Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
185runtest 'warning'